akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    ll N,X;

    Scll2(N,X);

    ll n = N-X;
    ll x = X;
    ll t;
    ll ans = N;
    while( n % x ){
        ans += x*(n/x)*2;
        t = x;
        x = n % x;
        n = t;
    }
    ans += x*(n/x)*2-x;

    printf ("%llu\n", ans);

    return 0;
}



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

//constant
const long long int inf = 1<<30;
const int N = 1e5+1;
const int M = 1e5+1;

//variable
int a, b, c, d;

//function


int main()
{
    cin >> a >> b >> c >> d;
    int l = a + b;
    int r = c + d;

    if(l > r){
        cout << "Left" <<endl;
    }
    else if(l < r){
        cout << "Right" <<endl;
    }
    else {
        cout << "Balanced" <<endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e14;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
vc<pair<ll, ll>> ans1, ans2;
int main() {
    init();
    ll H,W;
    cin >> H >> W;
    vvc<ll> A(H, vl(W));
    rep(i, H) rep(j, W) cin >> A[i][j];

    ll Onum = 0;
    rep(i,H)rep(j,W){
        if (A[i][j] % 2) Onum++;
    }
    if (Onum % 2) Onum--; // 奇数個あるなら、１か所は考えない

    ll Ocnt = 0;
    bool carry = false;
    vc<tuple<ll, ll, ll, ll>> ans;
    ll ph, pw;
    rep(h,H){
        ll w, d;
        if (h % 2 == 0)
            w = 0, d = 1;
        else
            w = W - 1, d = -1;

        while(w!=W&&w!=-1){
            if(A[h][w]%2){
                Ocnt++;
                if(carry){
                    carry = false;
                    ans.eb(ph, pw, h, w);
                }
                else{
                    carry = true;
                }
            }
            else if(carry){
                ans.eb(ph, pw, h, w);
            }

            ph = h, pw = w;
            w += d;
        }

        if (Ocnt == Onum) break;
    }

    ll N = ans.size();
    cout << N << endl;
    rep(i, N){
        ll a, b, c, d;
        tie(a, b, c, d) = ans[i];
        cout << ++a << " " << ++b << " " << ++c << " " << ++d << "\n";
    }
}

Measured memory_bytes: 8432
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include "bits/stdc++.h"
using namespace std;
#define int int64_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l = 0, int r = numeric_limits <int>::max())
{return uniform_int_distribution<int> (l, r)(rng);}

template <typename T, typename G>
ostream& operator << (ostream& out, const pair <T, G> &a) 
{return out << "( " << a.x << ", " << a.y << ")";}

template <typename T>
ostream& operator << (ostream& out, const vector <T> &a) 
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

template <typename T>
ostream& operator << (ostream& out, const set <T> &a) 
{out << "{ "; for(const auto &i: a) out << i << ", "; return out << "}" << endl;}

template <typename T, typename G>
ostream& operator << (ostream& out, const map <T, G> &a) 
{out << "< "; for(const auto &i: a) out << i << ", "; return out << ">" << endl;}

template <typename T, size_t N>
typename enable_if<!is_same <typename remove_cv <T>::type, char>::value,
ostream&>::type operator << (ostream& out, T (&a)[N])
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

void debug_out(){cerr << endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr << (H) << ' '; debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr << '#' << #__VA_ARGS__ << ":\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n, ans = 0;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n && i * j < n; ++j) { 
			if (n - i * j > 0)
				ans++; 
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i > 0; i--)
#define mod 1000000007
#define MOD 998244353
typedef long long int ll;
typedef pair<ll, ll> p;

int main() {
	int n,sum=0;
	cin >> n;
	vector<int> p(n);
	rep(i, n) {
		cin >> p[i];
		sum += p[i];
	}
	sum -= *max_element(p.begin(), p.end())/2;
	cout << sum << endl;
	return 0;
}

//Ctrl+Aを使わない

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

int main() {

  long n, m, l;
  long A[128][128];
  long B[128][128];
  long C[128][128];
  long temp;

  std::cin >> n >> m >> l;

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

  for(int i = 0; i < m; ++i) {
    for(int j = 0; j < l; ++j) {
      std::cin >> B[j][i];
    }
  }

  for(int i = 0; i < n; ++i) {
    for(int j = 0; j < l; ++j) {
      temp = 0;
      for(int k = 0; k < m; ++k) {
	temp += A[i][k] * B[j][k];
      }
      C[i][j] = temp;
    }
  }

  for(int i = 0; i < n; ++i) {
    for(int j = 0; j < l-1; ++j) {
      std::cout << C[i][j] << " ";
    }
    std::cout << C[i][l-1] << std::endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 1472
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N,M;
  cin >>N>>M;
  int a[N];
  double sum=0;
  int cnt=0;
  for (int i=0;i<N;i++){
    cin>>a[i];
    sum=sum+a[i];
  }
  for (int i=0;i<N;i++){
    if(a[i]>=sum/(4*M)){
      cnt++;
    }
  }
  if(cnt>=M){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
  return 0;
}

 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define oo int(1e9)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long ll;
typedef double db;
const ll MOD = (ll)(1e9) + 7;
int n, K;
vector<int> a;
vector<int> dp;

int main() {
	cin.tie(0); ios::sync_with_stdio(0); cout.tie(0);
    cin >> n >> K;
    a.resize(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    dp.resize(K + 1);
    
    for (int i = 0; i <= K; i++)
        for (int x : a)
            if (i >= x && !dp[i - x]) dp[i] = 1;
            
    if (dp[K]) cout << "First";
    else cout << "Second";
	return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
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;
}
//

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

  int N, M;
  string s;
  cin >> N >> M >> s;
  reverse(all(s));

  vector<int> ans;
  int id = 0;
  while (id < N) {
    int m = M;
    if (N <= id + m) m = N - id;
    while (s[id + m] == '1' && 0 < m) m--;

    if (m == 0) {
      cout << -1 << endl;
      return 0;
    }
    id += m;
    ans.push_back(m);
  }

  reverse(all(ans));

  for (auto x : ans) {
    cout << x << " ";
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 1096
#include<iostream>
#include<string.h>
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,b) loop(i,0,b)
using namespace std;

class DICE{
public :

void Rotate(int m[7],char dir){
    if (dir=='N'){
        m[6]=m[0];
        m[0]=m[1];
        m[1]=m[5];
        m[5]=m[4];
        m[4]=m[6];
    }
    else if(char(dir)=='E'){
        m[6]=m[0];
        m[0]=m[3];
        m[3]=m[5];
        m[5]=m[2];
        m[2]=m[6];
    }
    else if(char(dir)=='W'){
        m[6]=m[0];
        m[0]=m[2];
        m[2]=m[5];
        m[5]=m[3];
        m[3]=m[6];
    }    
    else{
        m[6]=m[0];
        m[0]=m[4];
        m[4]=m[5];
        m[5]=m[1];
        m[1]=m[6];
    }
}
bool DICE_Check(int(m[7]),int(m2[7])){
    DICE d;
        rep(i1,4){
            d.Rotate(m,'E');
            if(m[0]==m2[0]&&m[1]==m2[1]&&m[2]==m2[2]&&m[3]==m2[3]&&m[4]==m2[4]&&m[5]==m2[5]) goto QUT;
            rep(i2,4){
                d.Rotate(m,'N');
                if(m[0]==m2[0]&&m[1]==m2[1]&&m[2]==m2[2]&&m[3]==m2[3]&&m[4]==m2[4]&&m[5]==m2[5]) goto QUT;
                rep(i3,4){
                    d.Rotate(m,'W');
                   if(m[0]==m2[0]&&m[1]==m2[1]&&m[2]==m2[2]&&m[3]==m2[3]&&m[4]==m2[4]&&m[5]==m2[5]) goto QUT;
                    rep(i4,4){
                        d.Rotate(m,'S');   
                       if(m[0]==m2[0]&&m[1]==m2[1]&&m[2]==m2[2]&&m[3]==m2[3]&&m[4]==m2[4]&&m[5]==m2[5]) goto QUT;
                    }
                }
            }
        }
        return false;
        goto END;
        QUT:
        return true;
        END: ;
}
};
int main(){
    int n;
    DICE D;
    int dice[101][7]={{}};
    cin>>n;
    rep(j,n){
        rep(i,6){
            cin>>dice[j][i];
        }
    }
    for(int k=0;k<n-1;k++){
        for(int k1=k+1;k1<n;k1++){
            if(D.DICE_Check(dice[k],dice[k1])){
                goto OUT2;
            }
        }
    }    
    cout<<"Yes"<<endl;
    goto END2;
    OUT2:
    cout<<"No"<<endl;
    END2: ;
}



Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main(void)
{	

	int pasta, juice, tmp;
	cin >> pasta;
	for (int i = 0; i < 2; i++)
	{
		cin >> tmp;
		if (tmp < pasta)
			pasta = tmp;
	}
	cin >> juice;
	cin >> tmp;
	if (tmp < juice)
		juice = tmp;
	cout << pasta + juice - 50 << endl;

}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int n,a[210];
int main()
{
    scanf("%d",&n);n*=2;
    for (int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    int ans=0;
    for (int i=1;i<=n;i+=2) ans+=a[i];
    printf("%d\n",ans);
    return 0;
}


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

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int N, A[205], cnt = 0;

void solve(){
    bool flag = true;
    while(flag){
        rep(i,N){
            if(A[i] % 2 == 0) A[i] = A[i] / 2;
            else flag = false;
        }
        if(flag)
            cnt++;
    }
    cout << cnt << endl;
}

int main(){
    cin >> N;
    
    rep(i,N) cin >> A[i];

    solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <vector>
#include <climits>
using namespace std;

int main()
{
	int N, K;

	cin >> N;
	vector<int> a(N);
	vector<int> b(N);
	vector<int> c(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> a[i] >> b[i] >> c[i];
	}

	vector<vector<int>> dp(N);
	dp[0].push_back(a[0]);
	dp[0].push_back(b[0]);
	dp[0].push_back(c[0]);
	for (auto i = 1; i < N; ++i)
	{
		dp[i].push_back(max(dp[i - 1][1], dp[i - 1][2]) + a[i]);
		dp[i].push_back(max(dp[i - 1][0], dp[i - 1][2]) + b[i]);
		dp[i].push_back(max(dp[i - 1][0], dp[i - 1][1]) + c[i]);
	}

	cout << max(max(dp[N - 1][0], dp[N - 1][1]), dp[N - 1][2]) << endl;

	return 0;
}


Measured memory_bytes: 6912
/**
*	  Name: Ajay Subhash Jadhav
*	  Institute: International Institute of Technology Hyderabad 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define LL long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vii vector<ppi>
#define vll vector<LL>
#define mp make_pair
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void inputread()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}
		
int main(){
      
  fastio();
  int n,m,i,j,t;
  cin>>n;
  int a[n];
  
  for(i=0;i<n;i++)
  	cin>>a[i];

  sort(a,a+n);
  int lhs=0;
  for(i=0;i<n-1;i++)
  	lhs+=a[i];

  if(lhs>a[n-1])
  	cout<<"Yes";
  else
  	cout<<"No";
  return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let x = read::<String>().chars().collect::<Vec<_>>();
    let init_count = x.iter().filter(|&&x| x == '1').count() as u64;
    let offsets = vec![-1, 1];
    let mut init = vec![0; 2];
    let mut coefs = vec![vec![0; n]; 2];
    for i in 0..2 {
        let init_count = (init_count as i64 + offsets[i]) as u64;
        if init_count == 0 && i == 0 {
            continue;
        }

        coefs[i][0] = 1;
        for j in 1..n {
            coefs[i][j] = (2 * coefs[i][j - 1]) % init_count;
        }
        for j in 0..n {
            if x[n - 1 - j] == '1' {
                init[i] += coefs[i][j];
                init[i] %= init_count;
            }
        }
    }

    for i in 0..n {
        let mut cur_x;
        if x[i] == '0' {
            cur_x = init[1];
            cur_x += coefs[1][n - 1 - i];
            cur_x %= init_count + 1;
        } else {
            cur_x = init[0];
            if init_count == 1 {
                println!("0");
                continue;
            }
            cur_x += init_count - 1 - coefs[0][n - 1 - i];
            cur_x %= init_count - 1;
        }
        let mut count = 1;
        while cur_x != 0 {
            debug!(cur_x);
            cur_x = cur_x % cur_x.count_ones() as u64;
            count += 1;
        }
        println!("{}", count);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 5904
#include <bits/stdc++.h>
#define endl "\n"
#define pi acos(-1)
#define faster_io ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

int main()
{
    //freopen("/home/sohel/Documents/my_codes/out.txt", "wt", stdout);
    int t, ac = 0, wa = 0, tle = 0, re = 0;
    cin >> t;
    string temp;
    vector<string> vs;
    for (int i = 0; i < t; i++) {
        cin >> temp;
        vs.push_back(temp);
    }
    ac = count(vs.begin(), vs.end(), "AC");
    wa = count(vs.begin(), vs.end(), "WA");
    tle = count(vs.begin(), vs.end(), "TLE");
    re = count(vs.begin(), vs.end(), "RE");
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}

Measured memory_bytes: 7440
import Control.Applicative
import Data.List
import Control.Monad
import Data.Function
import Data.Array

getLineN :: Int -> IO [String]
getLineN n = replicateM n getLine

main = getLine >>= putStrLn.show.answer.map (read :: String -> Int).words

answer [a,b] = maximum [a+b,a-b,a*b]

Measured memory_bytes: 508
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  u64 x;
  cin >> x;
  int goal = 0;
  int i = 0;
  while (goal < x) {
    i++;
    goal += i;
  }
  cout << i << endl;
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, a, b) = readInputLine().split(" ").map { it.toInt() }
    
    if (n * a < b) {
        println(n * a)
    } else {
        println(b)
    }
}
 
fun readInputLine(): String {
    return readLine()!!
}


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

using namespace std;

typedef long long ll;

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N; cin >> N;
  int A[N];
  for(int i=0;i<N;i++) cin >> A[i];
  set<int> st;
  for(int i=0;i<N;i++){
    if(st.find(A[i]) == st.end()) st.insert(A[i]);
    else st.erase(A[i]);
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 5376
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
C = 0

for i in range(q):
	s_idx = 0
	g_idx = n
	while s_idx != g_idx:
		idx = (s_idx + g_idx) // 2
		if S[idx] == T[i]:
			C += 1
			break
		elif S[idx] < T[i]:
			s_idx = idx + 1
		elif S[idx] > T[i]:
			g_idx = idx

print(C)


Measured memory_bytes: 16704
#include<stdio.h>
int main ()
{
int a,b,c,d,e,f;
scanf("%d %d %d %d",&a,&b,&c,&d);
if(a>=b)
{
   e=b;
}
else
{
    e=a;
}
if(c>=d)
{
    f=d;
}
else
{
    f=c;
}
printf("%d\n",e+f);
return 0;
}


Measured memory_bytes: 128
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!{
        n:usize,
        m:usize,
    }
    let x:String = n.to_string().repeat(m);
    let y:String = m.to_string().repeat(n);
    if x < y {
        print!("{}",x)
    } else {
        print!("{}",y)
    }
}


Measured memory_bytes: 2060
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        PrintWriter out = new PrintWriter(System.out);
        if (N > 81) {
            out.println("No");
            sc.close();
            out.flush();
            return;
        }

        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                if (i * j == N) {
                    out.println("Yes");
                    sc.close();
                    out.flush();
                    return;
                }
            }
        }

        out.println("No");
        sc.close();
        out.flush();
    }
}

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

#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

int _runtimeTerror_()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans = -9e18;
    if(a*b<=0)
        amax(ans,0ll);
    if(c*d<=0)
        amax(ans,0ll);
    amax(ans,a*c);
    amax(ans,b*d);
    amax(ans,b*c);
    amax(ans,a*d);
    cout<<ans<<"\n";
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}

Measured memory_bytes: 3648
using System;
using System.Linq;
using CompLib.Collections;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        var odd = new HashMap<int, int>();
        odd[-1] = 0;
        var even = new HashMap<int, int>();
        even[-1] = 0;
        for (int i = 0; i < n; i++)
        {
            int v = sc.NextInt();
            if (i % 2 == 0) even[v]++;
            else odd[v]++;
        }

        var arO = odd.ToArray();
        var arE = even.ToArray();
        Array.Sort(arO, (l, r) => -l.Value.CompareTo(r.Value));
        Array.Sort(arE, (l, r) => -l.Value.CompareTo(r.Value));

        // 1位同士
        if (arO[0].Key != arE[0].Key)
        {
            var max = arO[0].Value + arE[0].Value;
            Console.WriteLine(n - max);
        }
        else
        {
            var max = Math.Max(arO[0].Value + arE[1].Value, arO[1].Value + arE[0].Value);
            Console.WriteLine(n - max);
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Collections
{
    using System.Collections.Generic;

    public class HashMap<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get
            {
                TValue o;
                return TryGetValue(key, out o) ? o : default(TValue);
            }
            set { base[key] = value; }
        }
    }
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 39864
/*I wanna be the very best, like no one ever was...*/

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define ll long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);
 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif



int main() {
    io;
    // freopen("in","r",stdin); 
    // freopen("out","w",stdout);
  
    string a[3];
    cin>>a[0]>>a[1]>>a[2];
    int  t=0;
    while(true){
       if(a[t].size()==0){
           cout<<char(t+'A');
           return 0;
       }
       char c = a[t][0];
       a[t].erase(a[t].begin());
       t = c-'a';
    }
 
 
 
    
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

using ll = long long;
using p = pair<ll, ll>;

constexpr ll INF = 1LL << 62;
constexpr ll MAX_N = 200;

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

    ll N;
    cin >> N;

    ll multipleof4 = 0;
    ll odd = 0;
    ll multipleof2 = 0;
    for (ll i = 0; i < N; i++) {
        ll a;
        cin >> a;
        if (a % 2) {
            odd++;
        } else if (a % 4) {
            multipleof2++;
        } else {
            multipleof4++;
        }
    }

    if (multipleof2) {
        cout << (odd <= multipleof4 ? "Yes" : "No") << endl;
    } else {
        cout << (odd <= multipleof4 + 1 ? "Yes" : "No") << endl;
    }

    return 0;
}




Measured memory_bytes: 256
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let mut s: Vec<char> = itr.next().unwrap().chars().collect();
    let mut t: Vec<char> = itr.next().unwrap().chars().collect();
    s.sort();
    t.sort();
    t.reverse();
    let s = s.into_iter().collect::<String>();
    let t = t.into_iter().collect::<String>();
    if s < t {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2080
N, A, B = map(int, input().split())

X = list(map(int, input().split()))
X = [x - X[0] for x in X]

C = 0

for i in range(1, N):
    C_A = (X[i] - X[i-1]) * A
    if C_A < B:
        C += C_A
    else:
        C += B

print(C)


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

int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  
  // 制約よりL ≤ R であるため、[L_MAX, R_MIN]を更新していけば良い.
  // 最終的に全てのゲートをIDカードの数はR_MIN - L_MAX + 1となる.
  int ans = 0;
  int L_MAX = 0;
  int R_MIN = 1e5 + 1;
  for (int i = 0; i < M; ++i) {
    int L, R;
    scanf("%d%d", &L, &R);
    L_MAX = max(L_MAX, L);
    R_MIN = min(R_MIN, R);
  }

  // 全てのゲートを通過できるIDカードがある場合
  if (R_MIN - L_MAX + 1 > 0) {
    ans = R_MIN - L_MAX + 1;
  }

  printf("%d", ans);
  return 0;
}

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

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

    int c = 0;
    for (int i = 1; i <= n; i+=2) {
        int y = 0;
        for (int j = 1; j <= i; j++) {
            if (i % j == 0) { 
                y++;
            }
        }
        if (y== 8) {
            c++;
        }
    }

    cout << c << endl;
}



Measured memory_bytes: 3596
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   
//#include <boost/math/common_factor_rt.hpp>

#define ll long long

using namespace std;

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

	if (s.size() == 2) {
		cout << s << endl;
	}
	else {
		reverse(s.begin(), s.end());
		cout << s << endl;
	}
	
}

int dsum(ll a) {
	int ans = 0;
	while (a != 0) {
		ans += a % 10;
		a /= 10;
	}
	return ans;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int w;
	while(cin>>w)
	{
		bool flag=0;
		for(int i=1;i<=w;i*=2)
		{
			if(w%(i*2)>0)
			{
				if(flag)
				{
					cout<<' ';
				}
				cout<<i;
				flag=1;
				w-=i;
			}
		}
		cout<<endl;
	}
	return 0;
}




Measured memory_bytes: 2992
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

const int MAX_N = 100010;

class node {
  public:
    int p = -1, l, r;
};
node nod[MAX_N];

vector<int> depth(MAX_N);
vector<int> heigh(MAX_N);

void setDepth(int i, int d) {
    depth[i] = d++;
    if(nod[i].l != -1)
        setDepth(nod[i].l, d);
    if(nod[i].r != -1)
        setDepth(nod[i].r, d);
}
int setHeight(int i) {
    int h1 = 0, h2 = 0;
    if(nod[i].l != -1)
        h1 = setHeight(nod[i].l) + 1;
    if(nod[i].r != -1)
        h2 = setHeight(nod[i].r) + 1;
    return heigh[i] = max(h1, h2);
}

int getSibling(int i) {
    if(nod[i].p == -1)
        return -1;
    else
        return (nod[nod[i].p].l != i ? nod[nod[i].p].l : nod[nod[i].p].r);
}

int getDegree(int i) { return (nod[i].l != -1) + (nod[i].r != -1); }

string isNodeType(int i) {
    if(nod[i].p == -1)
        return "root";
    if(nod[i].l == -1 && nod[i].r == -1)
        return "leaf";
    return "internal node";
}

int main() {
    int n, id, l, r;
    cin >> n;
    rep(i, n) {
        cin >> id >> l >> r;
        nod[id].l = l;
        nod[id].r = r;
        if(l != -1)
            nod[l].p = id;
        if(r != -1)
            nod[r].p = id;
    }
    rep(i, n) {
        if(nod[i].p < 0) {
            setDepth(i, 0);
            setHeight(i);
            break;
        }
    }
    rep(i, n) {
        cout << "node " << i << ": parent = " << nod[i].p;
        cout << ", sibling = " << getSibling(i);
        cout << ", degree = " << getDegree(i);
        cout << ", depth = " << depth[i] << ", height = " << heigh[i];
        cout << ", " << isNodeType(i) << endl;
    }
}



Measured memory_bytes: 4600
#include <iostream>
#include <vector>
using i64 = long long;

std::vector<std::vector<int>> g, q;
std::vector<std::vector<i64>> comp;
std::vector<int> c, sz;

int szdfs(int v, int p) {
    for (const int to : g[v]) {
        if (to == p) continue;
        sz[v] += szdfs(to, v);
    }
    return sz[v];
}

void dfs(int v, int p) {
    const int j = c[v];
    comp[j][q[j].back()] -= sz[v];
    for (const int to : g[v]) {
        if (to == p) continue;
        q[j].push_back(comp[j].size());
        comp[j].push_back(sz[to]);
        dfs(to, v);
        q[j].pop_back();
    }
}

int main() {
    i64 n;
    std::cin >> n;
    const i64 all = n * (n + 1) / 2;
    g.resize(n); c.resize(n); q.resize(n); comp.resize(n); sz.resize(n, 1);
    for (auto &e : comp) e.push_back(n);
    for (auto &e : q) e.push_back(0);
    for (auto &e : c) {
        std::cin >> e;
        --e;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        std::cin >> u >> v;
        --u; --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    szdfs(0, -1);
    dfs(0, -1);

    for (int i = 0; i < n; i++) {
        i64 s = 0;
        for (const i64 r : comp[i]) s += r * (r + 1) / 2;
        std::cout << all - s << '\n';
    }

    return 0;
}


Measured memory_bytes: 59748
#include <iostream>
#include <string>

std::string str;

int main(){
    std::cin >> str;

    bool f = true;
    for(int i = 0; i < str.size(); i++){
        if(str[i] != str[str.size() - i - 1])
        f = false;
    }

    if(f) std::cout << "Yes\n";
    else std::cout << "No\n";


    return 0;
}


Measured memory_bytes: 256
using System;

class Program {
  static void Main() {
    var a = Console.ReadLine();
    var b = Console.ReadLine();
    string[] s = { "GREATER", "LESS", "EQUAL" };
    var n = 2;
    if (a.Length > b.Length) n = 0;
    else if (a.Length < b.Length) n = 1;
    else {
      int t = a.CompareTo(b);
      if (t == 1) n = 0;
      else if (t == -1) n = 1;
    }
    Console.WriteLine(s[n]);
  }
}

Measured memory_bytes: 13404
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF=1000000007;
const double PI=acos(-1);

int main() {
  int  a, b, x;
  cin >> a >> b >> x;
  double h=(a*a*b-x)*2.0/a/a;
  double ans;
  if(h<=b) ans=atan(h/a)/PI*180.0;
  else ans=90.0-atan(2.0*x/a/b/b)/PI*180.0;
  printf("%.10f", ans);
}


Measured memory_bytes: 384
/********************************************************
  **░██████╗██╗░░░░░░█████╗░██╗░░░██╗██╗░█████╗░░██████╗░**
  **██╔════╝██║░░░░░██╔══██╗██║░░░██║██║██╔══██╗██╔════╝░**
  **╚█████╗░██║░░░░░███████║╚██╗░██╔╝██║██║░░╚═╝██║░░██╗░**
  **░╚═══██╗██║░░░░░██╔══██║░╚████╔╝░██║██║░░██╗██║░░╚██╗**
  **██████╔╝███████╗██║░░██║░░╚██╔╝░░██║╚█████╔╝╚██████╔╝**
  **╚═════╝░╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░░╚═════╝░**
  *********************************************************/

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


#define ll                          long long
#define ld                          long double

#define forn(i,n)                   for(int i=0;i<n;++i)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend();
#define isSubstring(s1,s2)          s1.find(s2) != std::string::npos
	
#define pb                          push_back
#define pf                          push_front
#define mp                          make_pair
#define fr                          first
#define sc                          second

#define vpi                         <vector<pair<int,int>>
#define vi                          vector<int>
#define sz(a)                       (int)a.size()

#define   endl                       "\n"
#define     nl                       cout<<"\n";
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define MN                           INT_MIN
#define MX                           INT_MAX

bool isPrime(ll n){if(n<2)return false;for(ll x = 2;x*x <=n;x++){if(n%x == 0)return false;}return true;}
bool isPerfectSquare(long double x){long double sr=sqrt(x);return((sr-floor(sr))==0);}
int gcd(int a, int b){if(a==0)return b;if(b==0) return a;if(a==b)return a;if(a>b)return gcd(a-b,b);return gcd(a,b-a);}
int32_t main()
{
	int n,m;
	cin >> n >> m;
	if(m>= n)
	{
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
}

Measured memory_bytes: 3632
A, B, C, X, Y = map(int, input().split())

m = min([X,Y])
M = max([X,Y])
d = abs(X-Y)
if A+B < 2*C:
  res = X*A + Y*B
elif X < Y:
  if 2*C*X + B*(Y-X) < 2*C*Y:
    res = 2*C*X + B*(Y-X)
  else:
    res = 2*C*Y
else:
  if 2*C*Y + A*(X-Y) < 2*C*X:
    res = 2*C*Y + A*(X-Y)
  else:
    res = 2*C*X

print(res)
      

Measured memory_bytes: 3064
#!/usr/bin/perl
my ($n,$h,$w) = map {$_ - 0} split(/[\s]+/io,<STDIN>);
my $cnt = 0;
for(my $i=0;$i<$n;$i++){
  my ($a,$b) = map {$_ - 0} split(/[\s]+/io,<STDIN>);
  $cnt++ if $a>=$h and $b>=$w;
}
print "$cnt\n";



Measured memory_bytes: 384
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node{int p,l,r;};
struct Node T[MAX];
int n;


void preParse(int u){
	if(u==NIL)return;
	printf(" %d",u);
	preParse(T[u].l);
	preParse(T[u].r);
}


void inParse(int u){
	if(u==NIL)return;
	inParse(T[u].l);
	printf(" %d",u);
	inParse(T[u].r);
}


void postParse(int u){
	if(u==NIL)return;
	postParse(T[u].l);
	postParse(T[u].r);
	printf(" %d",u);
}

int main(){
	int i,v,l,r,root;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		T[i].p=NIL;
	}
	
	for(i=0;i<n;i++){
		scanf("%d %d %d",&v,&l,&r);
		T[v].l=l;
		T[v].r=r;
		if(l!=NIL)T[l].p=v;
		if(r!=NIL)T[r].p=v;
	}
	
	for(i=0;i<n;i++)if(T[i].p==NIL)root=i;
	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n")	;
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
	
	return 0;
}


Measured memory_bytes: 2076
#include<stdio.h>

using namespace std;

int main()
{
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	long long ans1, ans2;
	ans1 = a * b;
	ans2 = c * d;
	printf("%lld\n", ans1 >= ans2 ? ans1 : ans2);
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    if (N % 1000 == 0) {
        cout << 0 << endl;
    } else {
        cout << 1000 - N % 1000 << endl;
    }
}


Measured memory_bytes: 3632
import itertools

N = int(input())

A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))

#どこで下の行に移るか
csA1 = list(itertools.accumulate(A1))
csA2 = list(itertools.accumulate(A2))

#print(csA1)
#print(csA2)

ans = A1[0] + csA2[-1]
for i in range(N-1):
    tmp = csA1[i] + (csA2[-1] - csA2[i]) + A2[i]
    ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 3064
/*  AtCoder Grand Contest 017. Problem D, by Abreto<m@abreto.net>. */
#include <cstdio>
#include <vector>

using namespace std;

#define MAXN    100001

int N;
vector<int> conj[MAXN];
int visited[MAXN];

int sg(int id)
{
    int ret = 0;
    visited[id] = 1;
    for(auto p : conj[id])
        if(!visited[p])
            ret ^= sg(p)+1;
    return ret;
}

int main(void)
{
    int i = 0;
    int xi = 0, yi = 0;

    scanf("%d", &N);
    for(i = 1;i < N;++i)
    {
        scanf("%d%d", &xi, &yi);
        conj[xi].push_back(yi);
        conj[yi].push_back(xi);
    }
    printf("%s\n", (0==sg(1))?"Bob":"Alice");

    return 0;
}


Measured memory_bytes: 9216
#include <iostream>
#include <vector>
#include <queue>

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

    int n, m;
    std::cin >> n >> m;

    std::vector<std::vector<int> > graph(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        std::cin >> a >> b;
        --a, --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    std::vector<int> dist(n, -1);
    std::queue<int> que;
    std::vector<int> pre(n, -1);

    dist[0] = 0;
    que.push(0);

    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (int u : graph[v]) {
            if (dist[u] != -1)
                continue ;
            dist[u] = dist[v] + 1;
            que.push(u);
            pre[u] = v;
        }
    }

    std::cout << "Yes" << std::endl;
    for (int i = 1; i < n; ++i)
        std::cout << pre[i] + 1 << std::endl;
    return 0;
}

Measured memory_bytes: 10564
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <memory.h>
#include <iomanip>
using namespace std;

typedef pair<int,int> pi;

const int Maxn=200005;
const int INF=1e9+5;
const long double pai=3.1415926535897932384626;

int main(){
	int x1,y1,x2,y2;
	int f[Maxn];
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	int lx=min(x1,x2),ux=max(x1,x2),ly=min(y1,y2),uy=max(y1,y2);
	int n;
	scanf("%d",&n);
	int x,y;
	vector<pi> p;
	vector<int> h;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&x,&y);
		if(x>=lx&&x<=ux&&y>=ly&&y<=uy) p.push_back(pi(x,y));
	}
	sort(p.begin(),p.end());
	for(int i=0;i<p.size();i++){
		h.push_back(p[i].second);
	}
	if(x1>x2){
		swap(x1,x2);
		swap(y1,y2);
	}
	if(x1!=x2&&y1!=y2){
	if(y1<=y2){
		fill(f,f+Maxn,INF);
		for(int i=0;i<h.size();i++){
			int k=upper_bound(f+1,f+Maxn,h[i])-f;
			f[k]=h[i];
		}
		int id=lower_bound(f+1,f+Maxn,INF)-f-1;
		int d=min(ux-lx,uy-ly);
		cout<<fixed<<setprecision(11)<<(long double)100*(ux-lx+uy-ly)-(long double)min(id,d)*20+(long double)min(id,d)*5*pai+(long double)max(0,id-d)*(10*pai-20)<<"\n";
	}
	else{
		fill(f,f+Maxn,INF);
		reverse(h.begin(),h.end());
		for(int i=0;i<h.size();i++){
			int k=upper_bound(f+1,f+Maxn,h[i])-f;
			f[k]=h[i];
		}
		int id=lower_bound(f+1,f+Maxn,INF)-f-1;
		int d=min(ux-lx,uy-ly);
		cout<<fixed<<setprecision(11)<<(long double)100*(ux-lx+uy-ly)-(long double)min(id,d)*20+(long double)min(id,d)*5*pai+(long double)max(0,id-d)*(10*pai-20)<<"\n";
	}
	}
	if(x1==x2){
		if(p.size()==1) cout<<fixed<<setprecision(11)<<(long double)100*(ux-lx+uy-ly)-(long double)20+(long double)10*pai<<"\n";
		else cout<<fixed<<setprecision(11)<<(long double)100*(ux-lx+uy-ly)<<"\n";
	}
	else if(y1==y2){
		if(p.size()==1) cout<<fixed<<setprecision(11)<<(long double)100*(ux-lx+uy-ly)-(long double)20+(long double)10*pai<<"\n";
		else cout<<fixed<<setprecision(11)<<(long double)100*(ux-lx+uy-ly)<<"\n";
	}
return 0;
}

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

using namespace std;

#define ll long long int
#define get(a) ll a; cin >> a;
#define show(a) cout << a << endl;
#define full(p) p.begin(), p.end()
#define sz(a) (ll)(a.size())
#define pb push_back

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout<<fixed;
	////////////////////////////////
	string s;
	cin >> s;
	int n = s.size();
	if(n == 2)
	{
		// deal with this case separately here
		if(s[0] == s[1])
		{
			cout << 1<< " " << 2 << endl;
		}
		else
			cout << -1 << " " << -1 << endl;
		return 0;
	}
	for(int i = 3; i<n ; i++)
	{
		set<char>a (s.begin() + i-3, s.begin() + i);
		// for(auto i : a)
			// cout << i<< endl;
		if(a.size() == 2)
		{
			cout << i-2 << " " << i << endl;
			return 0;
		}
	}	
	cout << -1 << " " << -1 << endl;

	return 0;
}

Measured memory_bytes: 3728
def resolve():
    n = int(input())
    cnt = 0
    for i in range(n):
        a, b = map(int, input().split())
        if a == b:
            cnt += 1
        else:
            cnt = 0
        if cnt >= 3:
            print('Yes')
            return
    print('No')

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 62332
/*g++ main.cpp -o main.out*/
/*./main.out*/

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

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

int main()
{
    int n,f=1;
    cin>>n;
    while(n--)
    {
        int x;
        cin>>x;
        if(x%2==0)
        {
            if(x%3!=0&&x%5!=0)
                f=0;
        }
    }
    if(f)cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int x, y, d, r;
  fscanf(stdin, "%d %d", &x, &y);
  do {
    d = x/y;
    r = x%y;
    x = y;
    y = r;
  } while (r);
  fprintf(stdout, "%d\n", x);

  return 0;
}



Measured memory_bytes: 2104
#!/usr/bin/env python
# -*- coding: utf-8 -*-

n, m, d = [int(i) for i in input().split()]

"""
from scipy.special import perm, comb

d == 0
def expectation_0(n, m, d):
    return sum([i * comb(m-1, k) * (n/n**2)**k * (1 - n/n**2)**(m-1-k) for k in range(0, m-1)])

d != 0
def expectation_0(n, m, d):
    return sum([i * comb(m-1, k) * (2(n-d)/n**2)**k * (1 - 2(n-d)/n**2)**(m-1-k) for k in range(0, m-1)])

def expectation(p, m):
        return sum([k * comb(m-1, k) * p**k * (1 - p)**(m-1-k) for k in range(0, m-1)])
"""
if d == 0:
    p = 1 / n  # n / n**2
    print((m - 1) * 1/n)

else:
    p = 2 * (n - d) / n**2
    print((m - 1) * p)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=2e9;

int main(){
    int n,t;
    cin>>n>>t;
    int fin=0,cnt=0;
    for(int i=0;i<n;i++){
        int ti; cin>>ti;
        if(fin<=ti)cnt+=t;
        else cnt+=t-(fin-ti);
        fin=ti+t;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

    ios::sync_with_stdio(false);

    int A, B, C, D, T;
    cin >> A >> B >> C >> D;
    if(A < B){
        T = A;
    }else{
        T = B;
    }

    if(C < D){
        T += C;
    }else{
        T+= D;
    }

    cout << T;

}


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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int n, tmp;
    vector<int> h;
    cin >> n;
    REP(i, n){
        cin >> tmp;
        h.push_back(tmp);
    }
    int hoge[100001];
    hoge[0] = 0;
    for(int i=1;i<n; i++){
        if(h[i-1]>= h[i]) hoge[i] = hoge[i-1]+1;
        else hoge[i] = 0;
    }
    REP(i, n){
        if(hoge[i] > ans) ans = hoge[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1144