akhauriyash/Code-Regression huggingface dataset:
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt
    val as = in.readLine().split("\\s+").map(_.toInt)

    val map = mutable.HashMap.empty[Int, Int]

    for(i <- 0 until n) {
      val l = i + as(i) + 1
      map.update(l, map.getOrElseUpdate(l, 0) + 1)
    }

    var counter = 0L

    for(i <- 0 until n) {
      val r = i - as(i) + 1
      map.get(r) match {
        case Some(c) =>
          counter += c
        case None =>
      }
    }

    out.println(counter)
    out.flush()
  }
}


Measured memory_bytes: 83672
#include <stdio.h>

int main() {
    int n, i;
    int max, min, sum;
    int score;

    while (1) {
        scanf("%d", &n);

        if (n == 0) { break; }

        sum = 0;

        for (i = 0; i < n; i++) {
            scanf("%d", &score);
            sum += score;
        
            if (i == 0) {
                max = score;
                min = score;
            }

            if (score > max) { max = score; }
            if (score < min) { min = score; }
        }

        printf("%d\n", (sum - max - min) / (n - 2));
    }

    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  int ret = 0;
  rep(i,N.size()){
    ret += (int)(N[i] - '0');
    ret %= 9;
  }

  if(ret == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define ref(i,x,y)for(int i=x;i<=y;++i)
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
int n,m,a[101][101],id[10010];int vis[101];
int s[101][101],link[101],LK[101];
bool dfs(int x){
	if(vis[x])return 0;vis[x]=1;
	ref(i,1,n)if(s[x][i]){
		if(!link[i]||dfs(link[i])){
			link[i]=x;
			return 1;
		}
	}
	return 0;
}
int main(){
	scanf("%d%d",&n,&m);
	ref(i,1,n)ref(j,1,m)scanf("%d",&a[i][j]);
	ref(i,1,n*m)id[i]=(i-1)/m+1;
	ref(i,1,m){
		memset(s,0,sizeof s);
		ref(I,1,n)ref(J,i,m)s[I][id[a[I][J]]]++;
		memset(link,0,sizeof link);
		ref(I,1,n){
			memset(vis,0,sizeof vis);
			dfs(I);
		}
		ref(I,1,n)LK[link[I]]=I;
		ref(I,1,n){
			ref(J,i,m)if(LK[I]==id[a[I][J]]){
				swap(a[I][i],a[I][J]);
				break;
			}
		}
	}
	ref(i,1,n){
		ref(j,1,m)cout<<a[i][j]<<" ";
		cout<<endl;
	}
	ref(i,1,m){
		ref(j,1,n){
			ref(k,j,n)if(id[a[k][i]]==j){
				swap(a[j][i],a[k][i]);
				break;
			}
		}
	}
	ref(i,1,n){
		ref(j,1,m)cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a>b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define F first
#define S second
using namespace std;
typedef long long ll;
const ll MOD =1e9 + 7;





int main(){
	int n;
	int c=0;
	cin>>n;
    ll a[202020];
    ll r=0,l=0;
    rep(i,n){
        cin>>a[i];
    }
    int ls=0,rs=n-1;
    rep(i,n){
        
        if(r>l){
            l+=a[ls];
            ls++;
        }else{
            r+=a[rs];
            
            rs--;
        }
        
        if(r>l){
            r-=l;
            l-=l;
        }else{
            
            
            l-=r;
            r-=r;
            
        }
        
        if(i==n-1){
            if(r>l)cout<<r;
            else cout<<l;
            cout<<endl;
        }

    }
    
	
}

Measured memory_bytes: 1920
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        const long MOD = 1000000007;
        var sc = new Scanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        Console.WriteLine(Math.Max(a + b, Math.Max(a - b, a * b)));
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
use proconio::*;
use proconio::marker::Usize1;

#[fastout]
fn run() {
    input! {
        n: usize,
        a: [u32; n],
        e: [(Usize1, Usize1); n - 1],
    }
    let mut g = vec![vec![]; n];
    for (a, b) in e {
        g[a].push(b);
        g[b].push(a);
    }
    let mut ans = vec![0; n];
    enum Operation {
        DFS(usize, usize),
        ROLLBACK(usize, u32),
        POP,
    }
    let mut dp = vec![0];
    let mut stack = vec![Operation::DFS(0, 0)];// 頂点、親、命令
    while let Some(op) = stack.pop() {
        match op {
            Operation::DFS(v, p) => {
                let mut l = 0;
                let mut r = dp.len();
                while r - l > 1 {
                    let m = (l + r) / 2;
                    if dp[m] < a[v] {
                        l = m;
                    } else {
                        r = m;
                    }
                }
                if r >= dp.len() {
                    dp.push(a[v]);
                    stack.push(Operation::POP);
                } else {
                    let save = dp[r];
                    dp[r] = a[v];
                    stack.push(Operation::ROLLBACK(r, save));
                }
                ans[v] = dp.len() - 1;
                for &u in g[v].iter() {
                    if u != p {
                        stack.push(Operation::DFS(u, v));
                    }
                }
            },
            Operation::ROLLBACK(v, val) => {
                dp[v] = val;
            },
            Operation::POP => {
                dp.pop();
            }
        }
    }
    for a in ans {
        println!("{}", a);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 27120
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(i, n) a[idx][i] = v[i]; idx++; PER = a;} while(next_permutation(ALL(v)));} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  cin >> x;
  int rem = x % 100, n = x / 100;
  if (5 * n >= rem) cout << 1;
  else cout << 0;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111



	void solve(){

		ini(n);
		vi morty(20);
		//FOR(i,0,n)in(morty[i]);
		int tmp = 1;
		int rick = 0;
		FOR(i,1,n+1){
			ini(x);
			FOR(i1,0,20){
				if(x & (1<<i1) ){
					tmp = max(tmp,morty[i1]+1);
				//	out(i,tmp);
					morty[i1] = i;
				}
			}
			rick+=i-tmp+1;
		}
		out(rick);











	}	























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


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

int m, n;
int P[510];
bool V[510], C[510][510];

int gcd(int a, int b){
  if(a < b) swap(a, b);
  if(b == 0) return a;
  return gcd(b, a % b);
}

bool match(int b){
  if(b < 0) return true;
  for(int i=0; i<n; ++i){
    if(!C[b][i] || V[i]) continue;
    V[i] = true;
    if(match(P[i])) {
      P[i] = b;
      return true;
    }
  }
  return false;
}

int main(){
  int blue[510], red[510];
  //  cout << gcd(6, 15);
  while(cin >> m >> n){
    if(!m) return 0;
    for(int i=0; i<m; ++i){
      cin >> blue[i];
    }
    for(int i=0; i<n; ++i){
      cin >> red[i];
      P[i] = -1;
    }

    for(int i=0; i<m; ++i){
      for(int j=0; j<n; ++j){
	C[i][j] = (gcd(blue[i], red[j]) >= 2);
	//	cout << C[i][j] << " ";
      }
      // cout << endl;
    }

    int count = 0;

    for(int i=0; i<m; ++i){
      for(int j=0; j<n; ++j){
	V[j] = 0;
      }
      if(match(i)) count++;
      for(int i=0; i<n; ++i){
	//cout << P[i] << " ";
      }
      // cout << endl;
    }
    cout << count << endl;
  }
  
  return 0;
}

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

#define INF 2147483647

// 262144 = 2^18
int tree[262144];


int dfs(int a,int b,int k,int l,int r){
  if(r<=a || b<=l)return INF;
  if(a<=l && r<=b)return tree[k];
  int m=(l+r)/2;
  return min(dfs(a,b,k*2+1,l,m),dfs(a,b,k*2+2,m,r));
}

int getMax(int a,int b){
  // 131072 = 2^17
  return dfs(a,b,0,0,131072);
}

void update(int i,int x){
  // 131072 = 2^17
  i+=(131072-1);
  tree[i]=x;
  while(i){
    i=(i-1)/2;
    tree[i]=min(tree[i*2+1],tree[i*2+2]);
  }
}

int n,q;
int a,b,c;
int main(){
  cin>>n>>q;
  for(int i=0;i<n;i++)update(i,INF);
  for(int i=0;i<q;i++){
    cin>>a>>b>>c;
    if(a==1){
      cout<<getMax(b,c+1)<<endl;
    }else{
      update(b,c);
    }
  }
  return 0;
}

Measured memory_bytes: 1960
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,l,r) for(ll i=l;i<(ll)(r);i++) //ll
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
#define swap(l,r) {ll tp=l;l=r;r=tp;}
const ll MOD = 1000000007;
const int INF = (1<<30);
int upcmpii(const void *a, const void *b){return(*(int*)a==*(int*)b?0:(*(int*)a>*(int*)b?1:-1));}
void sort_ui(int*a, int n){qsort(a,n,sizeof(int),upcmpii);}

int n,x,t;
ll ans = 0;

int main(){
    scanf("%d%d%d", &n,&x,&t);

    ans = t*((n+x-1)/x);

    printf("%lld", ans);
}

Measured memory_bytes: 1732
import sys
sys.setrecursionlimit(1000000)

N = int(input())
dp = [0]*(N+1)

def fun(n):
  if n == 0:
    return 0
  elif dp[n] != 0:
    return dp[n]
  
  ans = N
  for i in [6**k for k in range(7)]:
    if i <= n:
      ans = min(ans, fun(n-i) + 1)
  for j in [9**l for l in range(6)]:
    if j <= n:
      ans = min(ans, fun(n-j) + 1)
  
  dp[n] = ans
  return dp[n]

fun(N)
print(dp[-1])

Measured memory_bytes: 118900
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
using namespace std;
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+1;
const int mod = 1e9+7;
int main() {
	int n,r=0,g=0,b=0;
	ll ans=0;
	string s;
	cin >> n >> s;
	for(int i = 0; i < n; i++){
		if(s[i]=='R') r++;
		if(s[i]=='G') g++;
		if(s[i]=='B') b++;
	}
	ans=r;ans*=g;ans*=b;
	for(int i = 0; i < n; i++){
		for(int j = i+2; j < n; j+=2){
			int mid=(i+j)>>1;
			if((s[i]!=s[j])&&(s[j]!=s[mid])&&(s[i]!=s[mid])) ans--;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/range/algorithm.hpp>
#define rep(i,n) for (int i=0; i< (n); ++i)
using namespace std;
typedef long long ll;

bool cmp(pair<int,int> a, pair<int,int> b){
  return a.second > b.second;
}

int main() {
  int n;
  cin >> n;
  vector<pair<int,int>> A(n);
  rep(i,n){
    cin >> A[i].first >> A[i].second;
  }
  sort(A.begin(),A.end(),cmp);

  int time = 0;
  string ans = "Yes";
  rep(i,n){
    int a,b;
    a = A.back().first;
    b = A.back().second;
    time += a;
    if (time > b) ans = "No";
    A.pop_back();
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

D_dic = {k: 0 for k in D}
T_dic = {k: 0 for k in T}

for i in range(N):
    d = D[i]
    if D_dic[d]:
        a = D_dic[d] + 1
        D_dic[d] = a
    else:
        D_dic[d] = 1
    
for j in range(M):
    t = T[j]
    if T_dic[t]:
        b = T_dic[t] + 1
        T_dic[t] = b
    else:
        T_dic[t] = 1

cou = 0
if N >= M:
    for k in range(M):
        tk = T[k]
        try:
            if D_dic[tk]:
                c = D_dic[tk] - 1
                D_dic[tk] = c
                cou += 1
            else:
                x = 'NO'
                break
        except KeyError:
            x = 'NO'
            break
            
    if cou == M:
        x = 'YES'
else:
    x = 'NO'

print(x)

Measured memory_bytes: 56672
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

void prime(int n, vector<ll> &ans) {
    for (int i = 2; i * i <= n; i++) {
        ll ex = 0;
        while (n % i == 0) {
            ex++;
            n /= i;
        }

        ans[i] += ex;
    }
    if (n != 1) {
        ans[n] += 1;
    }
}

int main() {
    int N;
    cin >> N;
    vector<ll> ans(N + 1);
    for (int i = 2; i < N + 1; i++) {
        prime(i, ans);
    }

    ll res = 1;
    ll MOD = pow(10, 9) + 7;
    for (int i = 2; i < N + 1; i++) {
        res *= (ans[i] + 1);
        res %= MOD;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
typedef long long ll;

int line1[110]={}, line2[110]={};

int main() {
    int N;
    cin >> N;
    
    rep1(i,N) {
        cin >> line1[i];
        line1[i] += line1[i-1];
    }
    rep1(i,N) {
        cin >> line2[i];
        line2[i] += line2[i-1];
    }
    
    int maxv = 0;
    rep1(i,N) {
        maxv = max( maxv, line1[i] + (line2[N]-line2[i-1]));
    }
    cout1(maxv);
}

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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

long long gcd(long long A, long long B) {  // A>B
  if (A < B) swap(A, B);
  if (B == 0)
    return A;
  else {
    return gcd(B, A % B);
  }
}

int main() {
    ll A,B;
    cin >> A >> B;

    cout << ll((A*B)/gcd(A,B)) << endl;

}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int a,s[5],pd=0;
	cin>>a;
	for(int i=0;i<4;i++)
	{
		s[i]=a%10;
		if(a>0)
			a=a/10;
		else
			a=0;		
	}
	for(int i=0;i<3;i++)
	{
		if(s[i]==s[i+1])
		pd=1;	
	}
	if(pd)
	{
		cout<<"Bad";	
	}
	else
	{
		cout<<"Good";	
	}	
	return 0;
} 

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); //入出力高速化
  int N; cin >> N;
  vector<int> A(N);
  rep(i,N) cin >> A[i];

  int ans = 0;
  int count = 0;
  rep(i,N-1) {
    if (A[i] >= A[i+1]) count++;
    else {
      chmax(ans,count);
			count = 0;
		}
  }
	chmax(ans,count);

	cout << ans << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;


int main()
{

    char a[3];
    scanf("%s",a);

    if(a[1]=='B')
    {
        printf("ARC\n");
    }
    else
    {
        printf("ABC\n");
    }
    

    return 0;
}

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

using namespace std;
// using P = pair<long, long>;
using P = pair<double, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))

#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define concat(xs, ys) (xs).insert((xs).end(), (ys).begin(), (ys).end())

const int mod = 1000000007;

vector<int> nums[10];

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

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

  rep(i, n) {
    nums[s[i] - '0'].push_back(i);
  }

  int res = 0;
  rep(i, 10) {
    if (nums[i].size() == 0) continue;
    int fst = nums[i][0];
    rep(j, 10) {
      int snd = ubv(nums[j], fst);
      if (snd == nums[j].size()) continue;
      rep(k, 10) {
        int thd = ubv(nums[k], nums[j][snd]);
        if (thd != nums[k].size()) {
          res++;
        }
      }
    }
  }
  
  cout << res << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
using namespace std;

void printV(vll v){
	cout << "size (" << v.size() << "): ";
	for(ll i = 0; i < v.size(); i++){
		cout << v[i] << " ";
	}
	cout << "\n";
}

void printM(vector<vll> v){
	cout << "size (" << v.size() << "," << v[0].size() << "): ";
	for(ll i = 0; i < v.size(); i++){
		for(ll j = 0; j < v[i].size(); j++){
			cout << v[i][j] << " ";
		}
		cout << "\n";
	}
}

ll powermod(ll x, ll y){
	ll res = 1;
	x = x % mod;
	while (y > 0)
	{
		if (y & 1){
			res = (res * x) % mod;
		}
		y = y >> 1;
		x = (x * x) % mod;
	}
	res %= mod;
	return res;
}

ll factmod(ll n)
{
	ll res = 1;
	while (n > 1)
	{
		res = (res * ((n / mod) % 2 ?  mod - 1 : 1)) % mod;
		for (ll i = 2; i <= n % mod; ++i){
			res = (res * i) % mod;
		}
		n /= mod;
	}
	res %= mod;
	return res;
}

void solve(){
	ll temp;
	cin >> temp;
	if(temp >= 30) cout << "Yes\n";
	else cout << "No\n";
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t = 1;
//	cin >> t;
	while (t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3616
N,X,Y = list(map(int,input().split()))

ans_dict={}
for n in range(1,N):
    ans_dict[n]=0
    
for n1 in range(1,N+1):
    for n2 in range(n1+1,N+1):
        ans_1 = abs(n1-n2)
        ans_2 = abs(n1-X)+abs(n2-Y)+1
        ans_3 = abs(n2-X)+abs(n1-Y)+1
        
        ans=min(ans_1,ans_2,ans_3)
        ans_dict[ans]+=1
        

for k in ans_dict.keys():
    print(ans_dict[k])

Measured memory_bytes: 74724
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define s(x)   scanf("%d",&x);
#define bug(x) printf("  %s = %d \n",#x,x);
#define mem(arr,x) memset(arr,x,sizeof arr);
const int maxn = 2e5 + 5;
typedef long long LL;
using namespace std;

int main(){
	int n;
	while(cin >> n){
		int i = 1;
		while(i * 2 <= n) i *= 2;
		cout << i << endl;
	}
}


Measured memory_bytes: 256
N, L = list(map(int, input().split()))
orig_taste = int(0.5 * N * (N + 1)) - N + L * N

if L > 0:
    eaten_apple = L
elif L > -N:
    eaten_apple = 0
else:
    eaten_apple = L + N - 1
    
print(orig_taste- eaten_apple)

Measured memory_bytes: 3060
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n,k;
	
	cin>>n;
  	cin>>k;
	int arr[n],dp[n+1];
	for(int i=0;i<n;i++){
		cin>>arr[i];
		
	}
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(int i=2;i<n;i++){
		dp[i]=dp[i-1]+abs(arr[i]-arr[i-1]);
      for(int j=2;j<=k;j++){
        if(i-j>=0){
        dp[i]=min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));
        }
      }
	}
	
	cout<< dp[n-1];
	return 0;
}

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{

    int n;
    cin >> n;
    vector<char> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }

    unique(v);
    if ((int)v.size() == 3) {
        cout << "Three" << endl;
    }else{
        cout << "Four" << endl;
    }

    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector


// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }


Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String[] args){
		BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
		String s,u;
		String[] a;
		double xa,ya,ra,xb,yb,rb,x,y,l1,l2;
		double l;
		int ans=0;
		int t;
		try{
				while((s=r.readLine()) !=null){
						t=Integer.parseInt(s);
						for(int i=0;i<t;i++){
							u=r.readLine();
							a=u.split(" ");
							double[] b=new double[a.length];
							for(int j=0;j<a.length;j++){
								b[j]=Double.parseDouble(a[j]);
							}
							xa=b[0];
							ya=b[1];
							ra=b[2];
							xb=b[3];
							yb=b[4];
							rb=b[5];
							if(xa>xb){
								x=xa-xb;
							}else{
								x=xb-xa;
							}
							if(ya>yb){
								y=ya-yb;
							}else{
								y=yb-ya;
							}
							l=Math.sqrt(x*x+y*y);
							l1=ra+rb;
							if(ra>rb){
								l2=ra-rb;
							}else{
								l2=rb-ra;
							}
							if(l<l2){
								ans=2;
								if(rb>ra){
									ans *=-1;
								}
							}else{ 
								if(l2<=l &&l<=l1){
										ans=1;
							    }else{
										ans=0;
							    }
							}
							System.out.println(ans);
						}
				}
		}catch(IOException e){
				System.out.println(e);
		}
	}
}

Measured memory_bytes: 16924
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
using namespace std;
using ll = long long;
int main() {
	ll a, b, x; cin >> a >> b >> x;
	a--;
	ll aa = a / x + 1;
	if (a == -1) aa = 0;
	ll bb = b / x + 1;
	ll res = bb - aa;
	cout << res << endl;
	//system("pause");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

LL mod = 1000000007;

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

  LL N, A, B, C;
  cin >> N >> A >> B >> C;

  LL min = 1145141919;

  vector<LL> L(N);

  REP(i,N){
    cin >> L[i];
  }

  REP(i,1<<(2*N)){
    LL a = 0;
    LL b = 0;
    LL c = 0;

    LL d = 0;
    LL m = i;
    REP(j, N)
    {
      if(m%4==1){
        a += L[j];
        d++;
      }
      else if (m % 4 == 2)
      {
        b += L[j];
        d++;
      }
      else if (m % 4 == 3)
      {
        c += L[j];
        d++;
      }
      m /= 4;
    }

    if(a!=0&&b!=0&&c!=0){
      LL cost = abs(a - A) + abs(b - B) + abs(c - C)+d*10-30;
      if(cost<min){
        min = cost;
      }
    }
  }

  cout << min << endl;
}


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

typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 

template <class T>
void printArray(vector<T> arr) {for (T a: arr) cout << a << " ";cout << '\n';}
void printVerdict(bool verdict) {cout << (verdict ? "YES": "NO") << '\n';}
void printDecimal(double d) {printf("%.9f\n", d);}
bool inrange(int val, int start, int end) {return val >=start && val <= end;}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	int a[n];
	for (int i = 0; i<n;  i++) cin >> a[i];
	int ret = 0;
	for (int i = 0;i<n; i++) ret += (i%2==0 && a[i]&1);
	cout << ret << '\n'; 
}



Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> v(4);
  for(auto&e:v)cin >> e;
  sort(v.begin(),v.end());
  if(v[0] == 1 && v[1] == 4 && v[2] == 7 && v[3] == 9)
    cout << "YES" << endl;
  else 
    cout << "NO" << endl;
}

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




int main() {
    int t=1;
    // cin>>t;
    while(t--){
        string s;
        cin>>s;
        int sum=0;
        for(int i=0;i<s.length();i++){
            sum+=s[i]-'0';
            sum=sum%9;
        }
        if(sum%9==0)
            cout<<"Yes";
        else
            cout<<"No";
    }
    }

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

using namespace std;

int main()
{
    int n;
    long long cont = 0;
    cin >> n;
    int a = 1;
    while (a <= n)
    {
        if (a % 3 == 0 && a % 5 == 0)
        {
            cont = cont;
        }
        else
        {
            if (a % 3 == 0)
            {
                cont = cont;
            }
            else
            {
                if (a % 5 == 0)
                {
                    cont = cont;
                }
                else
                {
                    cont += a;
                }
            }
        }
        a += 1;
    }
    cout << cont;
}

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

using namespace std;

int n, x, ans;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> x;
        ans += i % 2 && x % 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K, i, x;
  cin >> N >> K;
  i = 0;
  x = 1;
  while (i < N && x * 2 < x + K){
    x *= 2;
    i++;
  }
  if(i < N) x += K * (N - i);
  
  cout << x << endl;

}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
using namespace std;
long long a[25],f[25][25][25][25];
long long dfs(int l,int r,int xl,int xr)
{
 if(r-l<=1)return 0;
 long long ans=1e18;
 for(int i=l+1;i<=r-1;i++)
  ans=min(ans,dfs(l,i,xl,xl+xr)+dfs(i,r,xl+xr,xr)+a[i]*(xl+xr));
 return f[l][r][xl][xr]=ans;
}
int main()
{
 int n;
 cin>>n;
 for(int i=1;i<=n;i++)
  cin>>a[i];
 cout<<a[1]+a[n]+dfs(1,n,1,1)<<endl;
 return 0;
}

Measured memory_bytes: 1792
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=3005;
int n,t;
int dp[M][M];
int a[M],b[M];
vector<pi>vec;
int solve(int pos,int tym)
{
    if(pos>n)return 0;
    if(tym>=t)return 0;
    int &ret=dp[pos][tym];
    if(ret!=(-1))return ret;
    ret=solve(pos+1,tym);
    ret=max(ret,solve(pos+1,tym+a[pos])+b[pos]);
    return ret;
}
 main()

{
    fast
    memset(dp,-1,sizeof dp);
    cin>>n>>t;
    f(i,1,n)
    {
        cin>>a[i]>>b[i];
        vec.pb(mp(a[i],-b[i]));
    }
    sort(vec.begin(),vec.end());
    f(i,0,n-1)
    {
        a[i+1]=vec[i].fi;
        b[i+1]=-vec[i].si;
    }
    int ses=solve(1,0);
    cout<<ses<<endl;
    return 0;

}





































Measured memory_bytes: 74500
#include <iostream>
#include <unordered_map>

using namespace std;

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

    unordered_map<int, int> map;
    for (int i = 0; i < n; i++) {
        int d;
        cin >> d;
        map[d]++;
    }

    int m;
    cin >> m;

    bool ans = true;
    for (int i = 0; i < m; i++) {
        int t;
        cin >> t;
        if (--map[t] < 0) {
            ans = false;
            break;
        }
    }

    cout << (ans ? "YES" : "NO") << endl;
}

Measured memory_bytes: 8520
a, b = map(int, input().split())
s = list(input())
if len(s) != a + b + 1:
    print("No")
elif s[a] != "-":
    print("No")
else:
    for i in range(a):
        if not s[i].isdecimal():
            print("No")
            exit()
    for i in range(a + 1, len(s)):
        if not s[i].isdecimal():
            print("No")
            exit()
    print("Yes")

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
int main(){
  int i,j,c=0,r=0;
  char s[11],a[]={"AGTC"};
  scanf("%s",s);
  for(i=0;i<strlen(s);i++){
    if(strchr(a,s[i]))c++;
    else c=0;
    if(r<c)r=c;
  }
  printf("%d",r);
  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define MP(a,b) make_pair(a,b)
typedef long long LL;
typedef pair<int, int> PI;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
const LL MOD = 1000000007LL;
LL dp[50][51][2501];
int x[50];
int main() {
	int N, A;
	cin >> N >> A;
	rep(i, N) cin >> x[i];
	dp[0][0][0] = dp[0][1][x[0]] = 1;
	REP(i, 1, N) {
		rep(j, 51) {
			rep(k, 2501) {
				dp[i][j][k] = dp[i - 1][j][k];
				if (j > 0 && k >= x[i]) dp[i][j][k] += dp[i - 1][j - 1][k - x[i]];
			}
		}
	}
	LL ans = 0;
	REP(i, 1, N + 1) {
		ans += dp[N - 1][i][i*A];
	}
	cout << ans << endl;
}

Measured memory_bytes: 49024
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
 
signed main(){
    string S;cin>>S;
    int ac,bc,cc;
    ac=bc=cc=0;
    REP(i,S.size()){
        if(S[i]=='a')ac++;
        if(S[i]=='b')bc++;
        if(S[i]=='c')cc++;
    }
    int m=min(ac,min(bc,cc));
    if(ac-m<=1&&bc-m<=1&&cc-m<=1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin>>s;
    vector<int> v(26,0);
    // for(auto c:s){
    //     v[c-'a']++;
    // }
    int ans=99999999;
    for(int i=0;i<26;i++){
        int tmp=0;
        int max=0;
        for(auto c:s){
            if(c==('a'+i)){
                if(max<tmp){
                    max=tmp;
                }
                tmp=0;
            }else{
                tmp++;
            }
        }
        if(max<tmp){
            max=tmp;
        }
        if(max<ans){
            ans=max;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 256
f1 = input().split()
f2 = input().split()
f3 = input().split()
f = [f1, f2, f3]

n = int(input())
for i in range(n):
    b = input()
    if b in f1:
        a = f1.index(b)
        f1[a] = 0
    elif b in f2:
        a = f2.index(b)
        f2[a] = 0
    elif b in f3:
        a = f3.index(b)
        f3[a] = 0

def judge():
    bingoc = True
    bingod = True
    for i in range(3):
        bingoa = True
        bingob = True
        for j in range(3):
            if f[i][j] != 0:
                bingoa = False
            if f[j][i] != 0:
                bingob = False
        if bingoa or bingob:
            print('Yes')
            return

        if f[i][i] != 0:
            bingoc = False
        if f[i][2-i] != 0:
            bingod = False
    if bingoc or bingod:
        print('Yes')
        return
    print('No')

judge()


Measured memory_bytes: 3064
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 20000
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};


//=============================================ASIFAZAD==============================================//

int32_t main()
{
    io;
    int n, d, a;
    cin>>n>>d>>a;
    ll ans = 0;
    vector<pll> inp(n);
    for(int i = 0; i< n;i++)
    {
        ll x, y;
        cin>>x>>y;
        y = (y + a -1)/a;
        inp[i].first = x;
        inp[i].second = y;
    }
    ll cur = 0;
    sort(all(inp));
    map<ll, ll> mark;
    for(int i =0 ; i< n;i++)
    {
        cur -= mark[i];
        inp[i].second -= cur;
        if(inp[i].second <= 0)
            continue;
        ans += inp[i].second;
        cur += inp[i].second;
        int l = i, h = n-1, pos = -1, mid;
        while(l <= h)
        {
            mid = (l + h)/2;
            if(inp[mid].first > inp[i].first + 2*d)
            {
                pos = mid;
                h = mid - 1;
            }
            else
                l = mid + 1;
        }
//        dbg(cur);
//        dbg(pos);
        if(pos != -1)
            mark[pos] += inp[i].second;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 18764
import math

a,b,x=map(int,input().split())

if a*b/2*a>x:
  rad = math.atan(a*b*b/2/x)
  deg = math.degrees(rad)
else:
  rad = math.atan(2/a/a*(a*b-x/a))
  deg = math.degrees(rad)
  

print(deg)

Measured memory_bytes: 38256
#include<stdio.h>
struct Node{ int p, l, r;};
struct Node T[100000];
int n, H, D[100000];
int Depth(int x){
  int i;
  for(i=0; T[x].p != -1 ;i++) x = T[x].p;
  return i;
}
void print(int x){
  int i, c;
  printf("node %d: parent = %d, depth = %d,", x,T[x].p,D[x]);
  if ( T[x].p == -1 ) printf(" root, ");
  else if ( T[x].l == -1 ) printf(" leaf, ");
  else printf(" internal node, ");
  printf("[");
  for(i = 0, c = T[x].l; c != -1; i++, c = T[c].r){
    if (i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
}
main(){
  int i, j, d, v, c, l;
  scanf("%d", &n);
  for ( i = 0; i < n; i++ )
    T[i].p = T[i].l = T[i].r = -1;
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &d);
    for ( j = 0; j < d; j++ ){
      scanf("%d", &c);
      if ( j == 0 ) T[v].l = c;
      else T[l].r = c; l = c; T[c].p = v;
    }
  }
  H = 0;
  for ( i = 0; i < n; i++ ){
    D[i] = Depth(i);
    if ( D[i] > H ) H = D[i];
  }
  for ( i = 0; i < n; i++ ) print(i);
  return 0;
}





Measured memory_bytes: 3340
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

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

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInt2() (int, int) {
	return nextInt(), nextInt()
}

func nextInt3() (int, int, int) {
	return nextInt(), nextInt(), nextInt()
}

func nextInt4() (int, int, int, int) {
	return nextInt(), nextInt(), nextInt(), nextInt()
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	a, b := next(), next()
	na, nb := len(a), len(b)

	if na > nb {
		puts("GREATER")
		return
	} else if na < nb {
		puts("LESS")
		return
	}

	for i := range a {
		if a[i] > b[i] {
			puts("GREATER")
			return
		} else if a[i] < b[i] {
			puts("LESS")
			return
		}
	}
	puts("EQUAL")
}


Measured memory_bytes: 1796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<pair<int, ll> > adj[100010], adj2[100010];
int n, m;
void dij(int s, vector<pair<int, ll> > *adj, ll *dis)
{
	for (int i = 1; i <= n; i++) dis[i] = 1e18;
	dis[s] = 0;
	priority_queue<pair<ll, int>, vector<pair<ll, int> >, greater<pair<ll, int> > > pq;
	pq.emplace(0, s);
	while (pq.size())
	{
		int a = pq.top().second;
		ll d = pq.top().first;
		pq.pop();
		if (dis[a] != d) continue;
		for (auto c : adj[a])
		{
			if (d + c.second < dis[c.first])
			{
				dis[c.first] = d + c.second;
				pq.emplace(dis[c.first], c.first);
			}
		}
	}
}
ll dis1[100010], dis2[100010];
ll ans[100010];
int s, t;
int main()
{
	scanf("%d%d%d%d", &n, &m, &s, &t);
	for (int i = 0; i < m; i++)
	{
		int a, b;
		ll c, d;
		scanf("%d%d%lld%lld", &a, &b, &c, &d);
		adj[a].emplace_back(b, c);
		adj[b].emplace_back(a, c);
		adj2[a].emplace_back(b, d);
		adj2[b].emplace_back(a, d);
	}
	dij(s, adj, dis1);
	dij(t, adj2, dis2);
	for (int i = 1; i <= n; i++)
	{
		ans[i] = 1e15 - dis1[i] - dis2[i];
	}
	for (int i = n-1; i >= 1; i--)
	{
		ans[i] = max(ans[i], ans[i+1]);
	}
	for (int i = 1; i <= n; i++) printf("%lld\n", ans[i]);
}

Measured memory_bytes: 19140
n,m,x = [int(x) for x in input().split()]
c = []
a = []
for _ in range(n):
    tmp = [int(x) for x in input().split()]
    c.append(tmp[0])
    a.append(tmp[1:])

ans = 1<<60

for i in range(1<<n):
    score = [0]*m
    money = 0
    for j in range(n):
        if (1<<j) & i != 0:
            money += c[j]
            for k in range(m):
                score[k] += a[j][k]
    if min(score) >= x:
        ans = min(ans,money)

if ans == 1<<60:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <numeric>


int main()
{
	long long n;

	long long l00 = 2, l0 = 1;

	std::cin >> n;

	for (size_t i = 0; i < n / 2; i++)
	{
		l00 += l0;
		l0 += l00;
	}

	if (n % 2 == 0) {
		std::cout << l00 << std::endl;
	}
	else {
		std::cout << l0 << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
import math
a,b,c = map(float,raw_input().split(' '))
H = b*math.sin(math.radians(c))
S = a*H/2
A = math.sqrt((b*b)-(H*H))
d = math.sqrt((a**2)+(b**2)-2*a*b*math.cos(math.radians(c)));
L = a+b+d
print S
print L
print H

Measured memory_bytes: 4436
n, m = map(int, input().split())

a = list(map(int, input().split()))

bc = []

for i in range(m):
    b_, c_ = list(map(int, input().split()))
    bc.append((b_, c_))

a.sort()
bc.sort(key=lambda x: x[1], reverse=True)

d = []

for b, c in bc:
    d.extend([c for _ in range(b)])
    if len(d) > n:
        break

d.extend([0 for _ in range(n)])

ans = 0

for i in range(n):
    ans += max(d[i], a[i])
print(ans)


Measured memory_bytes: 24824
import sys
input=sys.stdin.readline

n,q=map(int,input().split())
tree=[[] for i in range(n)]

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

ans=[0]*n
for i in range(q):
  p,x=map(int,input().split())
  ans[p-1]+=x

from collections import deque
q=deque([0])
while q:
  i=deque.popleft(q)
  for leaf in tree[i]:
    q.append(leaf)
    ans[leaf]+=ans[i]
    tree[leaf].remove(i)

print(*ans)
  

Measured memory_bytes: 54616