akhauriyash/Code-Regression huggingface dataset:
# coding: utf-8


def solve(*args: str) -> str:
    n, x, y = map(int, args[0].split())

    ret = [0]*n
    for i in range(1, n):
        for j in range(i+1, n+1):
            ret[min(j-i, 1+abs(x-i)+abs(y-j))] += 1
    return '\n'.join(map(str, ret[1:]))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


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

int main() {
    int n; cin >> n;
    vector<int> p(n);
    for (auto &pi: p) cin >> pi, pi--;
    for (int i = 0; i < n; i++) {
        if (p[i] % 2 != i % 2) return !(cout << "No" << endl);
    }
    auto check = [&]() {
        vector<int> max_lf(n + 1, -1), min_rg(n, n);
        for (int i = 0; i < n; i++) max_lf[i + 1] = max(max_lf[i], p[i]);
        for (int i = n - 1; i; i--) min_rg[i - 1] = min(min_rg[i], p[i]);
        vector<bool> b(n);
        for (int i = 0; i < n; i++) b[i] = p[i] == i;
        for (int i = 0; i + 1 < n; i++) {
            if (b[i] == b[i + 1]) {
                if (max_lf[i + 1] != i) return false;
            }
        }
        for (int i = 0; i + 1 < n; i++) {
            if (p[i] > i && max_lf[i] > p[i]) return false;
            if (p[i] < i && min_rg[i] < p[i]) return false;
        }
        return true;
    };
    cout << (check() ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3840
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define MO(a) AS_MOD(a,mod)
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define PrintArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;
#define PrintPairs(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i].fi <<"," << cont[__i].se<<")";} cout<<endl;
#define Print(v) cout<<v<<endl;
#define PDBG() cout<<"Line:"<<__LINE__<<endl;
#define PrintArray2D(cont, fh, th, fw, tw) for(int __i=fh;__i<th;++__i){for(int __j=fw;__j<tw;++__j) {cout<<cont[__i][__j]<<" ";} cout<<endl;}cout<<endl;
#define Resize2D(cont,H,W,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W,V);
#define Resize3D(cont,H,W,D,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W);for(int i=0;i<H;++i)for(int j=0;j<W;++j)cont[i][j].resize(D,V);
/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 * priority_queue<int,vector<int>, greater<int>> Q;
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
/*
struct PairComp{
    int operator()(P l, P r) const {
        return l.fi==r.fi?l.se<r.se:l.fi<r.fi;
    }
};*/
struct Vec;
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
int main() {
    cout.precision(15);
    cout << fixed;
    ll N;
    vector<ll> As;
    ll Q;
    vector<P> BCs;
    vector<ll> tb(1000*100+1,0);
    cin >> N;
    As.resize(N);
    REP(i,N)
        cin>>As[i];
    cin>>Q;
    BCs.resize(Q);
    REP(i,Q)
        cin>>BCs[i].fi>>BCs[i].se;


    ll s=0;
    REP(i,N) {
        tb[As[i]]++;
        s+=As[i];
    }

    REP(i,Q) {
        s+=tb[BCs[i].fi] * (BCs[i].se-BCs[i].fi);
        tb[BCs[i].se]+=tb[BCs[i].fi];
        tb[BCs[i].fi]=0;
        cout<<s<<endl;
    }
}


Measured memory_bytes: 6408
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
signed main(){
  int x[105];
  for(int i=0;i<2;i++){
  cin>>x[i];
  if(x[i]==1 || x[i]==3 || x[i]==5 || x[i]==7 || x[i]==8 || x[i]==10 || x[i]==12){
    x[i]=1;
  }
  else if(x[i]==4 || x[i]==6 || x[i]==9 || x[i]==11 ){
    x[i]=2;
  }
  else{
    x[i]=3;
  }
  }
  if(x[0]==x[1]){
    cout<<"Yes"<<"\n";
  }
  else{
    cout<<"No"<<"\n";
  }

  return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  double d;
  cin>>d;
  double ans = 2*d*3.1415926535;
  printf("%.10f\n",ans);
  return 0;
}


Measured memory_bytes: 3784
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint solve(lint n, lint extend_time, vector<lint> &t){
    lint ret = 0;
    lint stop_time = -1;
    for (int i=0; i<n; ++i){
        if(t[i] < stop_time){
            ret += extend_time - (stop_time - t[i]);
        }
        else {
            ret += extend_time;
        }
        stop_time = t[i] + extend_time;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint n, extend_time;
    cin >> n >> extend_time;
    vector<lint> t(n);
    for (int i=0; i<n; ++i){
        cin >> t[i];
    }
    cout << solve(n, extend_time, t) << "\n";
    return 0;
}

Measured memory_bytes: 1792
N, x = map(int, input().split())
a = list(map(int, input().split()))

a = sorted(a)

M = []
cn = 0

for i in range(N):
    x = x - a[i]


    
    if x >= 0 and i != N-1: 
        cn = cn + 1
    elif x < 0:
        print(cn)
        break
    elif i == N-1:
        if x == 0:
            cn = cn + 1
            print(cn)
            break
        else:
            print(cn)
            break

Measured memory_bytes: 61820
N = int(input())
S = list(map(int, input().split()))

Q = int(input())
T = list(map(int, input().split()))

def binarySearch(A, key):
    left = 0
    right = len(A)
    while left < right:
        mid = int((left + right) /2)
#         print(left, right, mid)
        if (A[mid] == key):
            return True
        elif(key < A[mid]):
            right = mid
        else:
            left = mid + 1
    return False

match_C = 0
for t in T:
    if(binarySearch(S, t)):
        match_C += 1
print(match_C)


Measured memory_bytes: 16712
#include <stdio.h>
#include <stdint.h>
#include <iostream>
#include <fstream>
#include <cassert>
#include <climits>
using namespace std;

#define DEBUG (0)

#if DEBUG
#define DPRINTF(...) do { \
    printf("D(L%d) %s: ", __LINE__, __func__); \
    printf(__VA_ARGS__); \
  } while (false)
#else
#define DPRINTF(...)
#endif // DEBUG

const uint64_t kInvalid = 0;

uint64_t calFibonacci(int num, uint64_t *pArray)
{
  if (pArray[num-1] == kInvalid)
    pArray[num-1] = calFibonacci(num-1, pArray);

  if (pArray[num-2] == kInvalid)
    pArray[num-2] = calFibonacci(num-2, pArray);

  return pArray[num-1] + pArray[num-2];
}


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

  DPRINTF("numOfFibonacci %d\n", numOfFibonacci);

  if (numOfFibonacci <= 1)
  {
    cout << "1" << endl;
    return 0;
  }

  uint64_t fibonacci[numOfFibonacci + 1];

  // init
  for (int i = 0; i <= numOfFibonacci; i++)
  {
    fibonacci[i] = kInvalid;
  }

  fibonacci[0] = 1;
  fibonacci[1] = 1;

  uint64_t ans = calFibonacci(numOfFibonacci, fibonacci);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3112
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    std::string S;
    std::cin >> S;

    auto l = S.size();

    auto opCounts = l - 1;

    int64_t sum = 0;
    for (size_t i = 0; i < (1 << opCounts); ++i) {
        int64_t reg = S[0] - '0';
        for (size_t j = 1; j < l; ++j) {
            if (i & 1 << (j-1)) {
                // '+'
                sum += reg;
                reg = S[j] - '0';
            }
            else {
                reg *= 10;
                reg += S[j] - '0';
            }
        }
        sum += reg;
    }

    std::cout << sum << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
int main()
{
	int n = 0,k = 0,x = 0,y = 0;
        scanf ("%d",&n);
	scanf ("%d",&k);
	scanf ("%d",&x);
	scanf ("%d",&y);
	if (n <= k){printf ("%d",n*x);}
	else {printf ("%d",(k*x)+(n-k)*y);}
    	return 0;
	}   

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

signed main() {
	string s;
	cin >> s;
	int ans1=0, ans2=0;
	for (int i = 0; i < s.size(); i++) {
		char c;
		if (i % 2 == 0) c = '0';
		else c = '1';
		if (c != s[i]) {
			ans1++;
		}
	}
	for (int i = 0; i < s.size(); i++) {
		char c;
		if (i % 2 == 0) c = '1';
		else c = '0';
		if (c != s[i]) {
			ans2++;
		}
	}
	cout << min(ans1, ans2) << endl;

	END;
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
 
class Main{
 
    public static void main(String[] args) throws IOException{
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] r = new int[n];
 
        for(int i = 0; i < n; i++){
            r[i] = Integer.parseInt(br.readLine());
        }
 
        int min = r[0];
        int max = Integer.MIN_VALUE;
 
        for(int i = 1; i < n; i++){
            max = Math.max(max, r[i] - min);
            min = Math.min(min, r[i]);
        }
 
        System.out.println(max);
 
    }
 
}


Measured memory_bytes: 42756
program fusing_slimes
  implicit none
  integer(8), parameter :: md = 1000000007
  integer :: n, i, j
  integer(8) :: x(100000) = 0, p = 0, d = 0, k = 1
  read(*,*) n
  read(*,*) x(1:n)
  do i = 1, n-1
    p = mod(p+inv(int(i,8)),md)
    d = mod(d+mod((x(i+1)-x(i))*p,md),md)
    k = mod(k*i,md)
  end do
  write(*,'(i0)') mod(d*k,md)
contains
  function inv(n) result(y)
    integer(8), intent(in) :: n
    integer(8) :: a, b, x, y, t, q
    a = modulo(n,md)
    b = md
    x = 0_8
    y = 1_8
    do while (b /= 0_8)
      q = a/b
      t = b
      b = mod(a,b)
      a = t
      t = y
      y = x
      x = t-q*x
    end do
    y = modulo(y,md)
  end
end program fusing_slimes

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define vl vector<ll>
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define sz size()
#define en end()
#define ro return 0
#define br break
#define con continue
#define um unordered_map<ll,ll>
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define forr(i,a,b) for(ll i=a;i<b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace2(a,b) cerr <<"a is " << a << " b is " << b << el;
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;
int main()
{
    ll n ;
    cin >> n ;
    ll maxx = -1 ;
    ll ans  = 0 ;
    forn( i ,1 , n ) {
      ll x;
      cin >> x ;
      if(x >= maxx) ++ans;
      maxx = max(maxx , x) ;
    }
    cout << ans << el ;
    ro ;
}

































Measured memory_bytes: 256
//
//  main.cpp
//  procon
//
//  Created by 坂井創一 on 2019/09/27.
//  Copyright © 2019 坂井創一. All rights reserved.
//
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,k,n) for(int i=k;i<(int)(n);i++)
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int n,k,q;
    int a[100100] = {};
    cin >> n >> k >> q;
    rep(i,q){
        int t;
        cin >> t;
        a[t] += 1;
    }
    REP(i,1,n+1) a[i] += k-q;
    REP(i,1,n+1){
        if(a[i] > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>
#include <math.h>

#define nl '\n'

using namespace std;

int a, b;

int main(){

    cin >> a >> b;

    if((a != 1) && (b != 1)){
        cout << "1";
    } else if((a != 2) && (b != 2)){
        cout << "2";
    } else if((a != 3) && (b != 3)){
        cout << "3";
    }





}

//g++ -std=c++14 comp.cpp -o b; ./b.exe

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

int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    if (i * (i + 1) / 2 >= N) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <functional>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

namespace _{struct _{_(){ // initialize
  cin.tie(0); ios::sync_with_stdio(false);
}}_;}
template <typename T, size_t size>
inline size_t len(const T (&)[size]) { return size; }
#define println(s) cout << s << '\n';
#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()

#define MAX_A 17
#define MAX_B 17

int a, b; // 1 <= a, b <= 16
int n;    // 1 <= n <= 40
bool ok[MAX_A+1][MAX_B+1];
int memo[MAX_A+1][MAX_B+1];
// evaluate score with starting point (x, y)
int eval(int x, int y) {
  //static int count = 0;
  //count++;//DEBUG
  //cout << "count: " << count << endl;
  // cout << "("<<x<<", " << y << ")"<<endl;
  // goal
  if (x == (a-1) && y == (b-1)) return 1;
  if (x >= a || y >= b) return 0;
  if (memo[y][x] != -1) return memo[y][x];

  bool up    = ok[y+1][x];
  bool right = ok[y][x+1];
  if (up && right) return memo[y][x] = eval(x+1, y) + eval(x, y+1);
  if (!up && !right) return memo[y][x] = 0; // stop
  if (up)    return memo[y][x] = eval(x, y+1);
  if (right) return memo[y][x] = eval(x+1, y);

  return INT_MIN;
}
int main() {
  while (true) {
    // input
    cin >> a >> b;
    if (a == 0 && b == 0) break;
    cin >> n;
    rep(y, b) {
      rep(x, a) {
        ok[y][x] = true;
        memo[y][x] = -1;
      }
    }
    rep(i, n) {
      int x, y;
      cin >> x >> y;
      ok[y-1][x-1] = false;
    }
    //cout << "n: " << n << endl;
    //cout << "a: " << a << endl;
    //cout << "b: " << b << endl;
    /*
    for (int y=b-1; y>=0; y--) {
      rep(x, a) {
        cout << (ok[y][x]?"o":"x");
      }
      cout << endl;
    }
    */
    //
    cout << eval(0, 0) << endl;
  }
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>  // ver2.1.6
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int, vector<int>, greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a.back()<<endl
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

vector<pair<int,int>> fac(int n) {  //  素因数分解
vector<Pii>r;for(int i=2;i*i<=n;++i){if(n%i)continue;r.emplace_back(i,0);while(n%i==0){
n/=i;r.back().second++;}}if(n!=1)r.emplace_back(n,1);return r;}

signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int h,w;
  cin >> h >> w;
  vector<string> mapp(h);
  rep(i,0,h){
    cin >> mapp[i];
  }
  queue<Pii> now,next;
  
  rep(i,0,h){
    rep(j,0,w){
      if(mapp[i][j]=='#') next.push(mp(i,j));
    }
  }
  
  int ans = 0;
  
  while(!next.empty()){
    
    now = next;
    queue<Pii> empty;
    swap(next,empty);
    
    while (!now.empty()) {
      
      if(now.front().first+1<h){
        if(mapp[now.front().first+1][now.front().second]=='.'){
        next.push(mp(now.front().first+1,now.front().second));
        mapp[now.front().first+1][now.front().second]='#';
      }}
      if(now.front().first-1>=0){
        if(mapp[now.front().first-1][now.front().second]=='.'){
        next.push(mp(now.front().first-1,now.front().second));
        mapp[now.front().first-1][now.front().second]='#';
      }}
      if(now.front().second+1<w){
        if(mapp[now.front().first][now.front().second+1]=='.'){
        next.push(mp(now.front().first,now.front().second+1));
        mapp[now.front().first][now.front().second+1]='#';
      }}
      if(now.front().second-1>=0){
        if(mapp[now.front().first][now.front().second-1]=='.'){
        next.push(mp(now.front().first,now.front().second-1));
        mapp[now.front().first][now.front().second-1]='#';
      }}
      now.pop();
    }
    ans++;
  }
  //Vout(mapp);
  cout << ans-1 << endl;
  return 0;
}

Measured memory_bytes: 34100
#include<bits/stdc++.h>
using namespace std;
const int N=55;
typedef long long LL;
struct edge{
	int to,next,len,cost;
}e[N*4]; 
int n,m,tot,c[N],d[N],s,mx,bk[N],first[N],mxi;
LL dp[N][N*N*2];
void add(int u,int v,int a,int b){
	e[++tot].next=first[u],first[u]=tot;
	e[tot].len=b,e[tot].to=v;e[tot].cost=a;
}

void spfa(){
	queue<int>q;
	q.push(1);bk[1]=1;
	while(!q.empty()){
		int now=q.front();q.pop();
		for(int i=0;i<=mx;i++)
			for(int j=1;j*c[now]<=i;j++){
				dp[now][i]=min(dp[now][i],dp[now][i-j*c[now]]+1ll*j*d[now]);
				//cout<<now<<" "<<dp[now][i]<<endl;
			}
		for(int i=first[now];i;i=e[i].next){
			int u=e[i].to;
			for(int j=0;j<=mx;j++){
				if(e[i].cost<=j){
					if(dp[u][j-e[i].cost]>dp[now][j]+e[i].len){
						dp[u][j-e[i].cost]=dp[now][j]+e[i].len;
						if(!bk[u])bk[u]=1,q.push(u);
					}
				}
			}
		}
		bk[now]=0;
	}
}

int main(){
	scanf("%d%d%d",&n,&m,&s);
	for(int i=1,u,v,a,b;i<=m;i++){
		scanf("%d%d%d%d",&u,&v,&a,&b);
		add(u,v,a,b);add(v,u,a,b);
		if(a>mxi)mxi=a;
	}
	for(int i=1;i<=n;i++){
		scanf("%d%d",&c[i],&d[i]);
		
	}
	if(s>1000000)mx=mxi*n*2;
	else{
		mx=n*n*2+1;
	}
	if(s>mx)s=mx;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=mx;j++)
			dp[i][j]=1e17;
	for(int i=0;i<=s;i++)
		dp[1][i]=0;
	spfa();
	for(int i=2;i<=n;i++){
		LL tmp=1e17;
		for(int j=0;j<=mx;j++)
			if(dp[i][j]<tmp)tmp=dp[i][j];
		printf("%lld\n",tmp);
	}
}

Measured memory_bytes: 5860
h = input()

def myfunc(hp: 'int') -> 'int':
    if(hp == 1):
        return 1
    elif(hp > 1):
        return int(myfunc(hp/2)) * 2 + 1
    return hp


if __name__ == '__main__':
    ans = myfunc(int(h))
    print(ans)

Measured memory_bytes: 3060
fline = input()
it, max_time = [int(n) for n in fline.split()]


cost_time = []
for i in range(it):
    line = input()
    c, t = [int(n) for n in line.split()]
    pair = (c, t)
    cost_time.append(pair)

cost_time.sort(key=lambda x: x[1])
cost_time2 = []
for i in range(it):
    tupl = cost_time[i]
    if(tupl[1]<=max_time):
        cost_time2.append(cost_time[i])

cost_time2.sort(key=lambda x: x[0])
if(len(cost_time2)==0):
    print('TLE')
else:
    el = cost_time2[0]
    print(el[0])

Measured memory_bytes: 3064
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 large_n: isize = iterator.next().unwrap().parse().unwrap();

    for h in 1..=3500 {
        for n in 1..=3500 {
            let denominator = 4 * h * n - large_n * n - large_n * h;
            if denominator <= 0 {
                continue;
            }
            let numerator = large_n * n * h;
            if numerator % denominator != 0 {
                continue;
            }
            let w = numerator / denominator;
            return format!("{} {} {}", h, n, w);
        }
    }

    return String::new();
}


Measured memory_bytes: 2168
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int kq,k,result[330][330][330];
string s;
int main()
{
		cin >> s;
		int cd = s.size();
		cin >> k;
		s = '0' + s;
		for (int e = 1 ; e <= cd ; e++)
		{
				for (int i = 1 ; i <= cd ; i++)
				{
						if (i + e - 1 > cd) 
						{
								break;
						}
						for (int f = 0 ; f <= min(k,e) ; f++)
						{
								int cur = i;
								int nxt = i + e - 1;
								if (f == e)
								{
										result[i][e][f] = e;
								}
								else
								{
										if (e == 2)
										{
												if (s[i] == s[i+1])
												{
														result[i][e][0] = 2;
												}
												else
												{
														result[i][e][0] = 1;
												}
												result[i][e][1] = 2;
												result[i][e][2] = 2;
										}
										else
										{
												if (e - 1 > 0)
												{
														result[i][e][f] = max(result[i][e][f] , result[i][e-1][f]);
												}
												if (i + 1 <= cd)
												{
														result[i][e][f] = max(result[i][e][f] , result[i+1][e-1][f]);
												}
												if (f != 0 && e - 2 > 0 && i + 1 <= cd)
												{
														result[i][e][f] = max(result[i][e][f] , result[i+1][e-2][f-1] + 2);
												}
												if (e - 2 >= 1)
												{
														result[i][e][f] = max(result[i][e][f] , result[i+1][e-2][f]);
												}
												if (s[cur] == s[nxt] && e - 2 > 0 && i + 1 <= cd)
												{
														result[i][e][f] = max(result[i][e][f] , result[i+1][e-2][f] + 2);
												}
										}
								}
								if (e == 1)
								{
										result[i][e][f] = 1;
								}
								kq = max(kq , result[i][e][f]);
						}
				}
		}
		cout << kq;
}


Measured memory_bytes: 128768
#![allow(non_snake_case,unused_imports)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

struct UnionFind{
    /// 最小構成UnionFind木
    P: Vec<usize>,
}

impl UnionFind {
    fn new(n:usize) -> UnionFind{
        UnionFind {P:(0..n).collect()}
    }
    fn get_parent(&mut self,n:usize) -> usize{
        if self.P[n] == n{ return n;}
        let p = self.P[n];
        self.P[n] = self.get_parent(p);
        self.P[n]
    }
    fn is_unite(&mut self,x:usize,y:usize) -> bool{
        self.get_parent(x)==self.get_parent(y)
    }
    fn merge(&mut self,x:usize,y:usize){
        if self.is_unite(x,y) {return;}
        let i = self.get_parent(x);
        let j = self.get_parent(y);
        self.P[j] = i;
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let N:usize = iter.next().unwrap().parse().unwrap();
    let K:usize = iter.next().unwrap().parse().unwrap();
    let L:usize = iter.next().unwrap().parse().unwrap();
    let mut T1 = UnionFind::new(N);
    for _ in 0..K{
        let p:usize = iter.next().unwrap().parse::<usize>().unwrap() -1;
        let q:usize = iter.next().unwrap().parse::<usize>().unwrap() -1;
        T1.merge(p,q);
    }
    let mut T2 = UnionFind::new(N);
    for _ in 0..L{
        let p:usize = iter.next().unwrap().parse::<usize>().unwrap() -1;
        let q:usize = iter.next().unwrap().parse::<usize>().unwrap() -1;
        T2.merge(p,q);
    }
    let mut cnt = HashMap::new();
    for i in 0..N{
        let p = T1.get_parent(i);
        let q = T2.get_parent(i);
        let k = (p,q);
        let c = *(cnt.get(&k).unwrap_or(&0));
        cnt.insert(k, c+1);
    }
    for i in 0..N{
        let ans = cnt.get(&(T1.get_parent(i),T2.get_parent(i))).unwrap();
        println!("{}",ans);
    }

}

Measured memory_bytes: 26660
from scipy.sparse.csgraph import shortest_path
import numpy as np
H,W = [int(i) for i in input().split()]
c = [0] * 10
for i in range(10):
    c[i] = [int(j) for j in input().split()]
c = np.array(c)
path = shortest_path(c,'D')
A = [0] * H
for i in range(H):
    A[i] = [int(j) for j in input().split()]
ans = 0
for i in range(H):
    for j in range(W):
        if A[i][j] == 1 or A[i][j] == -1:
            continue
        ans += path[A[i][j]][1]
print(int(ans))

Measured memory_bytes: 26708
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = []
for a in A:
  for b in B:
    AB.append(a + b)

AB.sort(reverse=True)
AB = AB[:min(3001, X * Y * Z + 1)]
ABC = []
for c in C:
  for ab in AB:
    ABC.append(ab + c)
ABC.sort(reverse=True)
for i in range(K):
  print(ABC[i])


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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long

const int N = 1e2 + 10;
const int mod = 1e9 + 7;


map<int, int> mp;

void fac(int n){
	while(n%2 == 0){
		n /= 2;
		mp[2]++;
	}
	int sq = sqrt(n);
	for(int i = 3 ; i <= sq ; i+=2){
		while(n%i == 0){
			n /= i;
			mp[i]++;
		}
	}

	if(n != 1){
		mp[n]++;
	}

}
int32_t main(){
	boost;
	int n;
	cin >> n;
	

	for(int i = 1; i <= n ; ++i){
		fac(i);
	}

	int ans = 1;
	for(auto i : mp){
		ans *= (i.second+1);
		ans %= mod;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: usize = s.next().unwrap().parse().unwrap();
	let m: usize = s.next().unwrap().parse().unwrap();
	let p: Vec<usize> = s
		.by_ref()
		.take(n)
		.map(|a| a.parse::<usize>().unwrap() - 1)
		.collect();
	let mut uf = UnionFind::new(n);
	for _ in 0..m {
		let x: usize = s.next().unwrap().parse().unwrap();
		let y: usize = s.next().unwrap().parse().unwrap();
		uf.unite(x - 1, y - 1);
	}
	let ans = (0..n).fold(0, |r, i| {
		r + if uf.find(i) == uf.find(p[i]) { 1 } else { 0 }
	});
	println!("{}", ans);
}

pub struct UnionFind {
	data: Vec<i32>,
}

impl UnionFind {
	pub fn new(n: usize) -> UnionFind {
		UnionFind { data: vec![-1; n] }
	}

	pub fn unite(&mut self, x: usize, y: usize) -> bool {
		let x = self.find(x);
		let y = self.find(y);
		if x == y {
			false
		} else {
			let (x, y) = if self.data[x] > self.data[y] {
				(y, x)
			} else {
				(x, y)
			};
			self.data[x] += self.data[y];
			self.data[y] = x as i32;
			true
		}
	}

	pub fn find(&mut self, i: usize) -> usize {
		if self.data[i] < 0 {
			i
		} else {
			let p = self.data[i] as usize;
			self.data[i] = self.find(p) as i32;
			self.data[i] as usize
		}
	}

	pub fn size(&mut self, i: usize) -> usize {
		let i = self.find(i);
		(-self.data[i]) as usize
	}
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define FORR(I,A,B) for(int I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
int gcd(int a,int b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
int lcm(int a,int b){int c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl

struct Inversions{// tentosu
	// after init,u can get number of inversions num_inversion(A)
	vector<ll> L,R;
	void initsize(ll n){//input size of A
		L.resize(n/2+2);
		R.resize(n/2+2);
	}
	ll merge(vector<ll> &A,ll n,ll left,ll mid,ll right){
		ll i,j,k;
		ll cnt = 0;
		ll n1 = mid - left;
		ll n2 = right - mid;
		for(i=0;i<n1;i++)L[i]=A[left+i];
		for(i=0;i<n2;i++)R[i]=A[mid+i];
		L[n1]=R[n2]=INT_MAX;//
		i=j=0;
		for(k=left;k<right;k++){
			if(L[i]<=R[j]){
				A[k]=L[i++];
			}else{
				A[k]=R[j++];
				cnt += n1-i;
			}
		}
		return cnt;
	}
	ll mergeSort(vector<ll> &A,ll n,ll left,ll right){
		ll mid;
		ll v1,v2,v3;
		if(left+1<right){
			mid = (left+right)/2;
			v1 = mergeSort(A,n,left,mid);
			v2 = mergeSort(A,n,mid,right);
			v3 = merge(A,n,left,mid,right);
			return v1+v2+v3;
		}else return 0;
	}
	ll num_inversion(vector<ll> A){
		initsize(A.size());
		return mergeSort(A,A.size(),0,A.size());
	}
};


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	Inversions In;
	string s;
	vector<ll> a;
	cin >> s;
	FOR(i,0,s.size()){
		if(s[i]=='B')a.push_back(1);
		else a.push_back(0);
	}
	cout << In.num_inversion(a) << endl;
}

Measured memory_bytes: 5128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    ll a,b,x; cin >> a >> b >> x;
    ll ans;
    if(a==0){
        ans = (b / x) + 1;
    } else {
        ans = (b / x) - ((a - 1) / x);
    }
    cout << ans << endl;
    return 0;
}

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    int n; cin >> n;
    string s; cin >> s;

    int ans = 0;

    for (int i = 0; i < 1000; ++i) {
        int c[3] = {(i / 100), (i / 10 - (i / 100) * 10), (i - (i / 10) * 10)};

        int c0 = INF;
        int c1 = INF;

        for (int j = 0; j < n; ++j) {
            if (c0 == INF && s[j] - '0' == c[0]) {
                c0 = j;
                continue;
            }

            if (c0 != INF && c1 == INF && s[j] - '0' == c[1]) {
                c1 = j;
                continue;
            }

            if (c1 != INF && s[j] - '0' == c[2]) {
                ++ans;
                break;
            }
        }
    }

    cout << ans << endl;
}

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

int main(){
    ll  n;  cin >> n;
    vector<ll> top(n+1), bottom(n+1);
    ll x;
    for(int i=1; i<=n; i++){
        cin >> x;
        top.at(i) = top.at(i-1)+x; 
    }
    for(int i=1; i<=n; i++){
        cin >> x;
        bottom.at(i) = bottom.at(i-1)+x;
    }

    ll ans=0;
    for(int i=1; i<=n; i++){
        ll tc = top.at(i);
        ll bc = bottom.at(n)-bottom.at(i-1);
        ans = max(ans, tc+bc);
    }
    cout << ans << endl;

  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)


int main(){
    ll a,n,m;
    cin >> a >> n >> m;
    int co = 0;
    ll list[10000];
    int c = 0;
    for(int i = 1; i < 10000000; i++){
        int l = i;
        int k = i;
        for(int j = 0; j < n - 1; j++){
            l *= k;
        }
        if(l > m)break;
 
        list[i - 1] = l;
        c++;
    }
    for(int i = 0; i < c; i++){
        string s = to_string(list[i]);
        ll sum = 0;
        for(int j = 0; j < s.size(); j++)sum += s[j] - '0';
        ll ans = sum + a;
        ll anss = ans;
        for(int j = 0; j < n - 1; j++) ans *= anss;
        if(ans == list[i])co++;
    }
    cout << co << endl;
    return 0;
} 


Measured memory_bytes: 3276
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int a[N];
  REP(i,N)cin>>a[i];
  int ans=0;
  int i=1;
  for(auto e:a){
    if(e==i){
      i++;
    }else{
      ans++;
    }
  }
  cout<<(ans!=N?ans:-1)<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define EPS (1e-10)
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>x(n), y(n), h(n); rep(i, n)cin >> x[i] >> y[i] >> h[i];
	rep(i, 101) {
		rep(j, 101) {
			int cnt = 0;
			rep(k, n) {
				if (h[k]) {
					cnt = h[k] + abs(i - x[k]) + abs(j - y[k]); break;
				}
			}
			rep(k, n) {
				if (h[k] != max((ll)0, cnt - abs(i - x[k]) - abs(j - y[k]))) {
					goto a;
				}
			}
			cout << i << " " << j << " " << cnt << endl;
		a:;
		}	
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n=sc.nextInt();
      long t=1;
      for(int i=0;i<n;i++)t=getLCM(t,sc.nextLong());
      System.out.print(t);
    }
	
	public static long getLCM(long x, long y) {
    return x / getGCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
	}
	public static long getGCD(long x, long y) {
        long biggerNum = Math.max(x, y);
        long smallerNum = Math.min(x, y);
        long surplus = biggerNum % smallerNum;
        if (surplus == 0) {
            return smallerNum;
        }
        surplus = getGCD(smallerNum, surplus);

        return surplus;
    }
}

Measured memory_bytes: 35816
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7



int main() {

	int N;
	scanf("%d", &N);

	printf("%d", N*N*N);



}






Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <string.h>
#include <bitset>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef ONLINE_JUDGE
const int N = 1e6+10;
#else
const int N = 111;
#endif


int n, m;
char s[N], t[N];

int chk(int l, int r) {
	REP(i,l,r) {
		if (s[i]!='?'&&s[i]!=t[i-l+1]) return 0;
	}
	return 1;
}

int main() {
	scanf("%s%s", s+1, t+1);
	n = strlen(s+1);
	m = strlen(t+1);
	if (m>n) return puts("UNRESTORABLE"),0;
	set<string> a;
	REP(i,1,n-m+1) if (chk(i,i+m-1)) { 
		string p(s+1,s+1+n);
		REP(j,i,i+m-1) p[j-1]=t[j-i+1];
		REP(j,0,n-1) if (p[j]=='?') p[j]='a';
		a.insert(p);
	}
	if (a.empty()) return puts("UNRESTORABLE"),0;
	cout<<*a.begin()<<endl;
}









Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int a, b, k;
	cin >> a >> b >> k;
	if (a + k > b - k) {
		rep(i, a, b) {
			cout << i << endl;
		}
	}
	else {
		for (int i = a; i < a + k; i++) cout << i << endl;
		for (int i = b - k + 1; i <= b; ++i) cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int n;cin>>n;
    vector<int> v[n+1];
    int a[n-1],b[n-1];
    rep(i,0,n-1){
        cin>>a[i]>>b[i];
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    int ma=0;
    rep(i,1,n+1){
        ma=max(ma,(int)v[i].size());
    }
    cout<<ma<<endl;
    queue<pii> q;
    map<pii,int> mp;
    q.push({1,0});
    bool used[n+1];
    fill(used,used+n+1,false);
    used[1]=true;
    while(q.size()>0){
        pii p=q.front();q.pop();
        int now=p.first;
        int col=p.second;
        int y=1;
        if(col==1)y=2;
        rep(i,0,v[now].size()){
            int ne=v[now][i];
            if(used[ne])continue;
            used[ne]=true;
            mp[{now,ne}]=y;
            q.push({ne,y});
            y++;
            if(y==col)y++;
            
        }
    }
    rep(i,0,n-1){
        int f=mp[{a[i],b[i]}],g=mp[{b[i],a[i]}];
        f=max(f,g);
        cout<<f<<endl;
    }
}


Measured memory_bytes: 19456
#include <iostream>
#include <stack>
#include <map>
using namespace std;

int main()
{
	int N;cin>>N;
	stack<pair<int,int>> AB;
	for(int i=0;i<N;++i)
	{
		int a;cin>>a;
		int b;cin>>b;
		AB.push(make_pair(a,b));
	}

	long long ans=0;
	for(int i=0;i<N;++i)
	{
		pair<int,int> x=AB.top();
		AB.pop();
		long long hoge=(x.first+ans)%x.second;
		if(hoge!=0)ans+=x.second-hoge;
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {

 vector<int> vec(3);
 cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
 sort(vec.begin(),vec.end());
 cout << vec.at(0) << " " << vec.at(1) << " "<< vec.at(2) << endl;
}

 
 



Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;
 
int N, K;
int a[5010];
 
bool dp[5010][5010]; //dp[i][j] := i番目までを考えて,合計がjの時があるなら1
bool solve(int idx){
	rep(i, 5010)rep(j, 5010) dp[i][j] = 0;
	dp[0][0] = 1;
	rep(i, N)rep(j, K + 1){
		if(dp[i][j] == 0) continue;
		dp[i + 1][j] = 1;
		if(i == idx) continue;
		if(j + a[i] > K) continue;
		dp[i + 1][j + a[i]] = 1;
	}
	reps(i, max(0, K - a[idx]), K){
		if(dp[N][i]) return true;
	}
	return false;
}
 
int main(void){
	cin >> N >> K;
	rep(i, N) cin >> a[i];
	sort(a, a + N);
	int l = -1, r = N;
	while(r - l > 1){
		int m = (l + r) / 2;
		// printf("m %d\n",m );
		if(!solve(m)) l = m;
		else r = m;
	}
	printf("%d\n", l + 1);
	return 0;
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (true){
        c -= b;
        if (c > 0){
            a -= d;
            if (a > 0){
                continue;
            }
            else {
                cout << "No" << endl;
                break;
            }
        }
        else{
            cout << "Yes" << endl;
            break;
        }
    }

}

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

int ball[1001][10];
//int end[2][10];

bool dfs(int i, int j, int left_max, int right_max) {
	if (j == 10) return true;
	
	if (left_max < ball[i][j]) return dfs(i, j + 1, ball[i][j], right_max);
	else if (right_max < ball[i][j]) return dfs(i, j + 1, left_max, ball[i][j]);
	
	return false;
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i ++) {
		for (int j = 0; j < 10; j ++) {
			cin >> ball[i][j];
		}
		dfs(i, 0, 0, 0) ? cout << "YES" <<  endl : cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2988