akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  vector<ll> v(3*N);
  vector<ll> pre(N+1);
  vector<ll> suf(N+1);
  priority_queue<ll, vector<ll>, greater<ll> > preq;
  priority_queue<ll> sufq;
  ll sum1 = 0;
  ll sum2 = 0;
  rep(i,3*N){
    cin >> v[i];
    if(i<N){
      sum1+=v[i];
      preq.push(v[i]);
    }
    if(i>=2*N){
      sum2+=v[i];
      sufq.push(v[i]);
    }
  }
  pre[0] = sum1;
  rep(i,N){
    pre[i+1] = pre[i];
    if(v[i+N] > preq.top()){
      pre[i+1] += v[i+N] - preq.top();
      preq.pop();
      preq.push(v[i+N]);
    }
  }
  suf[N] = sum2;
  per(i,N){
    suf[i] = suf[i+1];
    if(v[i+N] < sufq.top()){
      suf[i] += v[i+N] - sufq.top();
      sufq.pop();
      sufq.push(v[i+N]);
    }
  }

  ll maximum;
  rep(i,N+1){
    //cout << pre[i] SP suf[i] << endl;
    if(i==0) maximum = pre[i] - suf[i];
    else maximum = max(maximum, pre[i] - suf[i]);
  }
  cout << maximum << endl;
  return 0;
}


Measured memory_bytes: 6516
N = int(input())
ans = [0] * (N + 5)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if N >= tmp:
                ans[tmp] += 1

for i in range(1, N+1):
    print(ans[i])


Measured memory_bytes: 69232
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            bool ret = true;
            var input = c2d(RL());
            double dret=Math.Pow(input/3, 3.0);
            Console.WriteLine(dret);
            Console.ReadLine();

        }
        static bool comprev(string s) {return string.Compare(s, new string(s.Reverse().ToArray())) == 0; }
        static string RL() { return Console.ReadLine().Trim(); }
        static IEnumerable<string> spr(string s) { return s.Split(' '); }
        static int c2i(string c) { return int.Parse(c); }
        static double c2d(string c) { return double.Parse(c); }
        static string bool2ret(bool b) { return b ? "Yes" : "No"; }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define SZ(a) ((int)a.size())
//#pragma GCC optimize(2)
using namespace std;
//const double eps=1e-6;
//typedef complex<double>C;
//const double PI(acos(-1.0));
//for(int mask=i;mask>0;mask=(mask-1)&i)
//int a[25]= { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
//__gcd, atan2(y,x)=y/x , __int128
//c(n,k)=c(n-1,k-1)+c(n-1,k)
//c(i,r),i for r to n =c(n+1,r+1)
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){int s=0;while(x){s+=BIT[x];x-=x&-x;}return s;}
//int find(int x){return x==p[x]?x:p[x]=find(p[x]);}
//LL pw(LL a,LL b){LL t=1;for(;b;b>>=1,a=a*a%M)b&1?t=t*a%M:0;return t;}
//log() = ln() , log(x)/log(y)=log(y)-base-x
//INT_MAX 127,INT_MIN 128
//isalnum() decimal digit or an uppercase or lowercase letter
//int dw[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
//int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
//cout<<fixed<<setprecision(12)<<ans<<endl;
//__builtin_popcount(mask)
const int N=3005;
int n,M;
LL c[N][N];
LL s[N][N];
LL p2[N];
LL pw(LL a,LL b,LL M){LL t=1;for(;b;b>>=1,a=a*a%M)b&1?t=t*a%M:0;return t;}
int main() {
	cin>>n>>M;
	p2[0]=1;
	FOR(i,1,n){
		c[i][0]=c[i][i]=1;
		FOR(j,1,i-1){
			c[i][j]=c[i-1][j-1]+c[i-1][j];
			c[i][j]%=M;
		}
		p2[i]=p2[i-1]*2%M;
	}
	s[0][0]=1;
	FOR(i,1,n+1)
		FOR(j,1,i+1){
			s[i][j]=s[i-1][j-1]+s[i-1][j]*j;
			s[i][j]%=M;
		}
	LL ans=0;
	FOR(i,0,n){
		LL A=pw(2,pw(2,n-i,M-1),M)*c[n][i]%M;
		
		//cout<<A<<endl;
		FOR(j,0,i){
			LL B=pw(2,1LL*(n-i)*j%(M-1),M);
			if(i&1){
				ans=ans-A*B%M*s[i+1][j+1]%M+M;
				ans%=M;
			}
			else{
				ans=ans+A*B%M*s[i+1][j+1]%M;
				ans%=M;
			}
		}
	}
	cout<<(ans+M)%M<<endl;
}

Measured memory_bytes: 139648
use proconio::input;

fn main() {
    input! {
        n: usize,
        p: usize,
        aa: [usize; n],
    }

    let even_count = aa.iter().copied().filter(|&x| x % 2 == 0).count();
    let odd_count = n - even_count;
    let ans = match p {
        1 => {
            let mut odd_comb = 0;
            let mut even_comb = 0;
            for i in (1..=odd_count).step_by(2) {
                odd_comb += comb(odd_count, i);
            }
            for i in 0..=even_count {
                even_comb += comb(even_count, i);
            }
            odd_comb * even_comb
        },
        0 => {
            let mut odd_comb = 0;
            let mut even_comb = 0;
            for i in (0..=odd_count).step_by(2) {
                odd_comb += comb(odd_count, i);
            }
            for i in 0..=even_count {
                even_comb += comb(even_count, i);
            }

            odd_comb * even_comb
        }
        _ => {
            unreachable!();
        }
    };

    println!("{}", ans);
}

fn comb(n: usize, r: usize) -> usize {

    let r = std::cmp::min(n-r, r);
    let mut ret = 1;

    let mut divs = vec![];
    for i in 1..=r {
        divs.push(i);
    }
    let mut used = vec![false; divs.len()];


    for i in 0..r {
        ret *= n-i;
        for (div, used) in divs.iter().zip(used.iter_mut()) {
            if *used {
                continue;
            }
            if ret % div == 0 {
                *used = true;
                ret /= div;
            }
        }
    }

    ret
}


Measured memory_bytes: 2156
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

int n,a,b;
vi h;

bool f(int t){
    int c=0;
    rep(i,n){
        if(h[i]>b*t){
            int d=a-b;
            c+=(h[i]-b*t+d-1)/d;
        }
    }
    return c<=t;
}

void run(){
    cin>>n>>a>>b;
    rep(i,n){
        int x;
        cin>>x;
        h.pb(x);
    }
    SORT(h);
    int l=0,r=h[n-1]/b+1;
    while(r-l>1){
        int m=(l+r)/2;
        (f(m)?r:l)=m;
    }
    cout<<r<<endl;
}

Measured memory_bytes: 1400
# N = 15
# ARR = [1, 3, 5, 2, 1, 3, 2, 8, 8, 6, 2, 6, 11, 1, 1]

# N = 5
# ARR = [1, 2, 1, 3, 7]

N = int(input())
ARR = list(map(int,input().split()))

def calculate(n, arr):
    dict = {}
    for i in range(n):
        if dict.get(arr[i]) == None:
            dict.__setitem__(arr[i], 1)
        else:
            tmp = dict.get(arr[i])
            dict.__setitem__(arr[i], tmp + 1)

    k1 = len(dict.keys())

    if k1 % 2 == 0:
        print(k1 - 1)
    else:
        print(k1)


calculate(N, ARR)


Measured memory_bytes: 21744
#include<bits/stdc++.h>
#define Pasharin using namespace std

Pasharin;
int main(){
  int n;
  int a[]={5,7,5,7,7};
  while(cin>>n,n){
    string s[n];
    int x=0,y=0;
    for(int i=0;i<n;++i) cin>>s[i];
    int j=0;
    bool flag=false;
    for(j=0;j<n;++j){
      for(int i=j;i<n;++i){
        x+=(int)s[i].size();
        if(x==a[y]){
          x=0;
          y++;
          if(y==5){
            cout<<j+1<<endl;
            flag=true;
            break;
          }
        }
        else if(x>a[y]){
          x=0,y=0;
          break;
        }
      }
      if(flag) break;
    }
  }
  return 0;
}

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

using namespace std;

vector<vector<int>> f;
vector<vector<int>> b;
vector<vector<int>> g;
vector<bool> visited;
vector<int> group;

void search(int n, int ind) {
  if (visited[n]) return;
  visited[n] = true;
  group[n] = ind;
  g[ind].push_back(n);
  for (auto m : f[n]) {
    search(m, ind);
  }
}

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  f.assign(N, vector<int>());
  b.assign(N, vector<int>());
  g.assign(N, vector<int>());
  
  for (int i = 0; i < M; i++) {
    int a, b; cin >> a >> b; a--; b--;
    f[a].push_back(b);
    f[b].push_back(a);
  }
  for (int i = 0; i < K; i++) {
    int c, d; cin >> c >> d; c--; d--;
    b[c].push_back(d);
    b[d].push_back(c);
  }
  visited.assign(N, false);
  group.assign(N, -1);
  for (int i = 0; i < N; i++) {
    if (group[i] != -1) continue;
    search(i, i);
  }

  for (int i = 0; i < N; i++) {
    int result = g[group[i]].size()-f[i].size()-1;
    for (auto j : b[i]) {
      if (group[i] == group[j]) result--;
    }
    cout << result << ' ';
  }
  cout << endl;
  return 0;
}

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

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni();
        int x = ni();
        int[] a = nia(n);

        long ans = 0;

        if (a[0] + a[1] > x || a[0] + a[1] - x > a[1]) {
            int s = a[0] + a[1] - x;
            int tmp = a[0] + - x;
            a[1] = 0;
            a[0] -= tmp;
            ans += s;
        }
        for (int i = 1; i < n; i++) {
            if (a[i - 1] + a[i] > x) {
                int s = a[i - 1] + a[i] - x;
                a[i] -= s;
                ans += s;
            }
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 30496
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 100001
#define INF (ll)1e18
#define pll pair<ll,ll>
#define pii pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define pi 3.1415926535897



int main() {

    get3(n,m,k);

    vector<string> A(n);
    vector<vector<ll>> dp(n, vector<ll>(m,0));
    rep(i,n)
        cin >> A[i];

    ll p = 0, last;
    map<ll,ll> prev;
    for(ll i=0;i<m;i++) {
        for(ll j=0;j<n;j++) {
            if(A[j][i]=='#') {
               prev[i] = p; 
               last = i;
               p = i+1;;
               break;
            }
        }
    }

    ll c = 1;
    for(auto it:prev) {
        ll idx1 = it.second, idx2 = it.first;
        ll p = 0, lasti;
        map<ll,ll> previ;

        for(ll i=0;i<n;i++) {
            if(A[i][idx2]=='#') {
               previ[i] = p; 
               lasti = i;
               p = i+1;
            }
        }

        if(last==idx2)
            idx2 = m-1;
        for(auto it2:previ) {
            ll odx1 = it2.second, odx2 = it2.first;
            if(odx2==lasti)
                odx2 = n-1;

            for(ll i=odx1;i<=odx2;i++)
                for(ll j=idx1;j<=idx2;j++)
                    dp[i][j] = c;
            c++;
        }
    }

    for(auto i:dp) {
        for(auto j:i)
            printf("%lld ", j);
        printf("\n");
    }

    return 0;  
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;
}


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

int main(){
    int N,X,cnt=1;
    cin >> N;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin >> vec[i];
    }
    X=vec[0];
    while(true){
        if(X==2){
            cout << cnt << endl;
            return 0;
        }
        X=vec[X-1];
        cnt++;
        if(cnt>100010){
            cout << -1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;
    ll a[n];
    rep(i, n){
        cin >> a[i];
    }

    bool is_approved = true;

    rep(i, n){
        if(a[i] % 2 == 1) continue;

        if(a[i] % 3 != 0 && a[i] % 5 != 0){
            is_approved = false;
            break;
        }
    }

    if(is_approved){
        cout << "APPROVED" << endl;
    }
    else{
        cout << "DENIED" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
#include<regex>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)); //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl; }
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

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

	vector<double> A(N);
	rep(i, N) cin >> A[i];

	double ans = 0;
	for (int i = 0; i < N; i++) {
		ans += 1 / A[i];
	}
	ans = 1 / ans;

	printf("%.9lf\n", ans);

	return 0;
}

Measured memory_bytes: 256
'use strict'

const inArray = (needle, haystack) => haystack.some(item => item === needle)

const main = (input) => {
    const strings = input.split('\n')[1].split('')

    let ans = 0
    for(let i = 1; i < strings.length; i++){
        let first = strings.slice(0, i)
        let last = strings.slice(i)
        let f2 = [...new Set(first)]
        let tmp = 0
        for(let j = 0; j < f2.length; j++){
            if(inArray(f2[j], last)){
                tmp++
            }
        }
        if(ans < tmp){
            ans = tmp
        }
    }
    console.log(ans)
}

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

Measured memory_bytes: 8104
#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <list>
#include <iomanip>
#include <numeric>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;

template<class Type>
Type modpow(Type a, Type n, Type mod)
{
	Type res = 1;
	while (0 < n) {
		if (n & 1) {
			res = res * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

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

	int n = min(s.size(), t.size());
	for (int i = 0; i < n; i++) {
		if (s[i] < t[i]) {
			cout << "Yes" << endl;
			return 0;
		}
		else if (t[i] < s[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	if (s.size() < t.size()) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
const double PI=3.14159265358979323846;
int main() {
    int n;
    cin >> n;
    vector <int> s(n);
    for(int i=0;i<n;++i) cin >> s[i];
    vector <int> a(n);
    for(int i=0;i<n;++i) a[s[i]-1]=i+1;
    for(int i=0;i<n;++i) cout << a[i] << endl;
}


Measured memory_bytes: 1664
#include <stdio.h>

int main() {
  int S, h, m, s;
  scanf("%d", &S);
  h = S / 3600;
  m = (S % 3600) / 60;
  s = S % 60;
  printf("%d:%d:%d\n", h, m, s);
  return 0;
}



Measured memory_bytes: 2104
size = gets.to_i
nums = gets.split(' ').map(&:to_i)

def devided? (nums)
  nums.all?(&:even?)
end

def devide_by_2 (nums)
  nums.map{|n| n / 2}
end

def recursive_devide (nums)
  if devided? nums
    recursive_devide(devide_by_2(nums)) + 1
  else
    0
  end
end

p recursive_devide(nums)

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
int main() {
    // 入力受け取り, 入次数も管理する
string s;
    cin >> s;
int flag=0;
for(int i=0;i<(int)(s.length());i++){
if(i%2==1){
if(!(s[i]=='L' || s[i]=='U' || s[i]=='D'))flag=1;
}else{
if(!(s[i]=='R' || s[i]=='U' || s[i]=='D'))flag=1;

}
}
if(flag==0)
cout <<"Yes";
else
cout <<"No";






}




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

#define rep(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  int n; cin >> n;
  vi a(n);
  int h = (n-1)/2,t = (n+1)/2;
  rep(i,n){
    if(i%2 == 0){
      cin >> a[h];
      h--;
    }else{
      cin >> a[t];
      t++;
    }
  }
  if(n%2 == 1){
    rep(i,n-1) cout << a[i] << " ";
    cout << a[n-1] << endl;
  }else{
    ROF(i,n,1) cout << a[i] << " ";
    cout << a[0] << endl;
  }
}
  


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

int main(){
  int N;
  cin >> N;
  vector<int> input(N);
  for(int i = 0; i < N; i++){
    cin >> input.at(i);
  }
  
  // 左から累積最大
  vector<int> leftmax(N);
  leftmax[0] = input[0];
  for(int i = 1; i < N; i++){
    leftmax[i] = max(leftmax[i-1], input[i]);
  }
  
  // 右から累積最大
  vector<int> rightmax(N);
  rightmax[N-1] = input[N-1];
  for(int i = N-2; i >= 0; i--){
    rightmax[i] = max(rightmax[i+1], input[i]);
  }
  
  for(int i = 0; i < N ; i++){
    if(i==0){
      cout << rightmax[i+1] << endl;
    } else if(i==N-1){
      cout << leftmax[i-1] << endl;
    } else {
      cout << max(leftmax[i-1], rightmax[i+1]) << endl;
    }
  }
   
}


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

int main() {
	int W;
	int H;
	int x;
	int y;
	int r;

	cin >> W >> H >> x >> y >> r;

	if (x - r>=0 && x + r<=W && y - r>=0 && y + r<=H) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


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

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

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

ll calcDiff(ll cx, ll cy, ll x, ll y)
{
  return abs(x - cx) + abs(y - cy);
}

void solve()
{
  ll n, x, y, h;
  cin >> n;
  vector<tuple<ll, ll, ll>> a(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> x >> y >> h;
    a[i] = make_tuple(h, x, y);
  }

  sort(a.rbegin(), a.rend());

  for(ll cx = 0; cx <= 100; ++cx)
  {
    for(ll cy = 0; cy <= 100; ++cy)
    {
      bool ok = true;
      ll ch = calcDiff(cx, cy, get<1>(a[0]), get<2>(a[0])) + get<0>(a[0]);
      for(const auto& t : a)
      {
        ll diff = calcDiff(cx, cy, get<1>(t), get<2>(t));
        ok &= ( ( ch == diff + get<0>(t) ) || (diff > ch && get<0>(t) == 0) );
      }
      if (ok)
      {
        cout << cx << " " << cy << " " << ch;
        return;
      }
    }
  }
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3520
let make_list f t step =
  let rec make_list_inner c t lst =
    if c >= t then lst else make_list_inner (c+step) t (c::lst)
  in
  List.rev (make_list_inner f t [])

let process lst x =
  match lst with
    [] -> (0, [x])
  | hd::rest ->
     match x with
       0 -> (hd, rest)
     | _ -> (0, x::hd::rest)
    
let () =
  let rec read lst =
    try let (poped, new_lst) = (Scanf.scanf "%d\n" (process lst)) in
        if poped > 0 then (Printf.printf "%d\n" poped) else ();
        read new_lst
    with End_of_file ->
         ()
  in
  read []
;;

Measured memory_bytes: 2416
from fractions import gcd

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a, b = map(int, input().split())
c = gcd(a, b)
fact = factorization(c)
if fact[0][0] == 1:
    print(1)
else:
    print(len(fact) + 1)

Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int w,h,n;
	cin >> w >> h >> n;
	int a[w][h]={0};
	int ans=0;
	for(int i=0;i<n;i++)
	{
		int x,y,z;
		cin >> x >> y >> z;
		if(z==1)
		{
			for(int i=0;i<x;i++)
			{
				for(int j=0;j<h;j++)
				{
					a[i][j]=1;
				}
			}
		}
		if(z==2)
		{
			for(int i=x;i<w;i++)
			{
				for(int j=0;j<h;j++)
				{
					a[i][j]=1;
				}
			}
		}
		if(z==3)
		{
			for(int i=0;i<w;i++)
			{
				for(int j=0;j<y;j++)
				{
					a[i][j]=1;
				}
			}
		}
		if(z==4)
		{
			for(int i=0;i<w;i++)
			{
				for(int j=y;j<h;j++)
				{
					a[i][j]=1;
				}
			}
		}
	}
	for(int i=0;i<w;i++)
	{
		for(int j=0;j<h;j++)
		{
			if(a[i][j]==0)
			ans++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

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

ll memo[444][444],a[444];
bool done[444][444];

ll solve(int i, int j){
	int k;
	if(done[i][j]){
		return memo[i][j];
	}
	done[i][j] = true;
	if(j-i<2){
		memo[i][j] = 0ll;
		return memo[i][j];
	}
	memo[i][j] = INFLL;
	for(k=i+1; k<j; ++k){
		memo[i][j] = min(memo[i][j],solve(i,k)+solve(k,j));
	}
	for(k=i; k<j; ++k){
		memo[i][j] += a[k];
	}
	return memo[i][j];
}

int main(void){
	int n,i;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a[i];
	}
	cout << solve(0,n) << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main()
{
    int a, h;
    scanf("%d %d", &h, &a);
    if(h%a==0) printf("%d", h/a);
    else
    {
        if(h>a) printf("%d", (h/a)+1);
        else printf("1");
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String args[]) {

        String s = sc.nextLine();
        long k = sc.nextLong();

        int numOfOnes = 0;
        int ans = 1;

        for (char ch : s.toCharArray()) {
            if (ch != '1') {
                ans = Integer.valueOf(String.valueOf(ch));
                break;
            } else {
                numOfOnes++;
            }
        }

        System.out.println(k <= numOfOnes ? "1" : ans);

    }

}


Measured memory_bytes: 21844
#include <stdio.h>
#include <iostream>
using namespace std;
int main(){
	int a;
	cin>>a;
	int h=a/(60*60);
	int m=(a-h*(60*60))/60;
	int s=a%60;
	cout<<h<<":"<<m<<":"<<s<<endl;
	return 0;
}

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

int main()
{
    ll a, b, n;
    cin >> a >> b >> n;

    n = min(b - 1, n);

    ll max = floor(a * n / b) - a * floor(n / b);

    cout << max << endl;
    return 0;
}

Measured memory_bytes: 3604
fn main() {
    let mut n: usize = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim_end().parse::<usize>().unwrap() - 1
    };

    let mut ans = Vec::new();
    let mut x = 1;
    loop {
        let c = (n % (x * 26) / x + 'a' as usize) as u8 as char;
        ans.push(c);
        x *= 26;
        if n < x { break; }
        n -= x;
    }

    let ans = ans.iter().rev().collect::<String>();
    println!("{}", ans);
}

Measured memory_bytes: 2140
#include <stdio.h>
int main(void){
	int H,W;
	int i,j;
	for(;;){
		scanf("%d %d",&H,&W);
		if((H == 0)&&(W == 0))break;
		for ( i = 0; i < H; i++ ){
			for ( j = 0; j < W; j++ ){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int l,r;
    int s=0;
    for(int i=0;i<n;i++){
        cin>>l>>r;
        s=s+r-l+1;
    }
    cout<<s<<endl;
    return 0;
    // Your code here!
    
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define prinrynl(a) printf(a ? "yes\n" : "no\n")
#define prinryn(a) printf(a ? "Yes\n" : "No\n")
#define prinrYN(a) printf(a ? "YES\n" : "NO\n")
#define prinrin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)
#define all(x) (x).begin(), (x).end()

using ll = long long;

const int INF = 2147483647;
const ll LINF = ll(9223372036854775807);
const ll MOD = 1000000007;

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>

using namespace std;

int ggd(int number1, int number2) {
	int m = number1;
	int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}

	while (m != n) {
		int temp = n;
		n = m - n;
		m = temp;
	}

	return m;
}

int lcm(int number1, int number2) {
	return number1 * number2 / ggd(number1, number2);
}

bool is_prime(int64_t x) {
	for (int64_t i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

/*-----------------------------------------ここまでライブラリとか-----------------------------------------*/



int main() {

	int sx, sy, tx, ty;
	scanf("%d%d%d%d", &sx, &sy, &tx, &ty);
	int x = sx, y = sy;
	while (y < ty) {
		++y;
		printf("U");
	}
	while (x < tx) {
		++x;
		printf("R");
	}
	while (sy < y) {
		--y;
		printf("D");
	}
	while (sx < x) {
		--x;
		printf("L");
	}
	//二週目
	--x;
	printf("L");
	while (y < ty + 1) {
		++y;
		printf("U");
	}
	while (x < tx) {
		++x;
		printf("R");
	}
	--y;
	printf("D");
	++x;
	printf("R");
	while (sy - 1 < y) {
		--y;
		printf("D");
	}
	while (sx < x) {
		--x;
		printf("L");
	}
	++y;
	printf("U");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define maxi 111111
#define mp make_pair
#define ll long long
#define mod 1e9+7

using namespace std;

ll a[maxi];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,i;
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>a[i];
    }
    ll x,y,ans=0;
    for(i=1;i<=n;i++){
        x=a[i];
        y=a[a[i]];
        if(y==i)ans++;
    }
    cout<<(ans/2)<<endl;

    return 0;
}



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

int main(){
    int k=0,u=0,p=0,c=0;
    int cnt = 0;
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++){
        if(s[i] == 'K') k++;
        else if(s[i] == 'U') u++;
        else if(s[i] == 'P') p++;
        else if(s[i] == 'C') c++;
    }
    while(1){
        if(k != 0 && u != 0 && p != 0 && c != 0){
            k--;
            u--;
            p--;
            c--;
            cnt++;
        }
        else break;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
#define found(m,x) ((m).find(x)!=(m).end())
#define uset unordered_set
#define umap unordered_map
#define db(x) cerr << #x << " == " << x << ";\n";
#define a(x) x.begin(),x.end()
#define input(v,n) for(int i=0;i<n;i++)cin>>v[i]
typedef vector<int> vi;
typedef pair<int,int> pi;

const int nax = 1e5+7;
const int mod = 1e9+7; //1e9+2667
const int inf = numeric_limits<int> :: max();
// ===================== MANASH =================== //

int n,m;

void test() {

	cin >> n;
	vector<int> b;
	b.push_back(inf);
	for(int i = 0; i < n-1; i++) {
		int t;
		cin >> t;
		b.push_back(t); 
	}
	b.push_back(inf);
	int s = 0;
	for( int i = 1; i <= n; i++) {
		s += min(b[i-1],b[i]); 
	}

	cout << s;
}

signed main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);

	#ifdef LOCAL
	freopen("input.txt","r",stdin);
	cout<<"Time Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec.\n";
	#endif

	int T = 1;
	//cin >> T;
	while(T--) {
		test();
		cout << "\n";
	}
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;  
int a,b;
int main()  
{  
    cin>>a>>b;
    if(a<0&&b<0)
    {
        if(!((b-a)&1))
            cout<<"Negative"<<endl;
        else
            cout<<"Positive"<<endl;
        return 0;
    }
    if(a>0&&b>0)
    {
        cout<<"Positive"<<endl;
        return 0;
    }
    cout<<"Zero"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define INF 10000000; 


int partition(int A[], int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j < r;j++) {
		if (x >= A[j]) {
			i = i + 1;
			swap(A[i], A[j]);
		}
	}
	swap(A[i + 1], A[r]);
	return i + 1;
}
void quicksort(int A[], int p, int r) {
	if (p < r) {
		int q = partition(A, p, r);
		quicksort(A, p, q - 1);
		quicksort(A, q + 1, r);
	}
}

int getNumberOfCoin(int C[], int n, int m) {
	int T[50000];
	for (int j = 0;j <= n;j++) {
		T[j] = INF;
	}
	T[0] = 0;
	for (int i = 0;i < m;i++) {
		for (int j = 0;j <= n;j++) {
			if (j - C[i] >= 0) {
				T[j] = min(T[j], T[j - C[i]] + 1);
			}
		}
	}
	return T[n];
}
int knapsack(int w, int n, int* v, int* ww) {
	int W[101][101];
	for (int j = 0;j <= w;j++) {
		W[0][j] = 0;
	}
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++) {
			for (int j = 0;j <= w;j++) {
				if (j - ww[k] < 0) {
					W[i + 1][j] = W[i][j];
				}
				if (j - ww[i] >= 0) {
					W[i + 1][j] = max(W[i][j], W[i][j - ww[k]] + v[k]);

				}
			}
		}
	}
	return W[n][w];
}
int knapsack2(int w, int n, int* v, int* ww) {
	int W[10001];
	for (int j = 0;j <= w;j++) {
		W[j] = 0;
	}
	for (int i = 0;i < n;i++) {
		for (int j = 0;j <= w;j++) {
			if (j - ww[i] >= 0) {
				W[j] = max(W[j], W[j - ww[i]] + v[i]);
			}
		}
	}
	return W[w];
}
int main() {
	int N, W;
	cin >> N >> W;
	int v[100];
	int w[100];
	for (int i = 0;i < N;i++) {
		cin >> v[i] >> w[i];
	}
	cout <<knapsack2(W,N,v,w) << endl;

}

Measured memory_bytes: 1196
// Enjoy your stay.

#include <bits/stdc++.h>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define mt make_tuple
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

typedef istringstream iss;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef stringstream sst;
typedef vector<ll> vi;

// geometry library from hos

const double PI = acos(-1);

int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }

struct Pt{
	double x, y;
	Pt() {}
	Pt(double x, double y) : x(x), y(y) {}
	Pt operator+(const Pt &a) const { return Pt(x + a.x, y + a.y); }
	Pt operator-(const Pt &a) const { return Pt(x - a.x, y - a.y); }
	Pt operator*(const Pt &a) const { return Pt(x * a.x - y * a.y, x * a.y + y * a.x); }
	Pt operator-() const { return Pt(-x, -y); }
	Pt operator*(const double &k) const { return Pt(x * k, y * k); }
	Pt operator/(const double &k) const { return Pt(x / k, y / k); }
	double abs() const { return sqrt(x * x + y * y); }
	double abs2() const { return x * x + y * y; }
	double arg() const { return atan2(y, x); }
	double dot(const Pt &a) const { return x * a.x + y * a.y; }
	double det(const Pt &a) const { return x * a.y - y * a.x; }
	bool operator<(const Pt &a) const { return x < a.x || x == a.x && y < a.y; }
	bool operator==(const Pt &a) const { return x == a.x && y == a.y; }
	bool operator!=(const Pt &a) const { return x != a.x || y != a.y; }
};

ostream &operator<<(ostream &os, const Pt &a) { os << "(" << a.x << ", " << a.y << ")"; return os; }

// end of library from hos

Pt proj(Pt l0, Pt l1, Pt p){
	double t = (p - l0).dot(l1 - l0) / (l1 - l0).abs2();
	return l0 + (l1 - l0) * t;
}

Pt refl(Pt l0, Pt l1, Pt p){
	return p + (proj(l0, l1, p) - p) * 2;
}

int N;
Pt p[1010];
set<pi> S;

int check(int ai){
	Pt a = p[ai];
	rep(bi,N)if(bi!=ai){
		Pt b = p[bi];
		Pt l0 = (a+b)/2;
		Pt l1 = l0 + (b-l0)*Pt(0,1);
		int ok=1,c=0;
		rep(i,N){
			Pt Q = refl(l0,l1,p[i]);
			int x = floor(Q.x+EPS), y = floor(Q.y+EPS);
			if(sig(x-Q.x) || sig(y-Q.y) || !S.count(mp(x,y))){
				ok=0;break;
			}
			if(sig((p[i]-Q).abs2())==0){
				c++;
				if(c>2){
					ok=0;break;
				}
			}
		}
		if(ok)return 1;
	}
	return 0;
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>N;
	rep(i,N){
		cin>>p[i].x>>p[i].y;
		S.insert(mp(p[i].x,p[i].y));
	}
	int ok=0;
	rep2(i,1,N){
		if(sig((p[i]-p[0]).det(p[1]-p[0])))ok=1;
	}
	if(!ok)return cout<<"No"<<endl,0;
	rep(i,3){
		if(check(i))return cout<<"Yes"<<endl,0;
	}
	cout<<"No"<<endl;
}

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

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

using namespace std;

typedef long long ll;

int main()
{
    ll X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<ll> p(A);
    vector<ll> q(B);
    vector<ll> r(C);
    REP(i, A) cin >> p[i];
    REP(i, B) cin >> q[i];
    REP(i, C) cin >> r[i];

    sort(p.begin(), p.end());
    reverse(p.begin(), p.end());
    sort(q.begin(), q.end());
    reverse(q.begin(), q.end());

    priority_queue<ll, vector<ll>, greater<ll>> maxQueue;
    REP(i, X) maxQueue.push(p[i]);
    REP(i, Y) maxQueue.push(q[i]);
    REP(i, C)
    {
        maxQueue.push(r[i]);
        maxQueue.pop();
    }

    ll ans = 0;
    while(!maxQueue.empty())
    {
        ans += maxQueue.top();
        maxQueue.pop();
    }

    cout << ans << endl;
}


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

int main(void)
{
	int N, D, X;
	int ans = 0;

	cin >> N >> D >> X;
	for(int i = 0; i < N; i++) {
		int A;
		cin >> A;
		for(int j = 0; (j * A + 1) <= D; j++) {
			ans++;
		}
	}
	ans += X;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;
typedef long long LL;
/*
cout << = printf()
cin >> = scanf()

char = string
*/
/*
int main() {
	int n=0;
	string a;
	cin >> a;
	n = a[0];
	cout << n;//a[0]<<a[1]<<a[2];

	return 0;
}*/

int main() {
	int m, n;
	cin >> m >> n;
	cout << (m - 1)*(n - 1);
	return 0;
}

Measured memory_bytes: 256
n = int(raw_input())

def dfs(u,t):
    global graph
    global found
    global timestamp

    if u in found: return t
    found.add(u)
    timestamp[u] = [-1,-1]
    timestamp[u][0] = t
    t += 1
    for v in graph[u]:
        t = dfs(v,t)
    timestamp[u][1] = t
    t += 1
    return t

graph = [[] for i in range(n)]
found = set()
timestamp = {}

for i in range(n):
    entry = map(int,raw_input().strip().split(' '))
    u = entry[0]
    u -= 1
    for v in entry[2:]:
        v -= 1
        graph[u].append(v)


t = 1
for i in range(n):
    t = dfs(i,t)

for i in timestamp:
    print i+1,timestamp[i][0],timestamp[i][1]

Measured memory_bytes: 6408
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpii vector<pii>
#define vpiii vector<piii>
#define vpll vector<pll>
#define vplll vector<plll>
#define mod 1000000007

ll maax=1000001;
ll p[10000001];

 ll dp[200000];

int inv(ll x,ll y)
{
	//ll y=mod-2;
	unsigned int res=1;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%mod;
		y=y>>1;
		x=(x*x)%mod;
	}
	return res;
}
void seive()
{
	p[0]=1;
	p[1]=1;
	for(int i=2;i<maax;i++)
	{
		if(p[i]==0)
		{
			for(int j=2*i;j<maax;j+=i)
			{
				if(p[j]==0)
					p[j]=i;
	
			}
			p[i]=i;
		}
	}
}
ll md(ll a){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}
int main()
{
	int n;
	cin>>n;
	int v[10][10];
	for(int i=0;i<10;i++)
		for(int j=0;j<10;j++)
			v[i][j]=0;
	for(int i=1;i<=n;i++)
	{
		int t=i;
		while(t>=10)
		{
			t/=10;
		}
		v[t][i%10]++;

	}
	ll ans=0;
	for(int i=0;i<10;i++)
		for(int j=0;j<10;j++)
			ans+=v[i][j]*v[j][i];

	cout<<ans;
		


}


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

using namespace std;

int main()
{
  int count = 0;
  string s;
  cin >> s;
  
  for(int i = 0; i < s.size(); i++)
  {
    if(i % 2 == 0)
    {
      if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')
      {
        count++;
      }
    }
    else
    {
      if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D')
      {
        count++;
      }
    }
  }
  
  if(count == s.size())
  {
    cout << "Yes";
  }
  else
  {
    cout << "No";
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  multimap<P, int> mp;
  rep(j, m) {
    ll b, c;
    cin >> b >> c;
    P p = make_pair(c, b);
    mp.insert(multimap<P, int>::value_type(p, j));
  }
  vector<P> vec(m);
  ll updating = n;
  for(auto x = mp.rbegin(); x != mp.rend(); ++x) {
    ll nb = min(updating, x->first.second);
    ll c = x->first.first;
    vec[x->second] = make_pair(nb, c);
    updating = max(0LL, updating - nb);
  }
  priority_queue<ll, vector<ll>, greater<ll>> queue;
  rep(i, n) queue.emplace(a[i]);
  rep(j, m) {
    for(int i = 0; i < vec[j].first; i++) {
      ll y = queue.top();
      queue.pop();
      queue.emplace(max(y, vec[j].second));
    }
  }
  ll ans = 0;
  while(queue.size()) {
    ans += queue.top();
    queue.pop();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9980
/**
  @date Time-stamp: <2019-04-21 22:25:06 tagashira>
  @file a.cpp
  @brief https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_b
**/

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  int N,K;
  string S;
  cin >> N >> S >> K;

  char c =S[K-1];
  for(int i=0 ; i < N ; i++){
    if(S[i] != c){
      S[i] = '*';
    }
  }

  cout << S << "\n";

  return 0;
}


Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=5e5+5;
struct eg{int v,nx;}e[N<<1];int head[N],tot;
inline void add(R int u,R int v){e[++tot]={v,head[u]},head[u]=tot;}
int dis[N],deg[N],cnt[3],n,m,flag;ll res;
void dfs(int u,int d){
	dis[u]=d;
	go(u)if(dis[v]==-1)dfs(v,d^1);
		else if(dis[v]!=dis[u]^1)flag=1;
}
int main(){
	scanf("%d%d",&n,&m);
	for(R int i=1,u,v;i<=m;++i){
		scanf("%d%d",&u,&v);
		add(u,v),add(v,u),++deg[u],++deg[v];
	}
	memset(dis,-1,sizeof(dis));
	fp(i,1,n)if(!deg[i])++cnt[2],++res;
		else if(dis[i]==-1)flag=0,dfs(i,0),++cnt[flag],res+=2-flag;
//	printf("%lld\n",res);
	res+=1ll*cnt[2]*(n-cnt[2])<<1;
	res+=1ll*cnt[2]*(cnt[2]-1);
//	printf("%lld\n",res);
	res+=1ll*cnt[0]*(cnt[0]-1)*2+1ll*cnt[0]*cnt[1]*2+1ll*cnt[1]*(cnt[1]-1);
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 10752
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000007

int main(){

    int a,b;
    char c;
    cin >> a >> c >> b;

    if(c == '+'){
        cout << a+b << endl;
    }else{
        cout << a-b << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653

int main(){
	ll n, x, ans; cin >> n;
	if (n%2==0){
		vector<ll> a(n/2+1);
		vector<ll> bl(n/2+1);
		vector<ll> b(n/2+1);
		REP(i,n){
			cin >> x;
			if (i%2==0) a[i/2+1] = a[i/2]+x;
			else bl[i/2+1] = bl[i/2]+x;
		}
		REP(i,n/2+1) b[i] = bl[n/2]-bl[i];
		ans = a[0]+b[0];
		FOR(i,1,n/2){
			ans = max(ans, a[i]+b[i]);
		}
		cout << ans << endl;
	}
	else{
		vector<ll> a(n);
		REP(i,n) cin >> a[i];
		vector<vector<ll>> dp(n/2,vector<ll>(2));
		dp[0][0] = a[0];
		dp[0][1] = a[1];
		FOR(i,1,n/2-1){
			dp[i][0] = dp[i-1][0]+a[2*i];
			dp[i][1] = max(dp[i-1][0],dp[i-1][1])+a[2*i+1];
		}
		vector<ll> evenl(n/2+1);
		FOR(i,1,n/2) evenl[0] += a[2*i];
		FOR(i,1,n/2) evenl[i] = evenl[i-1]-a[2*i];
		ans = evenl[0];
		FOR(i,2,n/2+1){
			ll maxdp = max(dp[i-2][0], dp[i-2][1]);
			ans = max(ans, maxdp+evenl[i-1]);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 11156