akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
    int N, x, y, b, p, i, wa1, wa2;
    scanf("%d", &N);
    for (i = 1; i <= N; i++) {
        scanf("%d %d %d %d", &x, &y, &b, &p);
        wa1 = x*b + y*p;
        if (b >= 5 && p >= 2) {
            wa1 = 4 * wa1 / 5;
        }
        else {
            if (b < 5) {
                b = 5;
            }
            if (p < 2) {
                p = 2;
            }
            wa2 = 4*(x*b + y*p)/5;
            if (wa1 > wa2) {
                wa1 = wa2;
            }
        }
        printf("%d\n", wa1);
    }
    return 0;
}

Measured memory_bytes: 600
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple

int a,b,c;
set<int> s;

signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

for(int i=1;i<4;i++){
       cin >> a;
       s.insert(a);
}
if(s.size()==1){
       cout << "Yes" << endl;
}
else {
       cout << "No" << endl;
}


return 0;
}
///....


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int N,h,count=0;
  cin >> N;
  int A[N];
  for(int i=1;i<=N;i++) cin >> A[i];
  for(int i=1;i<=N;i++){
      for(int j=N;j>=i+1;j--){
      if(A[j] < A[j-1]){
          swap(A[j],A[j-1]);
          count++;
        }
      }
    }
  for(int i=1;i<=N;i++){
      cout << A[i];
      if(i != N)cout << " ";
    }
  cout << endl << count << endl;
  return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, Y;
  cin >> N >> Y;
  //  Y /= 1000;

  Y -= N * 1000;
  for (int i = 0; i <= N; i++) {
    int num10 = i;
    int ret = (Y - 9000 * num10);
    if (ret % 4000 != 0) continue;
    int num5 = ret / 4000;
    if (num5 >= 0 && num5 + i <= N) {
      int num1 = N - num5 - i;
      cout << num10 << " " << num5 << " " << num1 << "\n";
      return 0;
    }
  }
  print("-1 -1 -1");
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAXOP 100
#define MAXVAL 100
void push(int);
int pop(void);
int main()
{
  char t[100];
  int op2,a;
  char s[MAXOP];

  while(scanf("%s",t)!=EOF) {
	  if(t[0]== '+'){
			push(pop() + pop());
	  }
	  else if(t[0]=='*'){
			push(pop() * pop());
	  }
	  else if(t[0]=='-'){
			op2 = pop();
			push(pop() - op2);
	  }
	  else{
	    push(atoi(t));
	  }
	}
  printf("%d\n",pop());
	return 0;
}


int s = 0;
double val[MAXVAL];

void push(int f)
{
	if (s < MAXVAL)
		val[s++] = f;
}

int pop(void)
{
	if (s > 0)
		return val[--s];
	else {
		return 0;
	}
}





Measured memory_bytes: 2128
object Main {

  trait Monoid[A]{
  	def op(a1: A, a2: A): A
  	def zero: A
  }

  class PersistentSegmentTree[A](val numOfNode: Int, val M: Monoid[A]){

  	sealed trait Tree{ val value: A }
  	case object Empty extends Tree{ val value: A = M.zero }
  	case class Node(value: A, left: Tree, right: Tree) extends Tree
  	object Node {
  		def apply(value: A) = new Node(value, Empty, Empty)
  		def apply(l: Tree, r: Tree) = new Node(M.op(l.value,r.value),l,r)
  	}

  	private val nil: Node = Node(M.zero,Empty,Empty)
  	private[this] var root: Tree = nil

  	private def updateRec(id: Int, x:A, l: Int = 0, r: Int = numOfNode, t: Tree = root): Tree = {
  		val m = (l + r)/2
  		def branch(now: Node): Node = {
  			if(r-l<=1)Node(x)
  			else if(id < m)Node(updateRec(id,x,l,m, now.left), now.right)
  			else Node(now.left,updateRec(id,x,m,r,now.right))
  		}
  		t match {
  			case now:Node => branch(now)
  			case now:Tree => branch(nil)
  			case _ => nil
  		}
  	}

  	def update(id: Int, x: A):Unit = {
  		root = updateRec(id, x)
  	}

  	def query(a: Int, b: Int, l: Int = 0, r: Int = numOfNode, t: Tree = root): A = {
  		val m = (l + r)/2
  		t match {
  			case now: Node => {
  				if(b<=l || r<=a)M.zero
  				else if(a<=l && r<=b)now.value
  				else M.op(query(a,b,l,m,now.left),query(a,b,m,r,now.right))
  			}
  			case _ => M.zero
  		}
  	}
  }

  def main(args: Array[String]): Unit = {
  	val line = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  	val n = line(0)
  	val q = line(1)
  	val m = new Monoid[Int]{
  		def op(a1: Int, a2: Int): Int = a1 min a2
  		def zero: Int = Int.MaxValue
  	}

  	val segtree = new PersistentSegmentTree[Int](n,m)

  	for(i <- 1 to q){
  		val input = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  		val x = input(1)
  		val y = input(2)
  		if(input(0)==0)segtree.update(x,y)
  		else println(segtree.query(x,y+1))
  	}
  }
}

Measured memory_bytes: 195344
#include<bits/stdc++.h>
using namespace std;
#define ll              long long
#define pb              push_back
#define read(s)         freopen(#s,"r",stdin)
#define write(s)        freopen(#s,"w",stdout)
#define lead_zero(x)    __builtin_clzll(x)
#define trail_zero(x)   __builtin_ctz(x)
#define total_1s(x)     __builtin_popcount(x)


int main()
{
    string s;
    cin>>s;
    s[3]='8';
    cout<<s<<endl;
}


Measured memory_bytes: 256
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 1e5 + 5;

int N, A[MAXN];

void input()
{
    read(N);
    for (int i = 1; i <= N; ++i) {
        read(A[i]);
    }
}

void solve()
{
    static int dp[MAXN][2];

    dp[1][0] = dp[1][1] = 1;
    for (int i = 2; i <= N; ++i) {
        dp[i][0] = dp[i][1] = std::min(dp[i - 1][0], dp[i - 1][1]) + 1;
        if (A[i] >= A[i - 1]) chkmin(dp[i][0], dp[i - 1][0]);
        if (A[i] <= A[i - 1]) chkmin(dp[i][1], dp[i - 1][1]);
    }
    int ans = std::min(dp[N][0], dp[N][1]);

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

int main()
{
#ifdef __DEBUG
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    input();
    solve();

    return 0;
}

// 弱冠弄柔翰，卓荦观群书。
//     -- 左思《咏史八首·其一》


Measured memory_bytes: 1408
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する


int main() {
    int N,K;
    cin >> N >> K;
    int X,Y;
    cin >> X >> Y;
    if(N <= K){
        cout << X * N << endl;
    }else{
        cout << X * K + Y * (N - K) << endl;
    }
    return 0;
}


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

typedef long long s64;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
const int N=1e5+5;
int a[N],b[N];

int main()
{
	//freopen("1.in","r",stdin);
	int n;cin>>n;
	rep(i,1,n)scanf("%d%d",a+i,b+i);
	s64 ans=0;
	per(i,n,1)ans+=(b[i]-(a[i]+ans)%b[i])%b[i];
	cout<<ans;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        String S = scan.next();
        System.out.println(solve(N, S));
    }
    public static int solve(int N, String S) {
        char[] data = S.toCharArray();
        int answer = 0;
        for (int i = 0; i < N; i++) {
            answer = Math.max(answer, sol(N, data, i));
        }
        return answer;
    }
    public static int sol(int N, char[] data, int position) {
        HashSet<Character> right = new HashSet<>();
        HashSet<Character> left = new HashSet<>();
        for (int i = 0; i < position; i++) {
            right.add(data[i]);
        }
        for (int i = position; i < N; i++) {
            left.add(data[i]);
        }
        right.retainAll(left);
        return right.size();

    }
}



Measured memory_bytes: 22356
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	int a, b;
	cin >> a >> b;
 	if(a <= 5)
 		cout << 0;
 	else
 	if(a <= 12)
 		cout << b/2;
 	else
 		cout << b;




	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 256
public class Main {

	public static void main(String[] args) {
		int S = new java.util.Scanner(System.in).nextInt(); 
		int h = S / 3600;
		int m = (S % 3600) / 60;
		int s = (S % 3600) % 60;
		System.out.println(h + ":" + m + ":" + s);
	}
}

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int x;
    for(int i=a;i<=b;i++){
        if(c%i == 0) x+=1;
    }
    cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 3080
s = input()
k = int(input())

n = len(s)

l = []

for i in range(n):
  for j in range(k):
    if i + j < n:
      l.append(s[i : i + j + 1])

l.sort()

index = 0
while k > 0:
  if k == 1:
    print(l[index])
    k = 0
  else:
    index += 1
    k -= 1
    while l[index - 1] == l[index]:
      index += 1


Measured memory_bytes: 4340
sx, sy, tx, ty = map(int, input().split())

x = tx - sx
y = ty - sy

ans = 'U'*y + 'R'*x + 'D'*y + 'L'*x
ans += 'L' + 'U'*(y+1) + 'R'*(x+1) + 'D'
ans += 'R' + 'D'*(y+1) + 'L'*(x+1) + 'U'

print(ans)

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

#define int           long long
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (long long )(1e17+1)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){
    cerr << name << " = " << arg1 << endl;
}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args){
    const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);
}
template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2> &q){ 
    in >> q.F >> q.S; return in;
}
template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> &q){
    out << q.F << " " << q.S; return out;
}
template< typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F+p2.F, p1.S+p2.S};
}
template< typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F-p2.F, p1.S-p2.S};
}

std::vector<vi> v;
int n, m;

void fun(int pos, int j, vi vv){
    if(pos == n-1){
        for(int i = j; i <= m; i++){
            vv.pb(i);
            v.pb(vv);
            vv.pop_back();
        } return;
    }
    for(int i = j; i <= m; i++){
        vv.pb(i);
        fun(pos+1, i, vv);
        vv.pop_back();
    }
}

void solve() {
    int q;
    cin >> n >> m >> q;
    int a[q], b[q], c[q], d[q];
    for(int i = 0; i < q; i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i]; 
        a[i]--, b[i]--;
    }
    vi vv;
    fun(0, 1, vv);
    int ans = 0;
    for(auto vv : v){
        int tmp = 0;
        for(int i = 0; i < q; i++){
            if(vv[b[i]]-vv[a[i]] == c[i]){
                tmp += d[i];
            }
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   

    int t = 1;
    start = clock(); 

    cout << fixed << setprecision(20);

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    // freopen("error.txt", "w", stderr);
    // #endif
   
    //cin >> t;

    for(int i = 1; i <= t; ++i){
        //cout << "Case #" << i << ": "; 
        solve();
        //cout << endl;
    }
    //cerr << time(start);
    return 0;
}

Measured memory_bytes: 13984
#import<bits/stdc++.h>
using namespace std;
using Int = long long;
template<class T> T gcd(T a,  T b) {return b ? gcd(b, a % b) : a;}
template<class U> U lcm( U m, U n ){if((0 == m )||( 0 == n ))return 0; return ((m / gcd(m, n)) * n); }
int main(){
    Int N, M;
    cin >> N >> M;
    vector<Int>a(N);
    for(auto& e : a) cin >> e;
    for(auto& e : a) e /= 2;
    Int cm = 1;
    for(auto e  : a){
        cm = lcm(cm,e);
        if(cm > M) return puts("0") * 0;
    }
    if(count_if(a.begin(), a.end(),[&](Int val){
        return cm  / val % 2 == 0;
    }) > 0){
        return puts("0") *  0;
    }
    Int preans = M / cm;
    if(preans % 2 == 0){
        cout << max(0LL,preans / 2 ) << endl;
    } else {
        cout << preans - (preans - 1) / 2 << endl;
    }
}




Measured memory_bytes: 1024
from collections import Counter
def choose2(n):
    return n*(n-1)/2
sum1=0
sum2=0
N = int(input())
A = [int(N) for N in input().split()]
S = Counter(A)
for i in  S.values():
    sum1+=int(choose2(i))
for j in range(N):
    sum2+=int(sum1-choose2(S[A[j]])+choose2(S[A[j]]-1))
    print(sum2)
    sum2=0

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

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

    int a, b;
    cin >> a >> b;
    if(1 <= a and a <= 9 and 1 <= b and b <= 9){
        cout << a * b << endl;
    }else{
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
const ll mod=1000000007;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  int h,w; cin>>h>>w;
  vector<string> c;
  rep(i,h){
    string s; cin>>s;
    c.pb(s);c.pb(s);
  }
  rep(i,c.size()){
    cout<<c[i]<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
N = int(input())
h = [0] * (2*N)
h[:N] = list(map(int, input().split()))
INF = 10**9
dp = [INF] * (2*N)
dp[0] = 0
for i in range(N):
    dp[i+1] = min(dp[i+1], dp[i]+abs(h[i] - h[i+1]))
    dp[i+2] = min(dp[i+2], dp[i]+abs(h[i] - h[i+2]))
print(dp[N-1])

Measured memory_bytes: 15512
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定 setprecision()
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror

#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = acos(-1); //円周率
ll mod = 1e9 + 7;


//提出コード



ll n, a[100010],Mny[100010],SUM,ans;

ll Z(ll N) {
	if (N < 0) return N * -1;
	else return N;
}


int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		if (i == 0) Mny[i] = Z(a[i]);
		else Mny[i] = Z(a[i - 1] - a[i]);
	}
	Mny[n] = Z(a[n - 1]);
	rep(i, n + 1) {
		SUM += Mny[i];
	}
	rep(i, n) {
		if(i == 0) ans = SUM - Mny[i] - Mny[i + 1] + Z(a[i + 1]);
		else if(i == n - 1) ans = SUM - Mny[i] - Mny[i + 1] + Z(a[i - 1]);
		else ans = SUM - Mny[i] - Mny[i + 1] + Z(a[i - 1] - a[i + 1]);
		cout << ans << endl;
	}
	




	return 0;
}



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

using namespace std;
using ll = long long;

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

    ll ans = 0ll;
    for(int i=0;i<N-1;i++){
        if(a[i] + a[i+1] > x){
            int tmp = a[i] + a[i+1] - x;
            ans += tmp;
            if(a[i+1] < tmp){
                a[i+1] = 0;
            }else{
                a[i+1] -= tmp;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
struct tp
{
    int swim, catch_bugs, do_homework;
};
tp f[100001], a[100001];
int n, res;
int main()
{
    //freopen("test.inp","r",stdin);
    //freopen("test.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i].swim>>a[i].catch_bugs>>a[i].do_homework;
    res=-1e9;
    f[1].swim=a[1].swim;
    f[1].catch_bugs=a[1].catch_bugs;
    f[1].do_homework=a[1].do_homework;
    if(n==1)
        res=max(res, max(f[1].catch_bugs,max(f[1].do_homework,f[1].swim)));
    else{
        for(int i=2;i<=n;i++)
        {
            f[i].swim=max(f[i-2].swim+a[i].swim, max(a[i].swim+f[i-1].catch_bugs, f[i-1].do_homework+a[i].swim));
            f[i].catch_bugs=max(f[i-2].catch_bugs+a[i].catch_bugs, max(f[i-1].swim+a[i].catch_bugs, f[i-1].do_homework+a[i].catch_bugs));
            f[i].do_homework=max(f[i-2].do_homework+a[i].do_homework, max(f[i-1].swim+a[i].do_homework, f[i-1].catch_bugs+a[i].do_homework));
            res=max(res, max(f[i].catch_bugs,max(f[i].do_homework,f[i].swim)));
        }
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

ll H, W, N;
vector<ll> a, b;
map<ll, set<ll>> mp;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> H >> W >> N;
  a.resize(N);
  b.resize(N);
  for (ll i = 0; i < N; i++) {
    ll ai, bi;
    cin >> ai >> bi;
    ai--;
    bi--;
    a[i] = ai;
    b[i] = bi;
    mp[ai].insert(bi);
  }

  set<pair<ll, ll>> used;
  vector<ll> ans(10, 0);
  for (ll i = 0; i < N; i++) {
    ll ai = a[i], bi = b[i];
    for (ll h = ai - 2; h <= ai; h++) {
      for (ll w = bi - 2; w <= bi; w++) {
        pair<ll, ll> p = make_pair(h, w);
        if (0 <= h && h < H - 2 && 0 <= w && w < W - 2 && used.find(p) == used.end()) {
          used.insert(p);
          ll cnt = 0;
          for (ll j = h; j < h + 3; j++) {
            for (ll k = w; k < w + 3; k++) {
              if (!mp[j].empty() && mp[j].find(k) != mp[j].end()) {
                cnt++;
              }
            }
          }
          ans[cnt]++;
        }
      }
    }
  }

  ll sum = 0;
  for (auto &e : ans) {
    sum += e;
  }
  ans[0] = (H - 2) * (W - 2) - sum;
  for (auto &e : ans) {
    cout << e << endl;
  }
  return 0;
}

Measured memory_bytes: 111616
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
signed main() {
  fast;
  long double a, b;
  cin >> a >> b;
  int x = a * b;
  cout << x << '\n';
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define int long long
#define gcd            __gcd
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x,y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;

int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int modi(int a, int m)
{
    return power(a, m - 2, m);
}
int32_t main()
{
    int n;
    cin>>n;
    vector<int>v(100001,0);
    int sum=0;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        v[a]++;
        sum+=a;
    }
    int q;
    cin>>q;
    while(q--)
    {
        int a,b;
        cin>>a>>b;
        int x=v[a];
        int y=v[b];
        v[a]=0;
        v[b]+=x;
        sum=sum-x*a+x*b;
        cout<<sum<<endl;
    }

}

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

int main()
{
  string s, t;
  cin >> s >> t;
  
  int n = s.size();
  for (int i = 0; i < n; i ++)
  {
    if (s.at(i) != t.at(i)) 
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define bit(n) (1LL << (n))
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<pair<lli, lli>> AB(N);
    REP(i, N)
    {
        cin >> AB[i].first >> AB[i].second;
    }
    sort(ALL(AB));
    lli ans = 0;
    int i = 0;
    while (true)
    {
        if (M <= AB[i].second)
        {
            ans += AB[i].first * M;
            break;
        }
        else
        {
            ans += AB[i].first * AB[i].second;
            M -= AB[i].second;
        }
        i++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1792
S = list(map(lambda x : ord(x)-ord('a'), input().strip()))
T = list(map(lambda x : ord(x)-ord('a'), input().strip()))

L = len(S)

occ = [[] for i in range(26)]
for i, c in enumerate(S):
    occ[c].append(i)

for c in T:
    if occ[c] == []:
        print(-1)
        quit()

total = 0
cur = -1

def getLowest(bound, lo, hi, lst):
    # Return lowest element in list greater than bound
    while lo < hi:
        mid = lo + (hi - lo) // 2
        if lst[mid] > bound:
            hi = mid
        else:
            lo = mid + 1
    if lst[lo] > bound:
        return lst[lo]
    return lst[0]
        
    

for i, char in enumerate(T):
    newpos = getLowest(cur, 0, len(occ[char])-1, occ[char])
    if cur == newpos:
        total += L
    elif newpos < cur:
        total += L - cur + newpos
    else:
        total += newpos - cur
    cur = newpos
print(total)
    


Measured memory_bytes: 49660
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    int n;
    std::cin >> n;
    int max=1;
    for (int i = 1; i < n; i++) {
        for (int j = 2; j < n; j++) {
            int t=pow(i,j);
            if(t>n)break;
            if(t>max)max=t;
        }
    }
    std::cout << max << std::endl;
}


Measured memory_bytes: 384
fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val usagi = readLine()!!.split(" ").map { it.toInt()-1 }
    var ans = 0
    for(i in (0 until n)) {
        val target = usagi[i]
        if(usagi[target] == i) {
            ans++
        }
    }
    println(ans/2)
}


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

int main()
{
	
	int n, m, c;
	cin >> n >> m >> c;

	int a[21][21];
	int b[21];

	for( int i = 0; i < m; ++i )
	{
		cin >> b[i];
	}

	for( int i = 0; i < n; ++i )
	{
		for( int j = 0; j < m; ++j )
		{
			cin >> a[i][j];
		}
	}

	int ans = 0;
	int cnt = 0;
	for( int i = 0; i < n; ++i )
	{
		ans = c;
		for( int j = 0; j < m; ++j )
		{
			ans += a[i][j] * b[j];
		}

		if( ans > 0 ) cnt++;

	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int p[N];
    for(int i = 0;i < N;i++) cin >> p[i];
    int dif = 0;
    
    for(int j = 0;j < N;j++){
        if(p[j] != j + 1) dif++;
    }
    
    if(dif <= 2){
        cout << "YES" << endl;
        return 0;
    }else{
        cout << "NO" << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N = 524288, P = 924844033;
int ri() {
	char c = getchar(); int x = 0, f = 1; for(;c < '0' || c > '9'; c = getchar()) if(c == '-') f = -1;
	for(;c >= '0' && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) - '0' + c; return x * f;
}
int w[N], R[N], a[N], b[N], sz[N], to[N << 1], nx[N << 1], pr[N], f[N], g[N], tp, L, InvL, n;
int fix(int x) {return (x >> 31 & P) + x;}
int add(int a, int b) {return a += b, a >= P ? a - P : a;}
int mul(int a, int b) {return 1LL * a * b % P;}
void ins(int u, int v) {to[++tp] = v; nx[tp] = pr[u]; pr[u] = tp;}
void adds(int u, int v) {ins(u, v); ins(v, u);}
int Pow(int x, int k) {
	int r = 1;
	for(;k; x = mul(x, x), k >>= 1)
		if(k & 1)
			r = mul(r, x);
	return r;
}
int Inv(int x) {return Pow(x, P - 2);}
void Pre(int m) {
	L = 1; int x = 0;
	for(;(L <<= 1) < m; ++x) ;
	for(int i = 1;i < L; ++i)
		R[i] = R[i >> 1] >> 1 | (i & 1) << x;
	w[0] = 1; int wn = Pow(5, (P - 1) / L);
	for(int i = 1;i < L; ++i)
		w[i] = mul(w[i - 1], wn);
	InvL = Inv(L);
}
void DFT(int *F) {
	for(int i = 0;i < L; ++i)
		if(i < R[i])
			std::swap(F[i], F[R[i]]);
	for(int i = 1, d = L >> 1; i < L; i <<= 1, d >>= 1)
		for(int j = 0;j < L; j += i << 1) {
			int *l = F + j, *r = F + j + i, *p = w, tp;
			for(int k = i; k--; ++l, ++r, p += d)
				tp = mul(*r, *p), *r = fix(*l - tp), *l = add(*l, tp);
		}
}
void Dfs(int u, int f) {
	sz[u] = 1;
	for(int i = pr[u]; i; i = nx[i])
		if(to[i] != f)
			Dfs(to[i], u),
			sz[u] += sz[to[i]],
			--a[sz[to[i]]];
	--a[n - sz[u]];
}
int main() {
	n = ri();
	f[0] = 1; for(int i = 1;i <= n; ++i) f[i] = mul(f[i - 1], i);
	g[n] = Inv(f[n]); for(int i = n;i; --i) g[i - 1] = mul(g[i], i);
	for(int i = 1;i < n; ++i)
		adds(ri(), ri());
	Dfs(1, 0); a[n] = n;
	for(int i = 1;i <= n; ++i)
		a[i] = mul(fix(a[i]), f[i]);
	for(int i = 0;i <= n; ++i)
		b[n - i] = g[i];
	Pre((n << 1) + 1);
	DFT(a); DFT(b);
	for(int i = 0;i < L; ++i)
		a[i] = mul(a[i], b[i]);
	DFT(a);
	for(int i = 1;i <= n; ++i) 
		printf("%d\n", mul(mul(a[L - n - i & L - 1], InvL), g[i]));
	return 0;
}

Measured memory_bytes: 29312
from collections import deque

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

tree = [[] for _ in range(N + 1)]

for _ in range(N - 1):
    a, b = map(int, input().split())
    tree[a].append(b)
    tree[b].append(a)

c = [0] * (N + 1)

for _ in range(Q):
    p, x = map(int, input().split())
    c[p] += x

ans = [0] * (N + 1)

go = deque([1])
went = [False] * (N + 1)
went[1] = True
ans[1] = c[1]
while len(go) > 0:
    now = go.popleft()
    for child in tree[now]:
        if went[child]:
            continue
        go.append(child)
        ans[child] = ans[now] + c[child]
        went[child] = True

print(*ans[1:])

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

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

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        a[i] *= -1;
    }

    int INF = (1<<30);
    // A についての広義単調減少列の最大の長さを求めればよい
    // A * (-1) についての広義単調増加列にすればよい
    vector<int> dp(n, INF);
    for(int i=0; i<n; i++){
        auto itr = upper_bound(dp.begin(), dp.end(), a[i]);
        int ind = distance(dp.begin(), itr);
        dp[ind] = a[i];
    }

    auto itr = lower_bound(dp.begin(), dp.end(), INF);
    int ind = distance(dp.begin(), itr);
    cout << ind << endl;

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

ll gcd(long a,long b)
{
  while(b>0) {
    a=a%b;
    a=a^b;
    b=b^a;
    a=a^b;
  }
  return a;
}

ll lcm(long a,long b)
{
  long x=(a*b)/gcd(a,b);
  return x;
}
// ========== end of template ==========

// [1,X]でaで割り切れる数の個数
ll count(ll X, ll a) {
  return X/a;
}

// [1,X]でCでもDでも割り切れない数の個数
ll sub(ll X, ll C, ll D) {
  return X - count(X,C) - count(X,D) + count(X, lcm(C,D));
}

int main(int argc, char** argv) {
  ll A, B, C, D;
  cin >> A >> B >> C >> D;

  ll ret = sub(B, C, D);
  if (A>1) {
     ret -= sub(A-1, C, D);
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,M;
  cin >> N >> M;
  vector<long long> P(M),Y(M);
  for (int i = 0; i < M; i++) cin >> P.at(i) >> Y.at(i);
  
  map<long long, long long> city;
  for (int i = 0; i < M; i++) city[Y.at(i)] = P.at(i);
  
  map<long long, long long> pre;
  map<long long, long long> cityans;
  vector<long long> num(M);
  for (auto i : city) {
    pre[i.second]++;
    cityans[i.first] = i.second * 1000000 + pre[i.second];
  }
  
  for (int i = 0; i < M;i++) num.at(i) = cityans[Y.at(i)];

  vector<string> ans(M);
  for (int i = 0; i < M; i++) {
    string s = to_string(num.at(i));
    ans.at(i) = s;
  }
  
  for (int i = 0; i < M; i++) cout <<  setw(12) << setfill('0') <<  ans.at(i) << endl; 
}

Measured memory_bytes: 28032
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<mod>;

int main(){
    ll s;cin >>s;
    ll n=2001;
    vector<mint>ans(n,1);
    ans[0]=0;ans[1]=0;ans[2]=0;
    for (int i = 0; i <n; ++i) {
        for (int j = 3; j <n; ++j) {
            if(i+j>=n)continue;
            ans[i+j]+=ans[i];
        }
    }
    cout <<ans[s]<<endl;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint X, Y, Z; cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int N,M,Q,B[200010],C,D;
int A[200010];
std::string S;

int main(){
	int n;
	cin>>n;
	cout<<((n<1200)?"ABC":"ARC")<<endl;
	return 0;
}


Measured memory_bytes: 256
/**
*
* Author: MARC
* Lang: GNU C++14
*
**/

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

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >

typedef unsigned long long ull;
typedef long double ldbl;
typedef long long ll;
typedef double dbl;

const ldbl E = 2.71828182845904523536;
const ldbl pi = acos(-1);
const dbl eps = 1e-9;
const ll mod = 1e9+7;
const ll inf = 1LL<<30;

/** /////////// ** Code ** /////////// **/

ll lcm(ll a, ll b) {
return a / __gcd(a, b) * b;
}

const int N=100100;
ll a[N];

int main()
{
    int n; scanf("%d",&n);
    for(int i=0 ; i<n ; i++) scanf("%lld",&a[i]);
    ll ans=a[0];
    for(int i=1 ; i<n ; i++) ans=lcm(ans,a[i]);
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
    tmp = input.split("\n");
    tmp2 = tmp[0].split(" ");
    var n = parseInt(tmp2[0], 10);
    var k = parseInt(tmp2[1], 10);
    tmp.shift();
    arry = tmp.slice();
    list = [];
    count = 0;
    tmp3 = [];

    for (let i = 0; i < arry.length; i++) {
       if (i % 2 !== 0) {

           arry[i] = arry[i].split(" ");
           tmp3 = arry[i].map(Number);

           for (let index = 0; index < tmp3.length; index++) {
               list.push(tmp3[index]);
           }
       }
    }
  
    for (let i = 1; i <= n; i++) {
        if (list.indexOf(i) >= 0) {
            
        } else{
            count += 1;
        }        
    }

    console.log(count);    

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 30204
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int dig = 0, res = 10, n = 0;

    scanf("%d", &n);
    dig = n;

    if (n % 10 != 0) {
        res = 0;
        while(n != 0) {
            res += n%10;
            n = n/10;
        }
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
    fast;
    ll t=1;// cin>>t;
    while(t--)
    {
        ll n;cin>>n;cout<< n + n*n + n*n*n<<"\n";
    }
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main(){
    ll N, M;
    cin >> N >> M;
    if(N==1 && M==1) cout << N << endl;
    else if(N == 1 || M == 1) cout << max(N,M)-2 << endl;
    else cout << (N-2) * (M-2) << endl;
    return 0;
}

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

int main(){
  int N, K;
  cin>>N>>K;
  int i=0;
  while(true){
      if(pow(K, i)>N){
          break;
      }
      else{
          i++;
      }
  }
  cout<<i<<endl;
}

Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            long K = sc.nextLong();
            long[] A = new long[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextLong();
            }

            Arrays.sort(A);

            double[] B = new double[N];
            for (int i = 0; i < N; i++) {
                B[i] = A[i];
            }

            long min = -1000000000L * 1000000000L;
            long max = 1000000000L * 1000000000L;
            long mid = (min + max) / 2;

            while (true) {
                long c = count(A, B, mid);

                //System.out.println(mid + " : " + c + " (" + min + ", " + max + ")");

                if (c < K * 2) {
                    min = mid;
                } else {
                    max = mid;
                }

                long mid2 = (min + max) / 2;
                if (mid == mid2) {
                    while (true) {
                        c = count(A, B, mid);
                        if (c >= K * 2) {
                            break;
                        }
                        mid++;
                    }
                    break;
                }

                mid = mid2;
            }

            System.out.println(mid);
        }
    }

    static long count(long[] A, double[] B, long mid) {
        int N = A.length;

        long c = 0;
        for (int i = 0; i < N; i++) {
            if (A[i] == 0) {
                if (mid >= 0) {
                    c += (N - 1);
                }
                continue;
            }

            long m = mid / A[i];

            if (mid < 0) {
                if (mid % A[i] != 0) {
                    if (A[i] < 0) {
                        m++;
                    } else {
                        m--;
                    }
                }
            }

            if (A[i] < 0) {
                int pos = Arrays.binarySearch(B, m - 0.1);
                if (pos < 0) {
                    pos = -(pos + 1);
                }
                c += (N - pos);
                if (i >= pos) {
                    c--;
                }
            } else {
                int pos = Arrays.binarySearch(B, m + 1 - 0.1);
                if (pos < 0) {
                    pos = -(pos + 1);
                }
                c += pos;
                if (i < pos) {
                    c--;
                }
            }
        }

        return c;
    }

}


Measured memory_bytes: 92028
#include<bits/stdc++.h>
#define loop(a,b,c) for(int a=b;a<c;a++)
using namespace std;
int main(){
	int n, x, y;
	cin>>n>>x>>y;
	if (x*y >= n){
		cout<<"Yes"<<endl;
	} 
	else {
		cout<<"No"<<endl;
	}
	
}

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

int main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());

    char alpha='a', omega='z';

    int i=0;
    for(auto c: s){
        if(c==alpha+i){
        	    i++;
        }
    }
    
    char ans=alpha+i;
    if(ans<=omega){
        cout << ans << endl;
    }else{
        cout<<"None"<<endl;
    }
    return 0;
}

Measured memory_bytes: 512