akhauriyash/Code-Regression huggingface dataset:
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=2e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

ll mat[50][50], ans[50][50], d[50][50];

void add(ll &a,ll b)
{
    a += b;
    if(a >= MOD) a %= MOD;
}


int main()
{
    IOS();
    ll n, K;
    cin>>n>>K;
    REP(i,n)REP(j,n)cin>>d[i][j];
    REP(i,n)ans[i][i] = 1;
    for(int t = 0;(1LL << t) <= K;t ++)
    {
        if((1LL<<t) & K)
        {
            FILL(mat, 0);
            REP(i, n)REP(j, n)REP(k, n)add(mat[i][j], ans[i][k] * d[k][j]);
            REP(i,n)REP(j,n)ans[i][j] = mat[i][j];
        }
        FILL(mat, 0);
        REP(i, n)REP(j, n)REP(k, n)add(mat[i][j], d[i][k] * d[k][j]);
        REP(i,n)REP(j,n)d[i][j] = mat[i][j];
    }
    ll tt = 0;
    REP(i,n)REP(j,n)debug(i, j, ans[i][j]);
    REP(i,n)REP(j,n)add(tt, ans[i][j]);
    cout<<tt<<endl;
}



Measured memory_bytes: 384
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		
		String str=in.next();
		String k=in.next();
		if(isUnder100(k) && Integer.parseInt(k)<str.length()) {
			int i=0,l=Integer.parseInt(k);
			for(;i<l;i++) {
				if(str.charAt(i)>'1') {
					System.out.println(str.charAt(i));
					i=str.length();
					break;
				}
			}
			
			if(i==l)System.out.println(1);
		}
		else {
			int i=0;
			for(;i<str.length();i++) {
				if(str.charAt(i)>'1') {
					System.out.println(str.charAt(i));
					break;
				}
			}
			
			if(i==str.length())System.out.println(1);
		}
	}
	
	static boolean isUnder100(String key) {
		if(key.length()>3)return false;
		else if(key.length()<3)return true;
		else {
			if(key.charAt(0)=='1' && key.charAt(1)=='0' && key.charAt(2)=='0')return true;
			else return false;
		}
	}

}


Measured memory_bytes: 23636
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

string f(int i){
    string s = "";
    while(i > 0){
        s = (char)('0'+(i%10))+ s;
        i /= 10;
    }
    ret s;
}  

int k(string s){
    rep(i,0,sz(s)/2){
        if(s[i] != s[sz(s)-i-1])ret 0;
    }
    ret 1;
} 

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

    itn ans = 0;
    rep(i,a,b+1){
        ans += k(f(i));
    }
	P(ans);
	return  0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		int k = stdIn.nextInt();
		String s = stdIn.next();

		int len = s.length();
		System.out.println(len <= k ? s : s.substring(0,k) + "...");

		stdIn.close();
	}
}


Measured memory_bytes: 38652
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    n = II()
    h = LI()
    dp = [0 for i in range(n)]
    dp[1] = abs(h[0] - h[1])
    for i in range(2,n):
        dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))
    print(dp[n-1])
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I():
    return 
#J

#K

#L

#M
#N
# O
# P
# Q
# R
# S
# T
# U
# V
# W
# X
# Y
# Z


#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 14876
n,a,b = map(int,input().split())

margin = abs(a-b)

if (a % 2 == 0 and b % 2 == 0) or (a % 2 == 1 and b % 2 == 1):
    print(margin//2)
else:
    t = min(a-1, n-b) + 1 +(b-a-1)//2
    print(t)

Measured memory_bytes: 9160
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            int N = int.Parse(Console.ReadLine());

            string tmp = Console.ReadLine();

            var s = tmp.ToCharArray();

            int B_count = 0;
            int R_count = 0;

            for(int i=0;i<N;i++)
            {
                if(s[i] == 'B')
                {
                    B_count += 1;
                }
                else
                {
                    R_count += 1;
                }
            }
            if(R_count > B_count)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }


    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<atcoder/segtree>

using namespace std;
using namespace atcoder;

int64_t vi;
int64_t op(int64_t a,int64_t b){return a<b?b:a;}
int64_t e(){return -1;}
bool f(int64_t aj){return aj<vi;}

int32_t main(){
  int64_t n,q;
  cin>>n>>q;
  vector<int64_t> a(n);
  for(auto& ai:a)cin>>ai;
  
  using RMQ = segtree<int64_t,op,e>;
  RMQ seg(a);
  
  while(q--){
    int64_t t;cin>>t;
    if(t==1){
      int64_t x,v;cin>>x>>v;x--;
      seg.set(x,v);
    }
    if(t==2){
      int64_t l,r;cin>>l>>r;l--;r--;
      cout<<seg.prod(l,r+1)<<endl;
    }
    if(t==3){
      int64_t x;cin>>x>>vi;x--;
      int64_t res = seg.max_right<f>(x);
      cout<<res+1<<endl;
    }
  }
}


Measured memory_bytes: 8700
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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 dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct edge{
  int u,v;
  ll cost;
};
edge es[max_n];
vector<edge> G[max_n];
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
ll d[300][300];
int n;
void warshll(){
  bool used[n][n];
  rep(i,0,n)rep(j,0,n){
    used[i][j] = true;
  }
  rep(k,0,n)rep(i,0,n)rep(j,0,n){
    if(d[i][j]> d[i][k]+d[k][j]){
      cout << -1 << endl;
      return;
    }
    if(d[i][j]==d[i][k]+d[k][j] && d[i][k]>0 && d[k][j]>0){
      used[i][j] = false;
    }
  }
  ll sum = 0;
  rep(i,0,n)rep(j,i+1,n){
    if(used[i][j]){
      sum += d[i][j];
    }
  }
  cout << sum << endl;
}
int main(){
  cin >> n;
  rep(i,0,n){
    rep(j,0,n){
      cin >> d[i][j];
    }
  }
  warshll();
  return 0;
}


Measured memory_bytes: 4480
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

ll gcd(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (ll r = a % b)
		a = b, b = r;
	return b;
}

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b)
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

struct UnionFind
{
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<int> childN;
	ll r = 0;

	UnionFind(int N) : par(N), childN(N)
	{
		//最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++)
			par[i] = i, childN[i] = 1;
	}

	int root(int x)
	{
		// データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y)
	{
		// xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		r -= childN[rx] * (childN[rx] - 1) / 2;
		r -= childN[ry] * (childN[ry] - 1) / 2;
		childN[ry] += childN[rx];
		childN[rx] = 0;
		r += childN[ry] * (childN[ry] - 1) / 2;
	}

	bool same(int x, int y)
	{
		// 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//	for priority queue
//	priority_queue<ipair, vector<ipair>, greater<ipair>>
using ipair = pair<int, pair<int, int>>;
bool operator>(const ipair a, const ipair b) { return a.first > b.first; };
bool operator<(const ipair a, const ipair b) { return a.first < b.first; };

using xpair = pair<int, int>;
bool operator>(const xpair &a, const xpair &b) { return a.second > b.second || (a.second == b.second && a.first > b.first); };
bool operator<(const xpair &a, const xpair &b) { return a.second < b.second || (a.second == b.second && a.first > b.first); };
bool operator==(const xpair &a, const xpair &b) { return a.first == b.first; };

int main()
{
	ll n;
	cin >> n;
	vector<char> s;
	while (n >= 1)
	{
		int k = n % 26;
		if (k == 0)
			k = 26;
		s.push_back('a' + k - 1);
		n /= 26;
		if (k == 26)
			n--;
	}

	for(int i = s.size()-1; i >= 0; i--)
		printf("%c", s[i]);

	return 0;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N; cin >> N;
    vi B(N-1); REP(i, N-1) cin >> B[i];

    int ans = B[0] + B[N-2];
    REP(i, N-2) ans += min(B[i], B[i+1]);
    cout << ans << endl;
}
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 };
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	for (T& x : vec)
		is >> x;
	return is;
}

signed main() {
	cin >> N;
	vi v(N),x(N),y(N);
	double n = 1;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
		v[i] = i;
		n *= i + 1;
	}
	double ave = 0;
	do {
		for (int i = 1; i < N; i++) {
			double tmp = sqrt((x[v[i]] - x[v[i - 1]]) * (x[v[i]] - x[v[i - 1]]) + (y[v[i]] - y[v[i - 1]]) * (y[v[i]] - y[v[i - 1]]));
			ave += tmp / n;
		}
	} while (std::next_permutation(v.begin(), v.end()));
	printf("%.10f\n", ave);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int[] stack = new int[100];
        int idx = 0;
        while (in.hasNext()) {
            int n = in.nextInt();
            if (n == 0) {
                System.out.println(stack[--idx]);
            } else {
                stack[idx++] = n;
            }
        }
    }
}

Measured memory_bytes: 25776
namespace Test
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class Test
    {
        public static void Main(string[] args)
        {
            var t = new Test();
            var input = t.ParseIntList(t.ReadInput());
            var a = input[0];
            var b = input[1];
            var c = input[2];
            var count = 0;
            
            Console.WriteLine(t.Calc(a, b, c, count));

        }


        public int Calc(int a, int b, int c, int count)
        {
            if (a == b)
            {
                if (c % a == 0)
                {
                    return ++count;
                }
                else
                {
                    return count;
                }
            }

            if (c % a == 0)
            {
                count++;
            }

            return Calc(++a, b, c, count);
        }

        public int ReadInputOneLine()
        {
            return int.Parse(Console.ReadLine());
        }

        public string[] ReadInput()
        {
            return Console.ReadLine().Split(' ');
        }

        public List<int> ParseIntList(string[] x)
        {
            var convertedList = new List<int>(x.Length);
            for (var i = 0; i < x.Length; i++)
            {
                convertedList.Add(int.Parse(x[i]));
            }

            return convertedList;
        }

}
}


Measured memory_bytes: 18372
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    a: usize,
    s: String
    }
    let ans = if a >= 3200 {s} else {"red".to_string()};
    println!("{}", ans);
}


Measured memory_bytes: 2140
#include <iostream>
#include <cmath>

using namespace std;

struct Vector{
  double x,y;
  Vector operator-(const Vector &v)const{
    return Vector(x-v.x,y-v.y);
  }
  Vector():x(0),y(0){}
  Vector(const Vector &v):x(v.x),y(v.y){}
  Vector(double xx,double yy):x(xx),y(yy){}
  Vector& operator=(const Vector& v){
    x=v.x;
    y=v.y;
    return (*this);
  }
};

struct Triangle{
  Vector v[3];
};

double outerprod(const Vector &v1,const Vector &v2);
bool is_in(const Triangle&,const Vector&);
int main(){
  Vector v;
  Triangle t;
  while(std::cin>>t.v[0].x>>t.v[0].y>>t.v[1].x>>t.v[1].y>>t.v[2].x>>t.v[2].y>>v.x>>v.y){
     if(is_in(t,v)){
       std::cout<<"YES"<<std::endl;
     }else{
       std::cout<<"NO"<<std::endl;
     }
  }
  return 0;
}

double outerprod(const Vector &v1,const Vector &v2){
  return v1.x*v2.y-v2.x*v1.y;
}

bool is_in(const Triangle& t,const Vector& v){
  double prod1 = outerprod(t.v[1]-t.v[0],v-t.v[1]);
  double prod2 = outerprod(t.v[2]-t.v[1],v-t.v[2]);
  double prod3 = outerprod(t.v[0]-t.v[2],v-t.v[0]);
  return (prod1<0&&prod2<0&&prod3<0)||(prod1>0&&prod2>0&&prod3>0);
}

Measured memory_bytes: 3120
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] h = new int[N];
        for (int i = 0; i < N; i++) {
            h[i] = sc.nextInt();
        }

        if (N <= 1) {
            System.out.println(0);
            return;
        }
        if (N == 2) {
            System.out.println(Math.abs(h[0] - h[1]));
            return;
        }

        int cur = h[0];
        // calc

        //Math.abs(h[cur] - h[next]);
        int[] dp = new int[N];
        dp[0] = 0;
        dp[1] = Math.abs(h[0] - h[1]);

        for (int i = 2; i < N; i++) {
            dp[i] = Math.min(dp[i - 1] + Math.abs(h[i] - h[i - 1]),
                             dp[i - 2] + Math.abs(h[i] - h[i - 2]));
        }

        int min = dp[N - 1];
        System.out.println(min);
    }
}


Measured memory_bytes: 49860
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,d,p[1000]={},f=0,ans=0;
  cin>>N>>d;
  for(int i=0;i<N;i++)cin>>p[i];
  for(int i=0;i<N;i++)
    if(p[i]>d){
      if(f==0)f=1;
      ans+=p[i]-d;
    }
  if(f==1)cout<<ans<<endl;
  else cout<<"kusoge"<<endl;
  return 0;
}

Measured memory_bytes: 1164
import java.io.*;
import java.util.*;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    // private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int x = in.nextInt();
        int n = in.nextInt();
        int[] p = in.nextIntArray(n);
        Set<Integer> pp = new HashSet<>();
        for (int i : p) {
            pp.add(i);
        }

        int ans = 0;
        int minDiff = 500;
        for (int i = 0; i <= 200; i++) {
            if (pp.contains(i)) continue;
            if (Math.abs(x - i) < minDiff) {
                minDiff = Math.abs(x - i);
                ans = i;
            }
        }
        out.println(ans);
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 25464
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <stdlib.h>
using namespace std;
#define         rep(i,n)       for (int i = 0;i<(int)(n);i++)
#define         rep1(i,n)      for (int i = 1;i<=(int)(n);i++)
#define         sajo(str)      sort(str.begin(),str.end())
#define         pi             3.14159265359
#define         nl             printf("\n")
#define         gcd(a,b)       __gcd(a,b)
#define         yes            cout<<"Yes"<<"\n"
#define         no             cout<<"No"<<"\n"
#define         pf             printf
#define         sf             scanf
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5+5;
typedef long long int ll;

int main()
{

    FIO;
    int i,j,k=10,q,temp,n,x=0,f=0;
    int a;
    cin>>a;
    for(i=9;i>=1;i--)
    {
        if(a%i==0)
        {
             k=a/i;
             break;
        }
    }
    if(k<10)
        yes;
    else
        no;
    return 0;
}


Measured memory_bytes: 256
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;
/*
struct point
{
long long dist; long long name;
bool operator<(const point& rhs) const {
return dist > rhs.dist;
}
};
*/

struct ball {
	ll num; ll color; ll pos;
};

ll const MAX = 300005;
ball a[MAX];

bool order(ball x, ball y) {
	return x.num < y.num;
}

ll b[MAX];
bool all1(ll n) {
	REP(i, 1, n) {
		if (b[i] != 1) { return false; }
	}
	return true;
}
int main() {
	ll n;
	cin >> n;
	REP(i, 1, 2*n) {
		ll x;
		cin >> x;
		a[i] = { x,i % 2, (i+1)/2 };
		b[i] = 0;
	}
	ll ans = 0;
	ll cnt[2] = { 0,0 };
	SORT_O(a, n * 2, order);
	REP(i, 1, n) {
		cnt[a[i].color]++;
		ans += a[i].num;
		b[a[i].pos]++;
	}
	if (cnt[0] == 0 || cnt[1] == 0 || !all1(n)) {
		cout << ans << endl;
		return 0;
	}
	if (a[n].pos != a[n + 1].pos) {
		cout << ans - a[n].num + a[n + 1].num << endl;
	}
	else {
		cout << min(ans - a[n].num + a[n + 2].num, ans-a[n-1].num+a[n+1].num) << endl;
	}
}



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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;


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

    int N, D;
    cin >> N >> D;

    vi point(D);
    vvi points(N, point);

    for (int i=0;i<N;i++) {
        for(int j=0;j<D;j++) cin >> points[i][j];
    }

    int ans = 0;
    for(int i=0;i<N;i++) {
        for(int j=i+1;j<N;j++) {
            int sq_dist = 0;
            for(int k=0;k<D;k++) {
                sq_dist += (points[i][k] - points[j][k]) * (points[i][k] - points[j][k]);
            }

            int dist = static_cast<int>(round(sqrt(sq_dist)));

            if (dist * dist == sq_dist) {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main()
{
    string s, t;

    cin >> s >> t;

    int ts = t.size();
    for( int i = 0; i <= s.size() - ts; i++ )
    {
        string a = s.substr( i, ts );   
        bool judge = true;
        for( int j = 0; j < ts; j++ )
        {
            if( t[j] == '_' )
                continue;
            if( a[j] != t[j] )
            {
                judge = false;
                break;
            }
        }
        if( judge )
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3204
#include <stdio.h>
int main(){
  int W,H;
  int x,y,r;

  scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
  if(0 <= x-r && 0 <= y-r && W >= x+r && H >= y+r) printf("Yes\n");
  else printf("No\n");

  return 0;
}

  

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  int A[N], B[N], C[N - 1];
  REP(i, N) {
    cin >> A[i];
    A[i]--;
  }
  REP(i, N) cin >> B[i];
  REP(i, N - 1) cin >> C[i];
  int ans = 0;
  int prev = -10;
  REP(i, N) {
    if(prev == A[i] - 1) {
      ans += C[A[i] - 1];
    }
    ans += B[i];
    prev = A[i];
  }
  cout << ans << endl;
}


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

int main(){
 int a,b,c ;
  cin >> a >> b >> c;
  if(a < c && c < b) cout << "Yes" << endl;
  else if(b < c && c < a) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import re

n = int(input())

a = input()
a = re.split(" ",a)

count = 0
for i in range(len(a)):
    if(int(a[i]) % 2 == 0):
        while(int(a[i]) > 1):
            a[i] = int(a[i])/2
            count += 1
            if(int(a[i]) % 2 != 0):
                break;
    else:
        pass

print(count)

Measured memory_bytes: 4148
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>

int main(int argc, char *argv[])
{
	string s;

	cin >> s;

	string ret="Yes";
	for (int i=0;i<s.length();i++)
	{
		if (i%2==0 && s[i]=='L')
		{
			ret="No";
			break;
		}
		if (i%2==1 && s[i]=='R')
		{
			ret="No";
			break;
		}

	}

	cout << ret << endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
 
using namespace std;
 
int main(){
    int n,I[1000],Q[1000],P[1000],R[1000],C[1000],ans;
while(cin >> n){
    if(n==0)break;
   for(int i = 0;i < n;i++){
    cin >> I[i] >> P[i] >> Q[i] >> R[i];
    C[i] = P[i] * 4 + Q[i] * 9 + R[i] *4;
}
cin >> P[n] >> Q[n] >> R[n] >> C[n];
ans = 0;
    for(int i = 0;i < n;i++){
        if(P[i] <= P[n] && Q[i] <= Q[n] && R[i] <= R[n] && C[i] <= C[n]){
            cout << I[i] << endl;
        ans++;
        }
    }
if(ans==0){
    cout << "NA" << endl;
}
}
return 0;                              
}	

Measured memory_bytes: 1180
#include <cstdio>
using namespace std;

int w,h,a[50][50];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

void dfs(int x,int y,int c) {
	for(int i=0;i<4;i++) {
		int nx=x+dx[i],ny=y+dy[i];
		if(0<=nx&&nx<w&&0<=ny&&ny<h) {
			if(a[nx][ny]=='.') {
				a[nx][ny]=c;
				dfs(nx,ny,c);
			}else if((a[nx][ny]=='w'&&c=='b')||(a[nx][ny]=='b'&&c=='w')) {
				a[nx][ny]='#';
				dfs(nx,ny,c);
			}
		}
	}
}

int main() {
	while(scanf("%d %d",&w,&h),w||h) {
		getchar();
		for(int j=0;j<h;j++) {
			for(int i=0;i<w;i++) {
				a[i][j]=getchar();
			}
			getchar();
		}
		for(int j=0;j<h;j++) {
			for(int i=0;i<w;i++) {
				if(a[i][j]=='W') dfs(i,j,'w');
				if(a[i][j]=='B') dfs(i,j,'b');
			}
		}
		int cw=0,cb=0;
		for(int j=0;j<h;j++) {
			for(int i=0;i<w;i++) {
				if(a[i][j]=='w') cw++;
				if(a[i][j]=='b') cb++;
			}
		}
		printf("%d %d\n",cb,cw);
	}
}

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

int main(){
int N, M, a, b;
  cin >> N >> M;
  int d[N + 1] = {0};
  for(int i = 0;i < M;i++){
  cin >> a >> b;
    d[a]++;
    d[b]++;
  }

  for(int i = 1;i <= N;i++) cout << d[i] << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };


signed main() {
	ll a, b, c, k;

	cin >> a >> b >> c >> k;

	if (k == 0) {
		cout << a - b << endl;
	}
	else {
			ll aa = a, bb = b, cc = c;
			a = bb + cc;
			b = aa + cc;
			c = aa + bb;
			ll sum = a - b;

		if (k % 2 == 1) {
			cout << sum << endl;
		}
		else {
			cout << -sum << endl;
		}

	}
	  
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(2147483647)
INF = 10 ** 15
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n, m = LI()
ret = sum(LI())
if ret > n:
    print(-1)
else:
    print(n - ret)



Measured memory_bytes: 83668
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll a,b,k;
	cin>>a>>b>>k;
	if(k<=a)
	{
	    cout<<a-k<<" "<<b;
	}
	else if(k<=a+b)
	{
	    cout<<"0 "<<b-(k-a);
	}
	else
	{
	    cout<<"0 0";
	}
    return 0;
}







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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int a , b , m ;
  cin >> a >> b >> m ;
  vector<int> A(a);
  vector<int> B(b);
  
  rep(i,a) cin >> A.at(i);
  rep(i,b) cin >> B.at(i);
  
  int ans = INF;
  rep(i,m){
    int x , y , c ;
    cin >> x >> y >> c ;
    int now = A.at(x-1) + B.at(y-1) - c ;
    ans = min(ans,now);
  }
  
  sort(all(A));
  sort(all(B));
  int now = A.at(0)+B.at(0);
 
  cout << min(ans,now);
    


}


Measured memory_bytes: 1152
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = sorted(A)
D = sorted(B)
l = C[0] + D[0]
for i in range(m):
  x, y, c = map(int, input().split())
  k = A[x-1] + B[y-1] -c
  if l > k:
    l = k
print(l)


Measured memory_bytes: 18736
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;

int main() {
    string s; cin >> s;
    int res = 0;
    stack<char> st;

    rep(i, s.size()) {
        if (st.empty() or st.top() == s[i]) st.push(s[i]);
        else {
            res += 2;
            st.pop();
        }
    }
    cout << res << endl;
}


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

typedef tuple<int, long long, long long> tp;

template <class T>
struct fenwick_tree {
  vector<T> x;
  fenwick_tree(int n) : x(n, 0) { }
  T sum(int i, int j) {
    if (i == 0) {
      T S = 0;
      for (j; j >= 0; j = (j & (j + 1)) - 1) S += x[j];
      return S;
    } else return sum(0, j) - sum(0, i-1);
  }
  void add(int k, T a) {
    // cout << "ft[" << k << "] is added " << a << endl;
    for (; k < x.size(); k |= k+1) x[k] += a;
  }
};

void solve(long long N, long long M, vector<long long> l, vector<long long> r){
  vector<tp> prods;
  for (long long i = 0; i < N; i++) {
    prods.push_back(tp(r[i] - l[i], l[i], r[i]));
  }
  sort(prods.begin(), prods.end());
  int idx = 0;
  int p = N;

  fenwick_tree<int> ft(M + 1);

  for (long long d = 1; d <= M; d++) {
    long long ans = 0;
    while (get<0>(prods[idx]) < d) {
      if (idx == N) break;
      ft.add(get<1>(prods[idx]), 1);
      ft.add(get<2>(prods[idx]) + 1, -1);
      /*
      for (int j = 1; j <= M; j++) {
        cout << ft.sum(1, j) << ",";
      }cout << endl;
      */
      idx++;
      p--;
    }
    ans = p;
    long long j = d;
    while (j <= M) {
      ans += ft.sum(1, j);
      j += d;
    }
    cout << ans << endl;
  }
}

int main(){	
	long long M;
	long long N;
	scanf("%lld",&N);
	vector<long long> l(N-1+1);
	vector<long long> r(N-1+1);
	scanf("%lld",&M);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&l[i]);
		scanf("%lld",&r[i]);
	}
	solve(N, M, l, r);
	return 0;
}



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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout<<fixed;

    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    #endif // _DEBUG

    long long x;
    cin>>x;
    long long years = 0;
    for (long long i = 100; i < x; years++) i += i/100;
    cout<<years;
    return 0;
}


Measured memory_bytes: 3656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;


import static java.lang.System.in;

class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] lo =reader.readLine().split(" ");
        int A = Integer.parseInt(lo[0]);
        int B = Integer.parseInt(lo[1]);
        int H = Integer.parseInt(lo[2]);
        int M = Integer.parseInt(lo[3]);
        double angle = Math.abs((H+M/(double)60)*(Math.PI/(double)6) - M*(Math.PI/(double)30));
        double res = Math.sqrt((double)(A*A)+(double)(B*B)-2*A*B*Math.cos(angle));
        DecimalFormat dec = new DecimalFormat("#0.000000000");
         System.out.println(dec.format(res));
    }
}


Measured memory_bytes: 35408
n=int(input())
al=[0]+[list(map(int,input().split())) for _ in range(n)]
dp=[[0,0,0] for _ in range(n+1)]
for day in range(1,n+1):
    dp[day][0]=max(dp[day-1][1],dp[day-1][2])+al[day][0]
    dp[day][1]=max(dp[day-1][0],dp[day-1][2])+al[day][1]
    dp[day][2]=max(dp[day-1][0],dp[day-1][1])+al[day][2]
print(max(dp[-1]))

Measured memory_bytes: 47204
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
struct node
{
	int x,y,id;
};
bool cmp(node a,node b)
{
	return a.id<b.id;
}
node nodes[9];
long double ans=0;
int c=1;
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>nodes[i].x>>nodes[i].y;
		nodes[i].id=i+1;
		c*=i+1;
	}
	do
	{
		for(int i=1;i<n;i++)
		{
			ans+=sqrt((long double)((nodes[i].x-nodes[i-1].x)*(nodes[i].x-nodes[i-1].x)+(nodes[i].y-nodes[i-1].y)*(nodes[i].y-nodes[i-1].y)));
		}
	}while(next_permutation(nodes,nodes+n,cmp));
	printf("%Lf",ans/c);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b){
    if(a%b==0){
        return b;
    }
    else{
        return gcd(b,a%b);
    }
}
int main(){
    long long A,B;
    cin>>A>>B;
    long long N=gcd(A,B);
    if(N==1){
        cout<<1<<endl;
    }
    else{
      set<long long>Primelist;
      long long K=N;
      for(long long i=2;i<=sqrt(N);i++){
          while(K%i==0){
              Primelist.insert(i);
              K=K/i;
          }
      }
      if(K!=1){
          Primelist.insert(K);
      }
      long long count=1;
      for(auto value:Primelist){
          if(N%value==0){
              count=count+1;
          }
      }
      cout<<count<<endl;
    }
}


Measured memory_bytes: 256
n,m = map(int,input().split())
a = [ int(input()) for _ in range(m)]
M=10**9+7
lis = [1] + [0]*n

for i in a:
  lis[i]=-1
lis[1] += 1
for i in range(n-1):
  if lis[i+2]<0:
    lis[i+2]= 0
  else:
    lis[i+2] = (lis[i+1] + lis[i])%M
print(lis[n])

Measured memory_bytes: 14556
N,K=map(int,input().split())
X=[list(map(int,input().split())) for i in range(K)]
C=[0]*(N*3)
DP=[0]*N
mod=998244353
DP[0]=1
Y=0
for i in range(N):
  Y+=C[i]
  DP[i]+=Y
  Y%=mod
  DP[i]%=mod
  for j in range(K):
    C[i+X[j][0]]+=DP[i]
    C[i+X[j][1]+1]-=DP[i]
print(DP[N-1])


Measured memory_bytes: 74336
from collections import deque

H, W = map(int, input().split())
s = [list(input()) for i in range(H)]

dist = [[10000] * W for i in range(H)]
dist[0][0] = 0

dxy = [(0, 1), (1, 0), (0, -1), (-1, 0)]

q = deque([(0, 0)])

while q:
    x, y = q.popleft()
    for dx, dy in dxy:
        nx, ny = x + dx, y + dy
        if nx < 0 or ny < 0 or nx >= W or ny >= H:
            continue
        if s[ny][nx] == "#":
            continue
        if dist[ny][nx] < 10000:
            continue
        q.append((nx, ny))
        dist[ny][nx] = dist[y][x] + 1

count = 0
for i in range(H):
    count += s[i].count(".")
if dist[H - 1][W - 1] == 10000:
    print(-1)
else:
    print(count - dist[H - 1][W - 1] - 1)


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

long func(long p, long q);
// int lcm(long p, long q);

int main() {
	long a, b;
	while(cin >> a >> b && a != EOF) {
		long gcd = func(a, b);
		long lcm = a / gcd * b;
		
		cout << gcd << ' ' << lcm << endl;
	}
}

long func(long p, long q) {
	long R = p % q;
	return (R==0? q : func(q,R));
}

Measured memory_bytes: 0
from itertools import combinations as cmbs
from sys import stdin
c = {"M":0,"A":0,"R":0,"C":0,"H":0}
for si in map(lambda s:s[0],stdin):
    if si in c:
        c[si] += 1
print(sum(i*j*k for i,j,k in cmbs(c.values(),r=3)))


Measured memory_bytes: 9052
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] d = new int[N];
		int a = 0;
		for(int i=0; i<N; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();
		for(int i=0; i<N; i++) {
			for(int j=i+1; j<N; j++) {
				a+= d[i]*d[j];
			}
		}
		System.out.println(a);
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define FOR0(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)

int abs(int n)
{
    if (n >= 0)
        return n;
    else
        return -n;
}

int main()
{
    int N, W;
    cin >> N >> W;
    int w[N + 1];
    long long v[N + 1];
    FOR1(i, N)
    {
        cin >> w[i] >> v[i];
    }
    long long dp[N + 1][W + 1];
    FOR(i, 0, N)
    {
        FOR(x, 0, W)
        {
            dp[i][x] = 0;
        }
    }
    FOR(i, 1, N)
    {
        FOR(x, 0, W)
        {
            dp[i][x] = max(dp[i][x], dp[i - 1][x]);
            if (w[i] <= x)
            {
                dp[i][x] = max(dp[i][x], dp[i - 1][x - w[i]] + v[i]);
            }
        }
    }
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 79104