akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  double N;
  cin >> N;
  vector<vector<double>> vec(N,vector<double>(2));
  for(int i=0; i<N; i++){
    for(int j=0; j<2; j++){
      cin >> vec.at(i).at(j);
    }
  }
  
  double sum = 0;
  for(int i=0; i<N-1; i++){
    for(int j=i; j<N; j++){
      double x, y;
      x = abs(vec.at(i).at(0) - vec.at(j).at(0)) * abs(vec.at(i).at(0) - vec.at(j).at(0));
      y = abs(vec.at(i).at(1) - vec.at(j).at(1)) * abs(vec.at(i).at(1) - vec.at(j).at(1));
      sum += sqrt(x+y);
    }
  }
  cout << setprecision(20) << sum *2.0  / N << endl;
} 

Measured memory_bytes: 384
import sys

ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: [int(x) for x in ns().split()]
nall = lambda: [int(x) for x in sys.stdin.readlines()]
sall = lambda: [x.strip() for x in sys.stdin.readlines()]

def main():
    _ = ni()
    xs = sall()
    d = {}
    for x in xs:
        if x in d:
            d[x] = d[x] + 1
        else:
            d[x] = 1

    r = []
    m = 0
    for k, v in d.items():
        if v > m:
            r = [k]
            m = v
        elif v == m:
            r.append(k)

    r.sort()
    for v in r:
        print(v)


main()


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

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

    int d[n];
    for(int i = 0; i < n; i++)  cin >> d[i];

    bool judge = true;
    int res = d[0];

    int i;
    for(i = 1; i < n; i++){
        res -= 10;
        if(res < 0) break;
        res = max(res, d[i]);
    }

    if(i != n || res < 0)  judge = false;

    res = d[n-1];
    for(i = n-2; i >= 0; i--){
        res -= 10;
        if(res < 0) break;
        res = max(res, d[i]);
    }

    if(i != -1 || res < 0)  judge = false;

    if(judge)   cout << "yes" << endl;
    else        cout << "no" << endl;

    return 0;
}


Measured memory_bytes: 4240
integer N
integer,allocatable,dimension(:)::a
integer one,two,three
double precision::DP(0:301,0:301,0:301)
read*,N
allocate(a(n))
read*,a
one=0;two=0;three=0
do i=1,N
  if(a(i)==1)one=one+1
  if(a(i)==2)two=two+1
  if(a(i)==3)three=three+1
end do

DP=-1
DP(0,0,0)=0
print*,ans(one,two,three)

contains
recursive function ans(i,j,k) result(res)
  integer i,j,k
  double precision res
  if(DP(i,j,k)/=-1)then
    res=DP(i,j,k)
  else
    res=0
    if (i > 0) res =res + ans(i-1, j, k) * i
    if (j > 0) res =res + ans(i+1, j-1, k) * j
    if (k > 0) res =res + ans(i, j+1, k-1) * k
    res=res+N
    res=res*1.0/(i+j+k)
    DP(i,j,k)=res
  endif
end function ans
end

Measured memory_bytes: 215552
let () =
    let n = read_line () in
    let k = read_int () in
    let l = String.length n in
    let arr = Array.make l 0 in
    for i = 0 to l - 1 do
        arr.(i) <- int_of_char n.[i] - int_of_char '0'
    done;

    let rec loop i border_num c0 c1 c2 c3 =
        if i = l then (
            let c1 = if border_num = 1 then c1 + 1 else c1 in
            let c2 = if border_num = 2 then c2 + 1 else c2 in
            let c3 = if border_num = 3 then c3 + 1 else c3 in
            if k = 1 then c1 else if k = 2 then c2 else c3
        ) else
            loop (i + 1) (if arr.(i) <> 0 then border_num + 1 else border_num) 
            (c0 +                                                                 if border_num = 0 && arr.(i) > 0 then 1 else 0)
            (c1 + c0 * 9 + if border_num = 0 && arr.(i) > 0 then arr.(i) - 1 else if border_num = 1 && arr.(i) > 0 then 1 else 0)
            (c2 + c1 * 9 + if border_num = 1 && arr.(i) > 0 then arr.(i) - 1 else if border_num = 2 && arr.(i) > 0 then 1 else 0)
            (c3 + c2 * 9 + if border_num = 2 && arr.(i) > 0 then arr.(i) - 1 else if border_num = 3 && arr.(i) > 0 then 1 else 0)
    in
    loop 0 0 0 0 0 0 |> Printf.printf "%d\n"

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string s;
  cin >> s;
  bool ok = true;
  rep(i, s.size()) {
    if ((i+1) % 2) {
      if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D') {
        continue;
      }      
      ok = false;
    } else {
      if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D') {
        continue;
      }
      ok = false;
    }
  }
  string ans = ok ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v)                                                            \
  do {                                                                         \
    x = max(x, v);                                                             \
  } while (0)
#define chmin(x, v)                                                            \
  do {                                                                         \
    x = min(x, v);                                                             \
  } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

ll N;
ll m[10][10]; // m[front num][back num]

void f(ll x) {
  ll back_num = x % 10;
  while (x > 10)
    x /= 10;
  ll front_num;
  if (x == 10) {
    front_num = 1;
  } else {
    front_num = x;
  }

  m[front_num][back_num]++;
}

signed main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    f(i);
  }

  ll ans = 0;
  for (ll front_num = 1; front_num <= 9; front_num++) {
    for (ll back_num = 1; back_num <= 9; back_num++) {
      ans += m[front_num][back_num] * m[back_num][front_num];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rg register
#define rep(i,a,b) for (rg int i=(a);i<=(b);i++)
#define per(i,a,b) for (rg int i=(b);i>=(a);i--)
#define pb push_back
#define lowbit(x) (x&(-x))
#define mk make_pair
#define VI vector<int>
#define pii pair<int,int>
#define pLL pair<long long,long long>
#define fi first
#define se second
#define il inline
#define ll long long
#define db double
#define ld long double
#define inf 0x3f3f3f3f
#define getc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<15,stdin),p1==p2)?EOF:*p1++)
char buf[1<<15],*p1 = buf,*p2 = buf;
inline ll read(){
    #define num ch-'0'
    char ch;bool flag=0;ll res;
    while(!isdigit(ch=getc()))
    (ch=='-')&&(flag=true);
    for(res=num;isdigit(ch=getc());res=res*10ll+num);
    (flag)&&(res=-res);
    #undef num
    return res;
}
inline void write(ll x){
	if (x < 0) x = ~x + 1ll, putchar('-');
	if (x > 9) write(x / 10ll);
	putchar(x % 10ll + '0');
}
#define mid ((l + r)>>1)
#define ls (x<<1)
#define rs ((x<<1)|1)
#undef mid
#undef ls
#undef rs
void solve()
{
	ll S = read();
	int res1,res2;
	res1 = res2 = (int)sqrt(S);
	while(S>1ll*res1*res2)
	{
		if(res1>res2) res2++;
		else res1++;
	}
	ll tmp = 1ll*res1*res2-S;
	for(ll i = 1;i<=sqrt(tmp);i++)
	{
		if(tmp%i==0)
		{
			if(i<=1e9 && (tmp/i) <= 1e9)
			{
				printf("0 0 %d %d %d %d",res1,i,tmp/i,res2);
				return;
			}
		}
	}
	printf("0 0 %d 0 0 %d",res1,res2);
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("data.txt","r",stdin);
	#endif
//	int T = read();
//	while(T--)
	solve();
}

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

using namespace std;
using ll = long long;

const int N = 3e5 + 5;

mt19937 rnd(51515);

ll solve(ll a) 
{
  if (a == 1) return 1;
  return solve(a / 2) * 2 + 1;
}

main() {
#ifdef ONPC
  freopen("a.in", "r", stdin);
#endif
  ios :: sync_with_stdio(0);
  cin.tie(0);
  ll h;
  cin >> h;
  cout << solve(h);
  return 0;
}

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

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

class KMP{
  public:
    string s;
    string t;
    vector<int> T;
    KMP(string _s, string _t): s(_s),t(_t), T(s.size()){}

    void table(){
      int i = 2;
      int j = 0;
      T[0] = -1;
      T[1] = 0;
      while(i < t.size()){
        if(t[i-1] == t[j]){
          T[i] = ++j;++i;
        }else if(j>0){
          j = T[j];
        }else{
          T[i] = 0;
          i++;
        }
      }
    }

    int run(int st){
      int m = st;
      int i = 0;
//       cout << s.substr(m) << endl;

      while(m + i < s.size()){
        if(t[i] == s[m+i]){
          i++;
          if( i == t.size()){
            return m;
          }
        }else{
          m = m + i - T[i];
          if( i > 0) i = T[i];
        }
      }
      return s.size();
    }
};

const int MAX = 500000, MS = 2;
const ll mod[]={999999937LL, 1000000007LL}, base = 9973;
class RollingHash{
  public:
    int n;
    vector<ll> hs[MS], pw[MS];
    RollingHash(){}
    RollingHash(const string &s){
      n = s.size();
      rep(i,MS){
        hs[i].assign(n+1, 0);
        pw[i].assign(n+1, 0);
        hs[i][0] = 0;
        pw[i][0] = 1;
        rep(j, n){
          pw[i][j+1] = pw[i][j]*base %mod[i];
          hs[i][j+1] = (hs[i][j]*base+s[j])%mod[i];
        }
      }
    }
    ll hash(int l, int r, int i){
      if(r > n)return -1;
      return ((hs[i][r]-hs[i][l]*pw[i][r-l])%mod[i]+mod[i])%mod[i];
    }
    bool match(int l1, int r1, int l2, int r2){
      bool ret = 1;
      rep(i,MS){
        ret &= hash(l1, r1, i) == hash(l2, r2, i);
      }
      return ret;
    }

    bool match(int l, int r, ll h[]){
      bool ret = 1;
      rep(i,MS) ret&=hash(l,r,i)==h[i];
      return ret;
    }
};

int main(void){
  string t;
  string p;
  cin >> t;
  cin >> p;
  // t = 10^6
  // p = 10^4
  
  RollingHash rht(t);
  RollingHash rhp(p);
  ll ps[MS];
  rep(j,MS){
    ps[j] = rhp.hash(0, p.size(), j);
  }

  rep(i,t.size()){
    bool ok = true;
    rep(j, MS){
      ok &= rht.hash(i, i+p.size(), j) == ps[j];
    }
    if(ok){
      cout << i << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 35608
N = int(input())
counter = 0
qq = 0
L = []
for i in range(N) :
    if i == 0 :
        w = input()
        L.append(w)
        q = w[-1]
    if i != 0 :
        w = input()
        if w in L :
            qq += 1
        L.append(w)
        p = w[0]
        if p == q :
            q = w[-1]
            counter += 1

            
            
if counter == N-1 and qq == 0 :
    print("Yes")
else :
    print("No")



Measured memory_bytes: 3064
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	a := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}
	
	set := make(map[int]struct{})
	max := int(math.Pow(2, float64(n)))
	for i := 1; i <= max; i++ {
		sum := 0
		for j := 0; j < n; j++ {
			if (i >> uint(j)) & 1 != 0 {
				sum += a[j]
			}
		}
		set[sum] = struct{}{}
	}

	sc.Scan()
	q, _ := strconv.Atoi(sc.Text())
	for i := 0; i < q; i++ {
		sc.Scan()
		m, _ := strconv.Atoi(sc.Text())

		if _, ok := set[m]; ok {
			fmt.Println("yes")
		} else {
			fmt.Println("no")
		}
	}
}



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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

int N;
vint G[111111];

int dp[111111];
void dfs(int v,int p){
    int &X=dp[v];
    for(auto u:G[v]){
        if(u==p)continue;
        dfs(u,v);
        X^=dp[u];
    }

    if(p!=-1)X++;
}

signed main(){
    cin>>N;
    rep(i,N-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].pb(b);G[b].pb(a);
    }

    dfs(0,-1);
    if(dp[0])cout<<"Alice"<<endl;
    else cout<<"Bob"<<endl;
    return 0;
}


Measured memory_bytes: 11392
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

long long gcd(long long a,long long b){
	long long x=max(a,b),y=min(a,b);
	if(x%y==0){
		return y;
	}else{
		return gcd(y,x%y);
	}
}

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

int main(){
	
	long long n;
	cin >> n;
	vector<long long> a(n);
	
	long long g;
	
	for(long long i=0;i<n;i++){
		cin >> a[i];
		if(i==0){
			g=a[0];
		}else{
			g=gcd(g,a[i]);
		}
	}
	
	if(g>1){
		cout << "not coprime" << endl;
		return 0;
	}
	
	sort(a.begin(),a.end());
	
	long long t_size=*max_element(a.begin(),a.end());
	t_size+=10;
	vector<long long> table(t_size,0);
	
	for(long long i=0;i<n;i++){
		for(long long j=1;j*j<=a[i];j++){
			if(a[i]%j==0){
				table[j]++;
				if(table[j]>1 && j!=1){
					//cout << j << " : " << table[j] << endl;
					cout << "setwise coprime" << endl;
					return 0;
				}
				if(a[i]/j!=j){
					table[a[i]/j]++;
					if(table[a[i]/j]>1){
						//cout << table[a[i]/j] << endl;
						cout << "setwise coprime" << endl;
						return 0;
					}
				}
			}
		}
	}
	cout << "pairwise coprime" << endl;
	return 0;
}


Measured memory_bytes: 18736
package main 

import (
  "fmt"
)

func main() {
  var a, b int
  fmt.Scanln(&a, &b)
  max := a + b
  if a * b >= max {
    max = a * b 
  }
  if a - b >= max {
    max = a - b
  }
  fmt.Println(max)
}
    
    

Measured memory_bytes: 512
#include<iostream>
#include<utility>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	pair<double,double> pa[2],pb[2];
	while(cin>>pa[0].first>>pa[0].second){
		cin>>pa[1].first>>pa[1].second;
		rep(i,2)cin>>pb[i].first>>pb[i].second;
		bool check1=(max(pa[0].first,pa[1].first)<min(pb[0].first,pb[1].first) || max(pb[0].first,pb[1].first)<min(pa[0].first,pa[1].first) );
		bool check2=(max(pa[0].second,pa[1].second)<min(pb[0].second,pb[1].second) || max(pb[0].second,pb[1].second)<min(pa[0].second,pa[1].second) );
		if(check1 || check2)cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1216
def ftime x
    t, h = x.divmod 3600
    h, s = h.divmod 60
    sprintf("%02d:%02d:%02d", t, h, s)
end

while true
    line = gets.chomp
    break if line == "-1 -1 -1"

    t, h, s = line.split.map(&:to_i)
    rest = 7200 - (t * 3600 + h * 60 + s)
    rest3 = rest * 3
    puts ftime(rest)
    puts ftime(rest3)
end


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

int main() {
    string S; cin >> S;
    char a, b, c, d;
    a = S[2];
    b = S[3];
    c = S[4];
    d = S[5];
    string ans = "No";
    if(a == b && c == d){
        ans = "Yes";
    }
    cout << ans << endl;
}

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

struct Magic {
  int atk;
  int mp;
};

int main() {
  int H, N;
  cin >> H >> N;
  vector<Magic> M(N);
  rep(i, N) {
    int a, b;
    cin >> a >> b;
    M.at(i) = {a, b};
  }

  vector<int> dp(H + 1, -1);
  dp.at(H) = 0;

  for (int hp = H; hp >= 1; hp--) {
    if (dp.at(hp) < 0) continue;

#ifdef DEBUG
    cout << "HP=" << hp << ",dp=" << dp.at(hp) << endl;
#endif

    rep(j, N) {
      int x = max(0, hp - M.at(j).atk);
      int tmp = dp.at(hp) + M.at(j).mp;
      if (dp.at(x) < 0) {
        dp.at(x) = tmp;
      } else {
        dp.at(x) = min(dp.at(x), tmp);
      }
#ifdef DEBUG
      cout << "  x=" << x << ", dp=" << dp.at(x) << endl;
#endif
    }
  }

  cout << dp.at(0) << endl;
  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll now = 100;
    ll ans = 0;
    while(now<x){
        now = now + (now/100);
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vll = vector<vector<ll> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using the = pair<int, int>;
using lthe = pair<ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,1,0,-1 };

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

    char t = s[0];
    int ans = 0;
    for (int i = 1; i < s.size(); i++) {
        if (t != s[i]) {
            ans++;
            if (s[i] == 'W') {
                t = 'W';
            }
            else {
                t = 'B';
            }
        }
       // cout << t << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
'use strict'

const main = (input) => {
    input = input.split('\n')
    const H = parseInt(input[0].split(' ')[0])
    const W = parseInt(input[0].split(' ')[1])
    let arr = input.slice(1, H + 1)
    arr = arr.map(v => '#' + v + '#')
    let str = ''
    for(let i = 0; i < W + 2; i++){
        str += '#'
    }
    arr.unshift(str)
    arr.push(str)
    arr.forEach(v => {
        console.log(v)
    })
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

int main() {
  long long int L, R;
  cin >> L >> R;

  if(R > L + 2019) {
    R = L + 2019;
  }

  int min = 2019;

  for(long long int i=L;i<R;i++) {
    for(long long int j=i+1;j<=R;j++) {
      long long int value = i * j;
      if(value % 2019 < min) {
        min = value % 2019;
      }
    }
  }

  cout << min << endl;

  return 0;
}

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

public class Main {

	private static Scanner in;
	
	private static int n;
	private static int[] a;
	private static double[][][] dp;
	private static final int MOD = (int)1e9+7;
	
	public static void main(String[] args) {
		in = new Scanner(System.in);
		n = in.nextInt();
		a =  new int[n];
		for(int i=0; i<n; i++) {
			a[i] = in.nextInt();
		}
		
		dp = new double[n+1][n+1][n+1];
		
		for(int i=0; i<dp.length; i++)
			for(int j=0; j<dp[0].length; j++)
				Arrays.fill(dp[i][j], -1);
		
		int x, y, z;
		x=y=z=0;
		
		for(int i=0; i<n; i++) {
			if (a[i]==1) x++;
			else if (a[i]==2) y++;
			else if (a[i]==3) z++;
		}
		
		System.out.println(solve(x, y, z));
	
	}
	
	private static double solve(int x, int y, int z) {
		if (x<0 || y<0 || z<0) return 0;
		if (x+y+z==0) return 0;
		
		if (dp[x][y][z]!=-1) return dp[x][y][z];
		
		double alpha = (double)x*(1+solve(x-1, y, z))/n + (double)y*(1+solve(x+1, y-1, z))/n + (double)z*(1+solve(x, y+1, z-1))/n+1-(double)(x+y+z)/n;
		double ans = (double)n/(x+y+z)*alpha;
	
		return dp[x][y][z]=ans;
	}

}


Measured memory_bytes: 306260
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
  
 int main()
 {
   string a,b;
   while(getline(cin,a))
   {
     for(int shift=0;shift<26;shift++)
     {
       b="";
       for(int i=0;i<a.length();i++)
       {
         if(a[i]>='a'&&a[i]<='z')
         { 
           if(a[i]+shift>'z') b+=(a[i]+(shift-26));
           else b+=(a[i]+shift);
         }         
         else b+=a[i]; 
       }
       if(b.find("the")!=string::npos||b.find("this")!=string::npos||b.find("that")!=string::npos) break;
       else continue;
     }             
     cout<<b<<endl;
   }
   //while(1);      
   return 0;    
 }

 

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

int main(){
    string s;
    int Q;
    cin >> s >>Q;
    deque <char> st;
    rp(i,s.size()){
        st.push_back(s.at(i));
    }
    bool order=true;
    rp(i,Q){
        int t;
        cin >> t;
        if(t==1){
            if(order) order=false;
            else order=true;
        }
        if(t==2){
            int f; char c;
            cin >> f >> c;
            if((order&&f==1)||(!order&&f==2))
            st.push_front(c);
            else
            st.push_back(c);
        }
    }
    if(order){
        rp(i,st.size()){
        cout << st.at(i);
        }
    }
    else{
        reverse(st.begin(),st.end());
        rp(i,st.size()) cout << st.at(i);
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 896
package main

import (
	"fmt"
	"math"
)

type shop struct {
	openTimes []int
	profits   []int
}

func (s shop) calcProfit(open []int) int {
	sameCount := 0
	for i := 0; i < 10; i++ {
		if s.openTimes[i] == 1 && open[i] == 1 {
			sameCount++
		}
	}
	return s.profits[sameCount]
}

func main() {
	var N int
	fmt.Scan(&N)

	shopOpenTimes := make([][]int, N)
	for i := 0; i < N; i++ {
		ot := make([]int, 10, 10)
		for j := 0; j < 10; j++ {
			fmt.Scan(&ot[j])
		}
		shopOpenTimes[i] = ot
	}

	shopProfits := make([][]int, N)
	for i := 0; i < N; i++ {
		p := make([]int, 11, 11)
		for j := 0; j < 11; j++ {
			fmt.Scan(&p[j])
		}
		shopProfits[i] = p
	}

	shops := make([]shop, N)
	for i := 0; i < N; i++ {
		s := shop{openTimes: shopOpenTimes[i], profits: shopProfits[i]}
		shops[i] = s
	}

	max := math.MinInt32
	for i := 1; i < (1 << uint(10)); i++ {
		open := make([]int, 10)
		for j := 0; j < 10; j++ {
			if i&(1<<uint(j)) > 0 {
				open[j] = 1
			} else {
				open[j] = 0
			}
		}

		sum := 0
		for _, s := range shops {
			sum += s.calcProfit(open)
		}

		if max < sum {
			max = sum
		}
	}

	fmt.Println(max)
}


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

int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < vec.size(); i++){
    cin >> vec.at(i);
  }
  int c = 0,max=0;
  int sum1 = 0,sum2 = 0;
  while(c < N){
    max = 0;
    for(int i = 0; i < vec.size()-1;i++){
      if(vec.at(i) > vec.at(i+1)){
        int tmp = vec.at(i);
        vec.at(i) = vec.at(i+1);
        vec.at(i+1) = tmp;
      }
    }
    max = vec.at(vec.size()-1);
    vec.pop_back();
    if(c % 2 == 0){
      sum1 += max;
    }else{
      sum2 += max;
    }
    c++;
  }
  cout << sum1 - sum2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, n, w, ans = 0, count = 0;
  string s, t = "";
  vector<pair<string, pair<lli, lli>>> pr;
  cin >> s;
  n = s.size();
  rep(i, 0, n)
  {
    if (s[i] == '0')
    {
      t += '0';
    }
    else if (s[i] == '1')
    {
      t += '1';
    }
    else
    {
      if (t.size())
      {
        t.pop_back();
      }
    }
  }
  cout << t << endl;
}

Measured memory_bytes: 3628
// https://atcoder.jp/contests/abc089/tasks/abc089_c

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (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 INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

ll N, m[5] = {0}, r = 0;
char S[10];

void add(int a, int b, int c)
{
  r += m[a] * m[b] * m[c];
}

int main()
{
  cin >> N;
  REP(i, N)
  {
    cin >> S;
    switch (S[0])
    {
    case 'M':
      m[0]++;
      break;
    case 'A':
      m[1]++;
      break;
    case 'R':
      m[2]++;
      break;
    case 'C':
      m[3]++;
      break;
    case 'H':
      m[4]++;
      break;
    default:
      break;
    }
  }

  REP(i, 5)
  {
    FOR(j, i + 1, 5)
    {
      FOR(k, j + 1, 5)
      {
        add(i, j, k);
      }
    }
  }

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int A,B,K;
    cin>>A>>B>>K;
    for(int i=A;i<=B;i++){
        if(i<A+K||i>B-K)cout<<i<<endl;
    }
}

Measured memory_bytes: 256
def partition(A, p, r):
    x = A[r][1]
    i = p - 1
    for j in range(p, r):
        if A[j][1] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1

def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        # 左半分
        quick_sort(A, p, q - 1)
        # 右半分
        quick_sort(A, q + 1, r)
n = int(input())
A = []
for _ in range(n):
    a, b = input().split()
    A.append((a, int(b)))
ind = dict((e, i) for i, e in enumerate(A))
quick_sort(A, 0, n - 1)
for i in range(n - 1):
    if A[i][1] == A[i + 1][1]:
        if ind[A[i]] > ind[A[i + 1]]:
            print('Not stable')
            break
else:
    print('Stable')
for i in A:
    print(*i)


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

using namespace std;

const int mxn = 1e5;

int a[mxn + 11];

int main(){
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", a + i);
	}
	int ans = 1;
	int cur = 1;
	for (int i = 1; i < n; i++){
		if (a[i - 1] >= a[i])
			cur++;
		else 
			cur = 1;
		ans = max(ans, cur);
	}
	printf("%d\n", ans - 1);
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for(int (i) = 0; (i) < (n); (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 INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{	
	string s;
	cin >> s;
	int minimum = INF;

	REP(i, s.size() - 2){
		int tmp = abs(stoi(s.substr(i, 3)) - 753);
		minimum = min(minimum, tmp);
	}
	cout << minimum << endl;
}


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

int main()
{
    ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

    int x;
    
    cin >> x;
    
    if(x==0)
    {
        cout << 1;
    }
    
    else
    {
        cout << 0;
    }






}









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

const int MAX_N = 101;
int w, h;
char G[MAX_N][MAX_N];

bool dfs(int x, int y, char c) {
  bool isOver = (x==0||x==w-1||y==0||y==h-1);
  G[y][x] = c;
  for(int d = -1; d <= 1; d += 2) {
    for(int i = 0; i < 2; ++i) {
      int nx = x;
      int ny = y;
      if(i) nx += d;
      else  ny += d;
      if(nx < 0 || nx >= w) continue;
      if(ny < 0 || ny >= h) continue;
      if(G[ny][nx] == c) continue;
      isOver = isOver || dfs(nx,ny,c);
    }
  }
  return isOver;
}

int solve(int x, int y) {
  int t;
  for(t = 0; !dfs(x,y,'#'); dfs(x,y,'.'),++t);
  return t;
}

int main() {
  while(cin >> w >> h && (w|h)) {
    int x, y;
    for(int i = 0; i < h; ++i) {
      for(int j = 0; j < w; ++j) {
	cin >> G[i][j];
	if(G[i][j] == '&') {
	  x = j;
	  y = i;
	  G[i][j] = '.';
	}
      }
    }
    cout << solve(x,y) << endl;
  }
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  string a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int m;
  cin >> m;
  string b[m];
  for(int i=0;i<m;i++){
    cin >> b[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    int count=0;
    for(int j=0;j<n;j++){
      if(a[i]==a[j]){
        count++;
      }
    }
    for(int j=0;j<m;j++){
      if(a[i]==b[j]){
        count--;
      }
    }
    ans=max(ans,count);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
n,w=map(int,input().split())
w_sub,v_sub=map(int,input().split())
w0=w_sub
inf=1000000001
x=[[inf,v_sub],[inf],[inf],[inf]]
for i in range(n-1):
    w_sub,v_sub=map(int,input().split())
    z=w_sub-w0
    x[z].append(v_sub)
for i in range(4):
    x[i].sort(key=lambda x:-x)
    x[i][0]=0
    l_sub=len(x[i])
    for j in range(1,l_sub):
        x[i][j]+=x[i][j-1]

ma=0
l3=len(x[3])
l2=len(x[2])
l1=len(x[1])
l0=len(x[0])
for i in range(l3):
    for j in range(l2):
        d=w-i*(w0+3)-j*(w0+2)
        if d>=0:
            for k in range(l1):
                d=w-i*(w0+3)-j*(w0+2)-k*(w0+1)
                if d>=0:
                    ma=max(ma,x[3][i]+x[2][j]+x[1][k]+x[0][min(d//w0,l0-1)])
                else:
                    break
        else:
            break

print(ma)


Measured memory_bytes: 3188
S = input()
l = len(S)
ans='Yes'
if S!=S[::-1]:
  ans='No'
if S[:(l-1)//2:]!=S[:(l-1)//2:][::-1]:
  ans='No'
if S[(l+3)//2-1::]!=S[(l+3)//2-1::][::-1]:
  ans='No'
  
print(ans)

Measured memory_bytes: 3060
def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            # 答えは1つ出力すれば良いので =7 になれば終了
            print(f + "=7")
            exit()

    else:
        # 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
        dfs(i + 1, f + "+" + s[i + 1], sum + int(s[i + 1]))
        dfs(i + 1, f + "-" + s[i + 1], sum - int(s[i + 1]))

s = input()

dfs(0, s[0], int(s[0]))


Measured memory_bytes: 3060
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var (
		s  string
		s1 int64
		s2 int64
		s3 int64
	)

	fmt.Scan(&s)

	a, _ := strconv.ParseInt(s, 2, 0)
	s1 = a / 4
	s2 = (a - s1*4) / 2
	s3 = (a - s1*4 - s2*2) % 2
	fmt.Println(s1 + s2 + s3)
}


Measured memory_bytes: 1768
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 while(1){
  ll n;
  cin>>n;
  if(n==0)break;
  vector<ll> w(n);
  for(ll i=0;i<n;i++){
   cin>>w[i];
  }
  vector<vector<bool> > take( n , vector<bool>(n,false) );
  for(ll i=0;i+1<n;i++){
   if( abs(w[i]-w[i+1]) <= 1 ) take[i][i+1] = true;
  }
  
  for(ll l=3;l<n;l+=2){
   for(ll i=0;i+l<n;i++){
    if( take[i+1][i+l-1] && abs(w[i]-w[i+l])<=1 ){
     take[i][i+l] = true;
    }
     
     for(ll j=i ; j+1<i+l;j++ ){
      if( take[i][j] && take[j+1][i+l] ){
       take[i][i+l] = true;
       break;
      }
     }


   }
  }
/*
  for(ll i=0;i<n;i++){
   for(ll j=i+1;j<n;j++)if(take[i][j])cout<<1<<' ';
   else cout<<0<<' ';
   cout<<endl;
  }
*/
  vector<ll> dp(n,0);
  for(ll i=0;i<n;i++){
   if( take[0][i] ) dp[i] = i+1;
  }
  for(ll i=1;i<n;i++){
   dp[i] = max(dp[i],dp[i-1]);
   for(ll j=i;j>=1;j--){
    if( take[j][i] ) dp[i] = max( dp[i] , dp[j-1] + i-j+1 );
   }
  }
  cout<<dp[n-1]<<endl;

 }
    return 0;
}



Measured memory_bytes: 3196
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    int o = k / 2;
    int e = k - o;

    cout << o * e << endl;

    return 0;
}


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

int prime(int a,int b,int c,int d) {
	for (int e = 3;; e += 2) {
		if (a%e==0 ||b%e==0 ||c%e==0 ||d%e==0)return false;
		if ((e + 1)*(e + 1) > d)return true;
	}
}
int main() {
	while (1) {
		int a;
		cin >>a;
		if (a == 0)break;
		int b = a - (a % 6) + 1;
		if (a % 6 == 0)b = a - 5;
		for (;; b -= 6) {
			if (prime(b, b - 2, b - 6, b - 8)) { cout << b <<endl; break; }
		}
	}
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
intt gcd(intt a, intt b) {return b ? gcd(b, a % b) : a;}
intt lcm(intt a, intt b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = ((res) * (a))%mod;
      a = ((a) * (a))%mod;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}
void go()
{
#ifndef ONLINE_JUDGE
  freopen("ino.txt","r",stdin);
  freopen("onc.txt","w",stdout);
  #endif
}


int main(){

   // go();
    fast_io
    int n,x,t;cin>>n>>x>>t;
    if(n%x==0)
    cout << (n/x)*t <<"\n";
    else
    cout << ((n/x)+1)*t<<"\n";
 
}



/*
3
17
4
*/






















Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        final List<String> numbers = new LinkedList<String>();

        final int n = Integer.parseInt(reader.readLine());

        String line;
        for (int i = 0; i < n; ++i) {
            line = reader.readLine();
            if ('i' == line.charAt(0)) {
                numbers.add(line.substring(7));

            }else if ('F' == line.charAt(6)) {
                numbers.remove(numbers.size()-1);

            } else if ('L' == line.charAt(6)) {
                numbers.remove(0);

            } else {
                final int index = numbers.lastIndexOf(line.substring(7));
                if (index != -1) numbers.remove(numbers.lastIndexOf(line.substring(7)));
            }
        }

        final StringBuilder answer = new StringBuilder();
        final int listSize = numbers.size() - 1;
        for (int i = 0; i < listSize; ++i) {
            answer.append(numbers.remove(numbers.size()-1)).append(" ");
        }
        answer.append(numbers.remove(0));

        System.out.println(answer.toString());
    }
}

Measured memory_bytes: 204220
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

A, B = map(int, input().split())

if A >= 13:
    print(B)
elif A >= 6:
    print(B // 2)
else:
    print(0)



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

using namespace std;
using ll = long long;
using ld = long double;

bool set_bit(int i, int j){
    return (1&(i>>j)) == 1;
}

int main(){
    int n;
    cin>>n;
    int i = 1;
    vector<vector<pair<int,int>>> vp(n);
    for(int i=0; i<n; i++){
        int a; cin>>a;
        for(int j=0; j<a; j++){
            int x,y; cin>>x>>y;
            vp[i].push_back({x,y});
        }
    }
    int cnt = 0;
    while(i < 1<<n){
        //cerr<<i<<endl;
        bool pos = true;
        int tempans = 0;
        for(int j=0; j<n; j++) {
            if(set_bit(i, j)){
                tempans++;
                for(auto &p: vp[j]){
                    if(p.second == 0){
                        if(set_bit(i, p.first-1)) pos = false;
                    }
                    else{
                        if(!set_bit(i, p.first-1)) pos = false;
                    }
                }
                if(!pos) break;
            }
        }
        if(pos) cnt = max(cnt, tempans);
        i++;

    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int n;
  	cin >> n;
  	int a[n];
  	int sum = 0;
  	for(int i = 0 ; i < n ; i++){
     	cin >> a[i];
      	sum += a[i];
    }
  	int m;
  	cin >> m;
  	for(int i = 0 ; i < m ; i++)
    {
      	int p , x;
      	cin >> p >> x;
      	cout << sum - a[p - 1] + x << endl;
    }
 	return 0; 
}

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

int main(){
    int N;
    cin >> N;
    vector <int> vec(N);
    for (int i = 0; i < N; i++) {
        cin >> vec[i];
    }
    sort (vec.begin(), vec.end());
    cout << vec[N - 1] - vec[0] << endl;
}


Measured memory_bytes: 256
A, B, C, X, Y = list(map(int, input().split()))
a, b, c = 0, 0, 0
if(A + B <= 2*C):
    a, b = X, Y
else:
    c = min(X, Y) * 2
    if(X > Y):
        if(A > 2*C):
            c += (X - Y) * 2
        else:
            a = (X - Y)
    else:
        if(B > 2*C):
            c += (Y - X) * 2
        else:
            b = (Y - X)


price = a*A + b*B + c*C
print(price)



Measured memory_bytes: 3064
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n], y = new int[n], h = new int[n];
        for(int i = 0; i < n; i++){
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
            h[i] = sc.nextInt();
        }
        for(int X = 0; X <= 100 ; X++){
            for(int Y = 0; Y <= 100; Y++){
                boolean flg = true;
                int H =0;
                for(int i = 0; i < n; i++){
                    if(h[i] != 0){
                        H = Math.abs(x[i] - X) + Math.abs(y[i] - Y) + h[i];
                    }
                }
                for(int i = 0; i < n; i++){
                    if(h[i] != 0){
                        if(H != Math.abs(x[i] - X) + Math.abs(y[i] - Y) + h[i])
                        flg = false;
                    }else{
                        if(H > Math.abs(x[i] - X) + Math.abs(y[i] - Y))
                        flg = false;
                    }
                }
                if(flg){
                    System.out.println(X + " " + Y + " " + H);
                }
            }
        }
    }
}

Measured memory_bytes: 24148
A,B,K = map(int,input().split())

als = []
bls = []

for a in range(1,A+1):
  if A%a == 0:
    als.append(a)
for b in range(1,B+1):
  if B%b == 0:
    bls.append(b)

common = []

for a in als:
  if a in bls:
    common.append(a)

common.sort()
print(common[-K])


Measured memory_bytes: 3060
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;


int main(){
  int n; cin >> n;
  int res = 1;
  while(true){
    if(res * 2 > n) break;
    res *= 2;
  }
  cout << res << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        // code goes here
        int n = nextInt(br);
        int[] arr = nextIntArray(br, n);
        long sum = 0;
        int max = arr[0];
        for(int i = 1; i < n; i++){
            if(arr[i] < max){
                sum += max - arr[i];
            }
            max = Math.max(max, arr[i]);
        }
        sb.append(sum);
        System.out.print(sb.toString());
    }

    private static int nextInt(BufferedReader br) throws IOException{
        return Integer.parseInt(br.readLine());
    }

    private static int[] nextIntArray(BufferedReader br, int n) throws IOException{
        StringTokenizer st = new StringTokenizer(br.readLine());
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = Integer.parseInt(st.nextToken());
        }
        return arr;
    }

    static class Pair<A, B>{
        A first;
        B second;
        public Pair(A first, B second){
            this.first = first;
            this.second = second;
        }
    }
}


Measured memory_bytes: 55208
n = int(input())

info = [[] for _ in range(0,n+1)]

for i in range(1,n):
    u,v,w = map(int,input().split())
    info[u].append([v,w])
    info[v].append([u,w])
    #print(info)

#print(info)

frt = [1]
dis = [0] * (n+1)

while frt != []:
    x = frt.pop()
    for j in range(0,len(info[x])):
        dis[info[x][j][0]] = dis[x] + info[x][j][1]
        info[info[x][j][0]].remove([x,info[x][j][1]])
        frt.append(info[x][j][0])

for k in range(1,n+1):

    if dis[k] % 2 ==0:
        print(0)
    else:
        print(1)

Measured memory_bytes: 48964
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
vector<string> S;
void dfs(string s,int k){
    if(s.length()==k){
        S.push_back(s);
        return ;
    }
    char max = 'a';
    rep(i,s.length()){
        if(s[i]>=max){
            max = s[i];
        }
    }
    //cout<<s<<" "<<char(max+1)<<endl;
    for(char c = 'a';c<='j';c++){
        if(c<=char(max+1)){
            dfs(s+c,k);
            //cout<<"DFS:"<<s+c<<endl;
        }
    }

}
int main(){
    int n;
    cin>>n;
    /*
    char c;
    cin>>c;
    cout<<char(c+1)<<endl;
    */
    dfs("a",n);
    int l = S.size();
    rep(i,l){
        cout<<S[i]<<endl;
    }
}

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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve_main()
{
   	int n,r;cin>>n>>r;
   	if(n>=10)cout<<r<<"\n";
   	else
   	{
   		cout<<	r + (100 * (10-n));
   	}
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

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

signed main(){
  int N;
  cin>>N;
  vector<int> A(N);
  rep(i,N)cin>>A[i];
  int ans=0,now=A[0];
  for(int i=1;i<N;i++){
    if(A[i]>now){
      now=A[i];
      continue;
    }
    if(A[i]<now)ans+=now-A[i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4824
#include<stdio.h>
int main(void){
    int n, h[100], i, j, s=0, t;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&h[i]);
    for(i=0;i<n;i++){
        t=0;
        for(j=0;j<i;j++) if(h[i]<h[j]) t+=1;
        if(t==0) s+=1;
    }
    printf("%d\n",s);
    return 0;
}

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

using namespace std;

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<pair<int,int>> v;

    for(int i=0 ;i<n;i++)
    {
        int d1 , d2;
        cin>>d1>>d2;
        v.push_back({d1,d2});
    }


    int flag =0;

    for(int i=0 ;i<n-2;i++)
    {
        if((v[i].first == v[i].second)&&(v[i+1].first==v[i+1].second)&&(v[i+2].first==v[i+2].second))
        {
            flag =1;
            break;
        }
    }

    if(flag ==1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    

}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int n,k,g,x,t;
int main()
{
    cin>>n>>k>>g;
	t=g;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		t=max(t,x);
		g=__gcd(g,x);
	}
    if(k%g||k>t)
		cout<<"IMPOSSIBLE"<<endl;
	else
		cout<<"POSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include "bits/stdc++.h"
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,K;
	scan(N>>K);
	ld ans=0;
	rep1(i,N){
		ll now=i;
		ll bunbo=1;
		while(now<K){
			now*=2;
			bunbo*=2;
		}
		ans+=(ld)1.0/bunbo;
	}
	ans/=N;
	prin(setprecision(20)<<ans);
	return 0;
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vz;
typedef vector<vz> vvz;
typedef pair<ll, ll> pll;
#define sz(x) ll((x).size())
#define fo(i,n) for(ll i=0; i<(n); i++)
#define FO(i,a,b) for(ll i=(a); i!=(b); i+=(b)>(a)?1:-1)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(c) c.begin(), c.end()
#define F first
#define S second
#define os(x) cout<<x<<' '
#define on(x) cout<<x<<"\n"
#define nl cout<<"\n"
#define maxe(x) max_element(all(x))-(x).begin()
#define mine(x) min_element(all(x))-(x).begin()
const ll P=1e9+7;
const ll N=1e6;
ll gcd(ll a, ll b)
{
	ll m=min(a, b), M=max(a, b);
	if(m==0) return M;
	return gcd(m, M%m);
}

ll powmod(ll x, ll y)
{
	ll ans=1;
	while(y>0)
	{
		if(y%2) ans=(ans*x)%P;

		x=(x*x)%P;
		y/=2;
	}
	return ans;
}

vll divs(N+1, 0);
void sieve(){
	for(ll i=1; i<N+1; i++){
		for(ll j=i; j<N+1; j+=i){
			divs[j]++;
		}
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\ASISH\\Desktop\\coding\\input1.txt", "r", stdin);
	freopen("C:\\Users\\ASISH\\Desktop\\coding\\output1.txt", "w", stdout);
#endif

	ll n, ans=0;
	cin>>n;
	sieve();
	for(int i=1; i<n; i++){
		ans+=divs[n-i];
	}
	on(ans);
	cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "s\n";
	return 0;
}

Measured memory_bytes: 11028