akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main (void)
{
	int a,b,c;
	scanf("%d%d%d\n",&a,&b,&c);
	
	if(a<=b && b<=c)
	{
		printf("%d %d %d\n",a,b,c);
	}
	else if(a<=c && c<=b)
	{
		printf("%d %d %d\n",a,c,b);
	}
	else if(b<=a && a<=c)
	{
		printf("%d %d %d\n",b,a,c);
	}
	else if(b<=c && c<=a)
	{
		printf("%d %d %d\n",b,c,a);
	}
	else if(c<=a && a<=b)
	{
		printf("%d %d %d\n",c,a,b);
	}
	else if(c<=b && b<=a)
	{
		printf("%d %d %d\n",c,b,a);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
int main(){
    int n;cin >> n;
    vector<pair<string, int> > pv;
    map<pair<string, int>, int> mp;
    map<string, int> cnt;
    for(int i = 0; i < n; i++){
        pair<string, int> p;
        cin >> p.first >> p.second;
        mp[p] = i;
        pv.push_back(p);
        cnt[p.first]++;
    }
    sort(pv.begin(), pv.end());

    for(int i = 0; i < n; i++){

        // for(int j = i + 1; j < n - 1; j++ ){
        //     if(pv[i].first == pv[j].first){
        //         cnt++;
        //     }else{
        //         break;
        //     }
        // }
        //         cout << cnt << endl;
        // for(int m = cnt; m > 0; m--){
        //     cout << mp[pv[i+m]] << " "<< pv[i+m].first << " " << pv[i+m].second << endl;
        // }

        //i = i + cnt;
        //cout << mp[pv[i]] << endl;
        for(int j = i + cnt[pv[i].first]; j > i; j--){
           // cout << "j= " << j << endl;
            cout << mp[pv[j-1]] + 1 << endl;
        }
        i += (cnt[pv[i].first] - 1);
        //cout << "i = "<< i << endl;
        //cout << mp[pv[i]] + 1 << " "<< pv[i].first << " " << pv[i].second << endl;
    }
    
}

Measured memory_bytes: 256
n = int(input())
A = []
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        if n//i!=i:
            A.append((i,n//i))
        else:
            A.append((i,i))
ans = float('inf')
for a,b in A:
    a-=1
    b-=1
    ans = min(ans, a+b)
# print(A)
print(ans)

Measured memory_bytes: 65644
#include <iostream>

using namespace std;
int main(void) {
    int A, B, C;
    cin >> A >> B >> C;
    if((A > C && B < C) || (A < C && B > C)) {
        cout << "Yes" << endl;
    } else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stack>
#include <cmath>
#include <string>
#include <algorithm>
#include <stack>
#include <vector>
#include <iomanip>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
#define pb push_back
#define ld long double
const ll N = 100005;
const int inf = 1e9;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, k, c;
    cin >> c >> n >> k;
    for(int i = n; i <= k; i++) {
        if (i%c == 0) {
            cout << "OK\n";
            return 0;
        }
    }
    cout << "NG\n";
    return 0;
}


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

#define endl "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define deb(x) cerr << #x << " => " << x << "\n"
#define deba(x) cerr << #x << "\n"; for (auto a : x) cerr << a << " "; cerr << "\n";
#define debm(x) cerr << #x << "\n"; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << "\n";}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)

int fastpow(int a, int b, int m) {
    int res = 1; a %= m; while (b > 0) {
        if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1;
    } return res;
}

int32_t main() { fastio;
    
    int k, n;
    cin >> k >> n;
    int arr[2 * n];
    for (int i = 0; i < n; i++) {
    	cin >> arr[i];
    	arr[i + n] = arr[i];
    }
    int pref[2 * n];
    pref[0] = 0;
    for (int i = 1; i < 2 * n; i++) {
    	int diff = arr[i] - arr[i - 1];
    	if (diff < 0) {
    		diff += k;
    	}
    	pref[i] = pref[i - 1] + diff;
    }
    int ans = INF;
    for (int i = n - 1; i < 2 * n; i++) {
    	ans = min(ans, pref[i] - pref[i - n + 1]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

void solve()
{
    double a,b,x;cin>>a>>b>>x;
    double tem;
    if(x<=a*a*b/2)
    {
        tem=x;
        tem=tem*2/a/b;
        tem=atan(b/tem);
        cout<<fixed<<setprecision(10)<<tem/PI*180<<endl;
    }else
    {
        tem=a*a*b-x;
        tem=tem*2/a/a;
        tem=atan(tem/a);
        cout<<fixed<<setprecision(10)<<tem/PI*180<<endl;
    }
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<queue>
using namespace std;
static const int N = 100;
static const int INFTY = (1 << 21);
int n, M[N][N];
int d[N];
void bfs(int s) {
    queue<int>q;
    q.push(s);
    for (int i = 0; i < n; i++)d[i] = INFTY;
    d[s] = 0;
    int u;
    while (!q.empty()) {
        u = q.front(); q.pop();
        for (int v = 0; v < n; v++) {
            if (M[u][v] == 0)continue;
            if (d[v] != INFTY)continue;
            d[v] = d[u] + 1;
            q.push(v);
        }
    }
    for (int i = 0; i < n; i++) {
        cout << i + 1 << " " << ((d[i] == INFTY) ? (-1) : d[i]) << endl;
    }
}
int main() {
    int u, k, v;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            M[i][j] = 0;
        }
    }
    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        u--;
        for (int j = 0; j < k; j++) {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }
    bfs(0);
    return 0;
}


Measured memory_bytes: 3164
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
    int minv;
    int dmax=-2000000000;
    int var;
    int n;
    scanf("%d",&n);
    scanf("%d",&minv);
    for(int i=1;i<n;i++){
        scanf("%d",&var);
        dmax=max(var-minv,dmax);
        minv=min(var,minv);
    } 
    printf("%d\n",dmax);


    return 0;
}


Measured memory_bytes: 2740
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
vector<pint> ma[(1<<18)+10];
int m2[(1<<18)+10];
int a[(1<<18)+10];
int main()
{
	int n;cin>>n;
	rep(i,(1<<n)){
		cin>>a[i];//ma[i].pb(mp(a[i],i));
	}
	rep(i,(1<<n)){
		//if(__builtin_popcount(i)<2) continue;
		vector<pint> v;v.pb(mp(a[i],i));
		rep(j,n){
			if(!(i&(1<<j))) continue;
			rep(k,ma[i-(1<<j)].size()) v.pb(ma[i-(1<<j)][k]);
		}
		sort(All(v));
		reverse(All(v));
		rep(j,v.size()){
			if(ma[i].size()==0) ma[i].pb(v[j]);
			if(ma[i].size()==1 && v[j].se!=ma[i][0].se) ma[i].pb(v[j]);
		}
		//cout<<i<<endl;
		//rep(j,ma[i].size()) cout<<ma[i][j].fi<<' '<<ma[i][j].se<<endl;
	}
	int out=0;
	REP(i,1,(1<<n)){
		int t=ma[i][0].fi+ma[i][1].fi;
		out=max(out,t);cout<<out<<endl;
	}
}


Measured memory_bytes: 18560
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b;
    cin >> n >> a >> b;
    print(min(n*a, b));

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int H, W, K;
  cin>>H>>W>>K;
  vector<string> A(H);
  for(int i=0;i<H;++i) cin>>A[i];
  int sx, sy;
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      if(A[i][j]=='S'){
        sx = i;
        sy = j;
      }
    }
  }
  queue<pair<int, int> > que;
  queue<int> numque;
  que.push(mp(sx, sy));
  numque.push(0);
  map<pair<int, int>, int> amap;
  pair<int, int> state;
  int x, y, num;
  while(!que.empty()){
    state = que.front();que.pop();
    num = numque.front();numque.pop();
    x = state.fi;
    y = state.se;
    if(amap[mp(x, y)]>0) continue;
    if(num>K) break;
    A[x][y] = '1';
    amap[mp(x, y)]++;
    if(amap[mp(x-1, y)]==0 && x-1>=0 && A[x-1][y]=='.'){
      que.push(mp(x-1, y));
      numque.push(num+1);
    }
    if(amap[mp(x+1, y)]==0 && x+1<H && A[x+1][y]=='.'){
      que.push(mp(x+1, y));
      numque.push(num+1);
    }
    if(amap[mp(x, y-1)]==0 && y-1>=0 && A[x][y-1]=='.'){
      que.push(mp(x, y-1));
      numque.push(num+1);
    }
    if(amap[mp(x, y+1)]==0 && y+1<W && A[x][y+1]=='.'){
      que.push(mp(x, y+1));
      numque.push(num+1);
    }
  }
  int ans = inf;
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      if(A[i][j]=='#' || A[i][j]=='.') continue;
      if(i%K==0){
        ans = min(ans, A[i][j]-'0'+i/K);
      }
      else{
        ans = min(ans, A[i][j]-'0'+i/K+1);
      }
      if((H-i-1)%K==0){
        ans = min(ans, A[i][j]-'0'+(H-i-1)/K);
      }
      else{
        ans = min(ans, A[i][j]-'0'+(H-i-1)/K+1);
      }
      if(j%K==0){
        ans = min(ans, A[i][j]-'0'+j/K);
      }
      else{
        ans = min(ans, A[i][j]-'0'+j/K+1);
      }
      if((W-j-1)%K==0){
        ans = min(ans, A[i][j]-'0'+(W-j-1)/K);
      }
      else{
        ans = min(ans, A[i][j]-'0'+(W-j-1)/K+1);
      }
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 44488
package main

import (
	"fmt"
)

func main() {
	var a, b, c int64
	fmt.Scanf("%d %d %d", &a, &b, &c)
	if c-a-b <= 0 {
		fmt.Println("No")
	} else if a*b*4 < (c-a-b)*(c-a-b) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <math.h>

using namespace std;

struct Point {
    double x;
    double y;
};

void koch(int n, Point p1, Point p2) {
    if (n == 0) {
        return;
    }

    Point s;
    s.x = (2.0*p1.x + 1.0*p2.x)/3.0;
    s.y = (2.0*p1.y + 1.0*p2.y)/3.0;
    Point t;
    t.x = (1.0*p1.x + 2.0*p2.x)/3.0;
    t.y = (1.0*p1.y + 2.0*p2.y)/3.0;
    Point u;
    double th = M_PI * 60.0 / 180.0;
    u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
    u.y = (t.x - s.x)*sin(th) + (t.y - s.y)*cos(th) + s.y;

    koch(n - 1, p1, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n - 1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n - 1, t, p2);
}

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

    Point a;
    a.x = 0;
    a.y = 0;
    Point b;
    b.x = 100;
    b.y = 0;

    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);

    return 0;
}

Measured memory_bytes: 3212
#![allow(unused_imports)]
use std::io;
use std::cmp::*;
use std::collections::*;
#[allow(dead_code)]
const M: i64 = 1e9 as i64 + 7;

fn read_line() -> String {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf
}
#[allow(dead_code)]
fn read<T>() -> T where T: std::str::FromStr, T::Err : std::fmt::Debug {
    read_line().trim().parse().unwrap()
}
#[allow(dead_code)]
fn readv<T>() -> Vec<T> where T: std::str::FromStr, T::Err : std::fmt::Debug {
    read_line().split(' ').map(|a| a.trim().parse().unwrap()).collect()
}

fn main() {
    let s: String = read();
    let st: HashSet<char> = s.as_bytes().into_iter().map(|c| *c as char).collect();
    println!("{}", if s.len() == st.len() { "yes" } else { "no" });
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
using ll=int_fast64_t;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n,a;
    scanf("%d",&n);
    vector<int> b(n+1),c(n+1),s(n+1);
    fr(i,n) scanf("%d",&a),++b[a];
    Fr(i,n) ++c[b[i]];
    iFr(i,n) s[i-1]=s[i]+c[i];
    fr(i,n) s[i+1]+=s[i];
    Fr(i,n){
        int l=0,r=n/i+1,m;
        while(r-l>1){
            m=(l+r)>>1;
            if(s[m-1]<m*i) r=m;
            else l=m;
        }
        printf("%d\n",l);
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int N;
	cin >> N;
	vector<int> A(N), B(N);
	map<int,int> cnt;
	for (auto& x : A) { cin >> x; ++ cnt[x]; }
	for (auto& x : B) { cin >> x; ++ cnt[x]; }
	for (auto p : cnt) {
		if (p.second > N) {
			cout << "No" << endl;
			return 0;
		}
	}
	map<int,int> pA, qA;
	map<int,int> pB, qB;
	for (int i = 0; i < N; ++ i) {
		if (!pA.count(A[i])) pA[A[i]] = i;
		qA[A[i]] = i;
	}
	for (int i = 0; i < N; ++ i) {
		if (!pB.count(B[i])) pB[B[i]] = i;
		qB[B[i]] = i;
	}
	vector<int> hoge(N+1);
	int piyo = 0;
	for (auto pp : pB) {
		int x = pp.first;
		if (!pA.count(x)) continue;
		int p1 = pA[x];
		int q1 = qA[x];
		int p2 = pB[x];
		int q2 = qB[x];
		int d1 = (q1 + 1 - p2 + 2*N) % N;
		int d2 = (p1 - 1 - q2 + 2*N) % N;
		++ piyo;
		if (d1 <= d2) {
			++ hoge[d1];
			-- hoge[d2+1];
		} else {
			++ hoge[0];
			-- hoge[d2+1];
			++ hoge[d1];
		}
	}
	int s = 0;
	for (int i = 0; i < N; ++ i) {
		s += hoge[i];
		if (s == piyo) {
			cerr << i << endl;
			cout << "Yes" << endl;
			for (int j = 0; j < N; ++ j) {
				if (j) cout << " ";
				cout << B[(j-i+N) % N];
			}
			cout << endl;
			return 0;
		}
	}
	throw 1;
}


Measured memory_bytes: 52536
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N;
	long long int ans = 0;
	for (int i = 1; i <= N; i++) {
		ans += i * (N - i + 1);
	}
	for (int i = 1; i < N; i++) {
		cin >> L >> R;
		if (L > R)swap(L, R);
		ans -= L * (N - R + 1);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3628
#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++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int calc(int x) {
  int ret = 0;
  while(x%100 == 0) {
    x /= 100;
    ret++;
  }
  return ret;
}

int main() {
  int D, N; cin >> D >> N;

  int cnt = 0, val = 0;
  while(cnt < N) {
    val++;
    if(calc(val) == D) cnt++;
  }
  cout << val << endl;
  return 0;
}



Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: usize = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

fn solve() {
    let x = read!(i64);
    for a in -1000..1001_i64 {
        for b in -1000..1001_i64 {
            let val = (a.pow(5))-(b.pow(5));
            if val==x {
                println!("{} {}", a, b);
                return;
            }
        }
    }
}

fn run() {
    solve();
}


Measured memory_bytes: 2268
#include <cstdio>
#include <cstring>
#include <cassert>

void print_zeroes(int n) {
  char s[100000];
  memset(s, '0', sizeof s);
  int out = 0;
  for (int i = 0; i < (n / 100000); ++i) {
    out += fwrite(s, 1, sizeof s, stdout);
  }

  out += fwrite(s, 1, (n % 100000), stdout);
  assert(out == n);
}

int main() {
  int W, H, x, y;
  scanf("%d %d %d %d", &W, &H, &x, &y);

  int out = printf("%.1f", 0.5*H*W);

  print_zeroes((1 << 27) - (out+3));

  putchar(' ');
  puts((x+x == W && y+y == H)? "1": "0");
}


Measured memory_bytes: 131328
#!/usr/bin/env python3
from collections import deque
from math import inf


def bfs(maze, visited, Ch, Cw, Dh, Dw, H, W):
    queue = deque([[Ch, Cw]])
    visited[Ch][Cw] = 0

    while queue:
        y, x = queue.popleft()
        if [y, x] == [Dh, Dw]:
            break
        for j in range(-2, 3):
            for k in range(-2, 3):
                new_y, new_x = y + j, x + k
                if 0 <= new_y < H and 0 <= new_x < W:
                    if maze[new_y][new_x] == "." and j**2 + k**2 == 1 and visited[y][x] < visited[new_y][new_x]:
                        visited[new_y][new_x] = visited[y][x]
                        queue.appendleft([new_y, new_x])
                    elif maze[new_y][new_x] == "." and visited[new_y][new_x] == inf:
                        visited[new_y][new_x] = visited[y][x] + 1
                        queue.append([new_y, new_x])
    return visited[Dh][Dw]


def main():
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    maze = [input() for i in range(H)]
    visited = [[inf] * W for i in range(H)]

    dist = bfs(maze, visited, Ch - 1, Cw - 1, Dh - 1, Dw - 1, H, W)
    print(dist if dist != inf else -1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 123132
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

using namespace std;

const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};

typedef long long ll;

int n,x;
vector<int> v;

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	cin>>n;
	for(int i=0;i<n;i++){cin>>x;v.pb(x);}
	
	sort(all(v));
	Unique(v);
		
	cout<<v.size()-((v.size()%2)==0);
	
	//printf("Time used = %.4f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 892
#pragma GCC target ("movbe,mmx,sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,avx2,aes,pclmul,fsgsbase,rdrnd,fma,bmi,bmi2,f16c,rdseed,prfchw,clflushopt,xsavec,xsaves")
#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define all(v) v.begin(), v.end()

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

  int n, q; cin >> n >> q;
  VI c(n); rep(i, n) cin >> c[i];
  vector<pair<int, int>> lr(q); rep(i, q) cin >> lr[i].first >> lr[i].second;
  rep(i, q) lr[i].first--;

  const int sq = 10;
  VI ri(q), lri(q);
  VI cnt(n+1);
  rep(i, q) cnt[lr[i].second]++;
  rep(i, n) cnt[i+1] += cnt[i];
  repr(i, q) ri[--cnt[lr[i].second]] = i;
  fill(all(cnt), 0);
  rep(i, q) cnt[lr[i].first >> sq]++;
  rep(i, n) cnt[i+1] += cnt[i];
  repr(i, q) lri[--cnt[lr[ri[i]].first >> sq]] = ri[i];
  fill(all(cnt), 0);

  VI ans(q);

  int prev = -1;
  int lx, rx;
  int sum = 0;
  for (auto i : lri) {
    auto [l, r] = lr[i];
    if (l >> sq != prev) {
      fill(all(cnt), 0);
      lx = rx = r;
      prev = l >> sq;
      sum = 0;
    }
    int cx;
    while (lx > l) if (cnt[cx=c[--lx]]++ == 0) sum += 1;
    while (lx < l) if (--cnt[c[lx++]] == 0) sum -= 1;
    while (rx < r) if (cnt[cx=c[rx++]]++ == 0) sum += 1;
    ans[i] = sum;
  }
  rep(i, q) cout << ans[i] << "\n";
}


Measured memory_bytes: 17396
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var anssub=new Array();
  if(N%2==0){
    anssub.push((N-2)*N/2);
    for(var i=1;i<N+1;i++){
      for(var j=i+1;j<N+1;j++){
        if(j!=N+1-i){
          anssub.push(i+" "+j);
        }
      }
    }
  }else{
    anssub.push((N-3)*(N-1)/2+(N-1));

    for(var i=1;i<N+1;i++){
      for(var j=i+1;j<N+1;j++){
        if(j!=N-i){
          anssub.push(i+" "+j);
        }
      }
    }
  }
  var ans = anssub.join("\n");

  console.log('%s', ans);
  return ans;
}
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
const int maxn = 1e5 + 5;
vector<int> G[maxn];
int n,k;
typedef pair<int,int> pii;
int main(int argc, char const *argv[])
{
	cin>>n;
	for(int i = 0;i < n - 1; ++i)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		x--,y--;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	cin>>k;
	priority_queue< pii,vector<pii>,greater<pii> > pq;
	vector<int> d(n,-1);
	for(int i = 0;i < k; ++i)
	{
		int v,p;
		scanf("%d%d",&v,&p);
		v--;
		d[v] = p;
		pq.push(pii(p,v));
	}
	while(!pq.empty())
	{
		pii p = pq.top();
		pq.pop();
		int u = p.second;
		for(int v : G[u])
		{
			if(d[v] == -1)
			{
				d[v] = d[u] + 1;
				pq.push(pii(d[v],v));
			}
		}
	}
	for(int u = 0;u < n; ++u)
	{
		for(int v : G[u])
		{
			if(abs(d[v] - d[u]) != 1)
			{
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	for(int i = 0;i < n; ++i)
	{
		printf("%d\n",d[i]);
	}
	return 0;
}


Measured memory_bytes: 7924
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<endl
#define trii(x) cerr<<#x<<": ("<<x.F<<","<<x.S<<")\n";
#define trvii(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<"("<<a[zz].F<<","<<a[zz].S<<") ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<"\n"
#define trsetii(s) cerr<<#s<<": ";for(auto &i:s) trii(i);
#define epsilon 0.000000001L
#define mod 1000000007ll
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define modulo 998244353ll

int main()
{
    fast();
    lf a,b;
    cin>>a>>b;
    ll ans=(a*b);
    cout<<ans<<nl;
}


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

#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);++i)

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")

#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")

int main(void){
  long long int A;
  long double B;
  cin>>A>>B;
  long long int ans;
  ans=(long long int)(A*B);
  cout << ans<< endl;
  return 0;
}


Measured memory_bytes: 3732
N, P = map(int, input().split())

def prime_factor(n):
    res = {}
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res[i] = res.get(i, 0) + 1
            n //= i
    if n != 1:
        res[n] = 1
    return res
            
pf = prime_factor(P)
ans = 1
for k in pf:
    while pf[k] >= N:
        ans *= k
        pf[k] -= N

# print(pf)
print(ans)

Measured memory_bytes: 3064
#include <cstdio>

using namespace std;

int main() {
    int n, i;
    
    scanf("%d", &n);
    
    if (__builtin_popcount(n) == 1) {
        puts("No");
        
        return 0;
    }
    
    puts("Yes");
    
    if (n % 4 == 3) {
        for (i = 1; i < n * 2; i++) printf("%d %d\n", i, i + 1);
    } else if (n % 4 == 1) {
        for (i = 1; i < n - 2; i++) printf("%d %d\n", i, i + 1);
        printf("%d %d\n", n - 2, n + 1);
        for (i = 1; i < n - 2; i++) printf("%d %d\n", i + n, i + n + 1);
        printf("%d %d\n", n - 1, n);
        printf("%d %d\n", n, 1);
        printf("%d %d\n", 1, n * 2 - 1);
        printf("%d %d\n", n * 2 - 1, n * 2);
    } else if (n % 4 == 2) {
        for (i = 1; i < n - 3; i++) printf("%d %d\n", i, i + 1);
        printf("%d %d\n", n - 3, n + 1);
        for (i = 1; i < n - 3; i++) printf("%d %d\n", i + n, i + n + 1);
        printf("%d %d\n", n - 2, n - 1);
        printf("%d %d\n", n - 1, 1);
        printf("%d %d\n", 1, n * 2 - 2);
        printf("%d %d\n", n * 2 - 2, n * 2 - 1);
        printf("%d %d\n", n - 1, n);
        printf("%d %d\n", 2, n * 2);
    } else {
        int x = __builtin_ctz(n) + 1;
        
        for (i = 1; i < n - 1; i++) printf("%d %d\n", i, i + 1);
        printf("%d %d\n", n - 1, n + 1);
        for (i = 1; i < n - 1; i++) printf("%d %d\n", i + n, i + n + 1);
        printf("%d %d\n", n - 1, n);
        printf("%d %d\n", n + (1 << x) - 2, n * 2);
    }
    
    return 0;
}


Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

int main(void){
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << ' ' << X << ' ' << Y << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < k; i++){
            int d = scan.nextInt();
            for(int j = 0; j < d; j++){
                x[scan.nextInt() - 1]++;
            }
        }
        int out = 0;
        for(int i = 0; i < n; i++){
            if(x[i] == 0){
                out++;
            }
        }
        System.out.println(out);
    }
}

Measured memory_bytes: 37444
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	bool bp=true;
	cin>>n;
	while(n--)
	{
		int a;
		cin>>a;
		if(a%2==0)
		{
			if(a%3!=0 && a%5!=0)
			{
				bp=false;
			}
		}
	}
	if(bp)
		cout<<"APPROVED"<<endl; 
	else
	 	 cout<<"DENIED"<<endl; 
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;


void main() {
    readln.split.to!(int[]).sort().take(2).reduce!"a + b".writeln;
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		//int n = sc.nextInt();
		int[] a = new int[5];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		a[4] = sc.nextInt();
		
		// 計算
		int result = 0;
		for(int i = 0; i < 5; i++){
		    if(a[i] == 0) result = i+1;
		}
		
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 25240
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll x;
    cin>>x;
    ll s[x*3];

    for(ll i=0;i<3*x;i++)
    {
        cin>>s[i];
    }

    sort(s,s+3*x);

    ll c=0;

    for(int i=x;i<3*x;i=i+2)
    {
        c+=s[i];
    }
     cout<<c;


}


Measured memory_bytes: 5880
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int point = 0;
  vector<int> a(N);
  for(int i = 0; i < N; i++) cin >> a.at(i);
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  for(int i = 0; i < N; i++) {
    if(i % 2 == 0) point += a.at(i);
    else point -= a.at(i);
  }
  
  cout << point << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
edges_from = [[] for _ in range(n)]
edges_to = [[] for _ in range(n)]

for _ in range(m):
    _from, to = map(lambda x: int(x)-1, input().split())
    edges_from[_from].append(to)

E_dist_to_goal = [0] * n
P_of_reaching = [0] * n
P_of_reaching[0] = 1

for v in range(n-2, -1, -1):
    routes = edges_from[v]
    for next_v in routes:
        E_dist_to_goal[v] += E_dist_to_goal[next_v] + 1
    E_dist_to_goal[v] /= len(routes)

for v in range(n-1):
    P_now = P_of_reaching[v]
    routes = edges_from[v]
    P_next = P_now / len(routes)
    for next_v in routes:
        P_of_reaching[next_v] += P_next

initial_ans = E_dist_to_goal[0]
answers = [initial_ans]
for v in range(n-2):
    routes = edges_from[v]
    num_of_routes = len(routes)
    if num_of_routes == 1:
        continue
    not_cut_dist = E_dist_to_goal[v]
    longest_dist = max([E_dist_to_goal[next_v]+1 for next_v in routes])
    after_cut_dist = (not_cut_dist - longest_dist/num_of_routes) * num_of_routes / (num_of_routes-1)
    delta = not_cut_dist - after_cut_dist
    candidate = initial_ans - delta * P_of_reaching[v]
    answers.append(candidate)

print(min(answers))


Measured memory_bytes: 9460
from __future__ import print_function
import numpy as np
import sys
import math,string,itertools,fractions,heapq,collections,re,array,bisect,copy,functools
# from itertools import accumulate
# from collections import deque
import random

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


# a,b,cの長さの竹の組が欲しい．
# 目的竹a,b,c
# n本の竹l1,l2,l3...., l_{n}
#
# 竹の集合Lについて，Lの要素それぞれを{a,b,c}に分類していく重複順列を考える．
# 「 L->{a,b,c} 」の重複順列の選び方は3^n通り．
# それらを全て列挙したい．
# 変数bitは，竹の割り当て（重複順列の選び方）を表す．
# 例えば，bit= 00 10 01 11 00 10 
# のとき，
# l0 -> none
# l1 -> b
# l2 -> a
# l3 -> c
# l4 -> none
# l5 -> b
# などと表現できる．
# これは，
# bitを2*i桁右シフトして0b11の剰余をとったものを判定することで分岐できる．
# 
# それぞれの竹の割り当ての場合について，
# その時の{a,b,c}の値を計算する．
 
# l=np.zeros(n,dtype=int)
# for i in range(n):
#     l[i]=int(input())
# eprint(l)
# ll=np.sort(l)
# eprint(ll)


n,a,b,c=map(int,input().split())
l=np.zeros(n,dtype=int)

for i in range(n):
    l[i]=int(input())
# l=[int(x) for x in input()]

# eprint("l:",end="" )
# eprint(l)
    
minx = sys.maxsize

for bit in range(0,1<<2*n):
    da=0
    db=0
    dc=0
    cnt=0
    for i in range(0,n):
        if (bit>>2*i)&(0b11) ==0:
            continue
        elif (bit>>2*i)&(0b11) == 1:
            da+=l[i]
            cnt+=10
        elif (bit>>2*i)&(0b11) == 2:
            db+=l[i]
            cnt+=10
        elif (bit>>2*i)&(0b11) == 3:
            dc+=l[i]
            cnt+=10
    if da*db*dc==0:
        continue
    else:
        cnt+=abs(da-a)+abs(db-b)+abs(dc-c)-30
        # eprint("cnt: ", end="")
        # eprint(cnt)
        if  cnt < minx:
            minx = cnt

print(minx)

Measured memory_bytes: 15440
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, l, s = 0, ans;
    cin >> n >> l;
    int a[n + 1];
    for(int i = 1; i <= n; i++) {
        s += l + i - 1;
    }
    if(l >= 0) ans = l;
    else {
        if(n <= abs(l)) ans = n + l - 1;
        else ans = 0;
    }
    cout << s - ans;
}


Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
int main(){
	int a,b;
	cin>>a>>b;
	if(a*b%2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

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

// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)

int main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n;
  cin >> n;
  cout << (ll)n*(n-1)/2 << endl;
  return 0;
}


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

int main(){
	string st;
	int sum;

	while(getline(cin,st) && st != "0"){
		sum = 0;
		for(int i=0; i<st.length(); ++i){
			//cout << st[i];
			sum += st[i] - 48;
		}
		cout << sum << endl;
	}

	return 0;
}



Measured memory_bytes: 3200
N=gets.to_i
sp = Array.new(N)
N.times do |i|
    t = gets.chomp.split
    sp[i] = [i+1, t[0], t[1].to_i]
end

sp.sort_by!{|_, s, p| [s, 100-p.to_i]}
puts sp.transpose[0]


Measured memory_bytes: 1788
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long a;
  string s;
  cin >> a >> s;
  if (a < 3200) s = "red";
  cout << s << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
#define pb push_back

int n, a[100005], b[100005], c[100005], dp[100005][3];

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i] >> b[i] >> c[i];
   	for (int i = 1; i <= n; ++i) {
   		dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
   		dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];
   		dp[i][2] = max(dp[i - 1][1], dp[i - 1][0]) + c[i];
   	}
   	cout << max({dp[n][0], dp[n][1], dp[n][2]}) << '\n';
    return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
         
        using namespace std ;
          
        int main()
        {
          int A , B , C ;
          
          cin >> A >> B >> C ;
          
          if((A==5 && B==7 && C==5)||(A==5 && B==5 && C==7)||(A==7 && B==5 && C==5))
          {
            cout << "YES\n" ;
          }
          else
          {
            cout << "NO\n" ;
          }
          return 0 ;
        }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

//出力するよ
void output(vector<int> s)
{
    int n = s.size();
    for (int i = 0; i < n; i++)
    {
        if (i != 0)
            cout << " ";
        cout << s[i]; //<<endl;
    }
    cout << endl;
}

int MOD = pow(10, 9) + 7;

//各要素で最低操作回数を数える
pair<int,int> count(vector<int> a,vector<int> b){
    int n=a.size();
    int a_cnt=0,b_cnt=0;
    for(int i=0;i<n;i++){
        if(a[i]>b[i]){
            b_cnt+=(a[i]-b[i]);
        }
        if(a[i]<b[i]){
            if((b[i]-a[i])%2==0){
                a_cnt+=(b[i]-a[i])/2;
            }else{
                a_cnt+=(b[i]-a[i])/2 +1;
            }
        }
    }

    return make_pair(a_cnt,b_cnt);
}

signed main(){
    int n,a,b; cin>>n>>a>>b;
    vector<int> x(n);
    for(int i=0;i<n;i++) cin>>x[i];

    int ans=0;
    for(int i=0;i<(n-1);i++){
        ans+=min(b,(x[i+1]-x[i])*a);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3964
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define ff first
#define ss second
#define vi vector<int>
#define pii pair<int, int>
#define mod (ll)1e9+7
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define repf(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define N 100005
ll power(ll x, ll y)  
{  
    ll res = 1; x %= mod; if (!x) return 0; 
    while (y > 0)  
    {  
        if (y & 1)  res = (res*x) % mod;  
        y = y>>1;x = (x*x) % mod;  
    }  
    return res;  
} 

int main()
{
	FAST
    int t=1;
    // cin>>t;
    while(t--)
    {
		ll n,i;
		ll ans=0;
		cin>>n;
		repf(i,1,n)
		{
			if(n%i==0)
			{
				int x=n/i-1;
				ans+=x;
			}
			else
			{
				int x=n/i;
				ans+=x;
			}
		}
		cout<<ans;
    }
    return 0;
} 


Measured memory_bytes: 3644
import itertools
while True :
    n,x = map(int,input().split())
    if n==0 and x==0 :
        break
    N=list(range(1,n+1))
    l=[]
    for j in itertools.combinations(N, 3):
        X=sum(j)
        if X==x :
            l.append(1)
    print(sum(l))
   
    


Measured memory_bytes: 5648
#include<bits/stdc++.h>
using namespace std;
#define MAX INT_MAX
int arr[100005];
long long dp[100005];
int n;
long long func(int i)
{
    if(i>=n)return 0;
    if(dp[i]!=-1)return dp[i];
    long long ans1=MAX,ans2=MAX;
    if(i<n)ans1=(int)abs(arr[i]-arr[i+1])+func(i+1);
    if(i<n-1)ans2=(int)abs(arr[i]-arr[i+2])+func(i+2);
    return dp[i]=min(ans1,ans2);
}
int main()
{
    std :: ios :: sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++ ) {
        cin>>arr[i];
    }
    memset(dp,-1,sizeof(dp));
    long long ans=func(1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4608
s=input()
n=len(s)+1
ans=[-1 for i in range(n)]
st=False
for i in range(1,n):
    if s[i-1]=="<":
        if st:
            st=False
            ans[i-1]=0
    else:
        st=True
if s[0]=="<":
    ans[0]=0
else:
    d=0
    for i in range(1,n):
        if s[i-1]==">":
            d+=1
        else:
            break
    ans[0]=d
#print(ans)
co=0
for i in range(n-1,0,-1):
    if s[i-1]==">":
        ans[i]=co
        co+=1
    else:
        if co>0:
            ans[i]=co
        co=0
#print(ans)
for i in range(1,n):
    if s[i-1]=="<" and ans[i]==-1:
        ans[i]=ans[i-1]+1
    elif s[i-1]=="<" and ans[i]!=-1:
        ans[i]=max(ans[i],ans[i-1]+1)
print(sum(ans))












Measured memory_bytes: 77132
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;



int main()
{
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i, n)
		cin >> a[i];
	cout << (n - 1 + k - 2) / (k - 1) << endl;

	return 0;
}

Measured memory_bytes: 1024