akhauriyash/Code-Regression huggingface dataset:
// This code writed by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
using namespace std;
const int MaxN=85;
const int mid=12805;
const int MaxAi=mid*2+5;
template <class t> inline void read(t &s)
{
	s=0;
	reg int f=1;
	reg char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
			f=-1;
		c=getchar();
	}
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	s*=f;
	return;
}
int a[MaxN][MaxN],b[MaxN][MaxN];
bitset<MaxAi> f[MaxN][MaxN];
signed main(void)
{
	int h,w;cin>>h>>w;
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)
			read(a[i][j]);
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)
			read(b[i][j]);
	f[1][1].set(a[1][1]-b[1][1]+mid);
	f[1][1].set(b[1][1]-a[1][1]+mid);
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)
		{
			bitset<MaxAi> res=f[i-1][j];
			res|=f[i][j-1];
			reg int sub=abs(a[i][j]-b[i][j]);
			f[i][j]|=(res<<sub)|(res>>sub);
		}
	reg int ans=0x3f3f3f3f;
	for(int i=0;i<MaxAi;++i)
		if(f[h][w].test(i))
			ans=min(ans,abs(i-mid));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 22528
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(void){
int n;
int tanku[]={5,7,5,7,7};
while(1){
cin>>n;
if(n==0)break;
string a;
vector<int> w(n);
for(int i=0;i<n;i++){
	cin>>a;
	w[i]=a.size();
}
int plase;
for(int i=0;i<n;i++){
plase=i;
int sum=0;
int k=0;
bool flag=false;
for(int j=i;j<n;j++){
sum+=w[j];
if(sum>tanku[k])break;
if(sum==tanku[k]){
	k++;
	sum=0;
}
if(k==5){
	flag=true;
	break;
}
}
if(flag){
	cout<<i+1<<endl;
	break;
}
}
}	
return 0;
}

Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf INT_MAX
#define llinf LONG_LONG_MAX
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    long long int n,i;
    cin>>n;
    long long int a[n],b[n],c[n],dp[n][3];
    for(i=0;i<n;i++)
        cin>>a[i]>>b[i]>>c[i];
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(i=1;i<n;i++)
    {
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
        dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

std::vector<std::vector<std::vector<ll>>> dp;
int N, A;
std::vector<ll> x;

ll sol(int j, int k, int s) {
  if ( dp[j][k][s] != -1 ) return dp[j][k][s];
  else {
    if ( j == 0 && k == 0 && s == 0 ) return dp[j][k][s] = 1;
    else if ( j >= 1 && s - x[j-1] < 0 ) return dp[j][k][s] = sol(j-1,k,s);
    else if ( j >= 1 && k >= 1 && s-x[j-1] >= 0 ) return dp[j][k][s] = sol(j-1,k,s) + sol(j-1,k-1,s-x[j-1]);
    else return dp[j][k][s] = 0;
  }
}

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  std::cin >> N >> A;
  x.resize(N); rep(i,N) std::cin >> x[i];

  dp.resize(N+1, std::vector<std::vector<ll>>(N+1, std::vector<ll>(N*A+1, -1))); 

  ll ans = 0;
  for(int i=1; i<=N; i++) ans += sol(N, i, i*A);
  std::cout << ans << std::endl;
  return 0; 
}


Measured memory_bytes: 52224
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<vector>

#define MAX 5000

using namespace std;

void input();

int lose[MAX + 1];
int n, m, w[100000 + 1], l[100000 + 1];
queue<int> q;

int main() {

	bool yes = false;
	input();

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

		int t = 0, cnt = 0;
		for (int j = 1; j <= n; j++) {
			if (lose[j] == 0) {
				t = j;
				cnt++;

			}
		}
		if (cnt >= 2) yes = true;
		lose[t] = 5000 ;
		q.push(t);
		for (int j = 0; j < m; j++) if (w[j]==t) lose[l[j]]--;

	}
	for (int i = 0; i < n; i++) {
		int ans = q.front();
		cout << ans << endl;
		q.pop();
	}
	if (yes == true) cout << 1 << endl;
	else cout << 0 << endl;

	//cin >> n;
	return 0;
}

void input() {

	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> w[i] >> l[i];
		lose[l[i]]++;

	}
}



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

int main(void){
    int n,m;
    cin>>n>>m;
    vector<int> s(n+1,0);
    for(int i=0;i<m;i++){
        int a,b; cin>>a>>b;
        s[a]++; s[b]--;
    }
    partial_sum(s.begin(),s.end(),s.begin());
    cout<< n+1+ (n+1-count(s.begin(),s.end(),0))*2 <<endl;
}



Measured memory_bytes: 3104
from collections import defaultdict


def trial_division(n):
    '''
    素因数分解する
    '''
    factor = []
    for num in range(2, int(n**0.5)+1):
        while n % num == 0:
            n //= num
            factor.append(num)
    if not factor or n != 1:
        factor.append(n)
    return factor


N = int(input())
divisor_dict = defaultdict(int)
for i in range(2, N+1):
    divisors = trial_division(i)
    for d in divisors:
        divisor_dict[d] += 1
ans = 1
for v in divisor_dict.values():
    ans = (ans * (v+1)) % (1e9 + 7)
print(int(ans))

Measured memory_bytes: 3316
import scala.io.StdIn.readLine

object Main extends App {

  val input = readLine().split(" ").map(_.toInt)
  val (a, b) = (input(0), input(1))

  val d = a / b
  val r = a % b
  val f = "%.5f".format(a.toDouble / b.toDouble)

  val ans = s"$d $r $f"

  println(ans)
}



Measured memory_bytes: 44256
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n; cin >> n;
    vector<int>v(n); erep(e,v) cin >> e;
    map<int,int>g,k,rg,rk;
    rep(i,v.size()){
        if(i%2)k[v[i]]++;
        else g[v[i]]++;
    }
    vector<pii>gv,kv;
    for(auto itr : g) gv.push_back(pii(itr.second,itr.first));
    for(auto itr : k) kv.push_back(pii(itr.second,itr.first));
    sort(all(gv),greater<pii>());
    sort(all(kv),greater<pii>());
    if(gv[0].first > kv[0].first or (gv.size()>kv.size() and  gv[0].first == kv[0].first)){
        if((gv[0].second == kv[0].second) ){
            cout << n - gv[0].first - (kv.size() == 1 ? 0 : kv[1].first) << endl;
        } else {
            cout << n - gv[0].first - kv[0].first << endl;
        }
    } else{
        if(gv[0].second == kv[0].second){
            cout << n - kv[0].first - (gv.size() == 1 ? 0 : gv[1].first) << endl;
        } else {
            cout << n - kv[0].first - gv[0].first << endl;
        }
    }
        
}




Measured memory_bytes: 9592
#include<iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a%3==0)
    {
        cout<<"Possible"<<endl;
    }
    else
    if(b%3==0)
    {
        cout<<"Possible"<<endl;
    }
    else
    if((a+b)%3==0){
        cout<<"Possible"<<endl;
    }
    else
    {
        cout<<"Impossible"<<endl;
    }
}

Measured memory_bytes: 3556
import sys 
try:
	sys.stdin = open('input.txt', 'r') 
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(1):
	# n = int(input())
	s,w = map(int,input().split())
	if w>=s:
		print("unsafe")
	else:
		print("safe")
	

Measured memory_bytes: 61644
#include<bits/stdc++.h>
#define inf 1<<29
#define linf 1e18
#define eps (1e-8)
#define mod 1000000007
#define pi M_PI
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int main()
{
  int a,b,c,d;

  while(1){
    cin>>a>>b>>c>>d;
    if(a+b+c+d==0)break;
    int ans;
    if(b*c<=a)ans=0;
    else if((b*c-a)%d==0)ans=(b*c-a)/d;
    else ans=(b*c-a)/d+1;
    cout<<max(0,ans)<<endl;
  }
  return 0;
}

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

#define ll              long long int
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n, cap;
    cin >> n >> cap;

    if(n == 0 or cap == 0){
        cout<<"0\n";
        return 0;
    }

    vector<ll> value(n);
    vector<ll> weights(n);

    for(ll i=0; i<n; i++){
        cin >> weights[i];
        cin >> value[i];
    }
    
    vector<vector<ll>> dp(n, vector<ll>(cap+1, 0));

    for(ll w=0; w<=cap; w++){
        if(w >= weights[n-1]){
            dp[n-1][w] = value[n-1];
        }
    }

    for(ll i=n-2; i>=0; i--){
        for(ll w=0; w<=cap; w++){
            dp[i][w] = dp[i+1][w];

            if(w >= weights[i]){
                dp[i][w] = max(dp[i][w] ,value[i] + dp[i+1][w - weights[i]]);
            }
        }
    }

    cout<<dp[0][cap]<<"\n";

    return 0;
}

Measured memory_bytes: 79488
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
  int n, l;
  scanf("%d%d",&n,&l);
  char s[n][l+1];
  char temp[l+1];
  for(int i=0;i<n;i++)
    scanf("%s",&s[i]);
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n-1-i;j++)
    {
      if(strcmp(s[j],s[j+1])>0)
      {
        strcpy(temp,s[j]);
        strcpy(s[j],s[j+1]);
        strcpy(s[j+1],temp);
      }
    }
  }
  for(int i=0;i<n;i++)
    printf("%s",&s[i]);
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> pri;
const int INF = 1e9 + 7;
const ll LINF = 1LL<<61;

int n,m;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	if(n <= m){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
#define vsort(v) sort(v.begin(), v.end())
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	string ans = "";
	for(int i = 0; i < s.size(); i++) {
		if(i % 2 == 0) ans += s[i];
	}
	cout << ans << endl;

}


Measured memory_bytes: 592
#include<iostream>

using namespace std;

int main()
{
	int n,m,i,j,k;
	int play,card[300],ss[300];
	
	cin >> n >> m ;
	
	for(i=0;i<n*2;i++)
		card[i]=i+1;
	
	for(i=0;i<m;i++)
	{
		cin >> play ;
		
		if(play==0)
		{
			for(k=0,j=0;k<n;k++)
			{
				ss[j]=card[k];
				j++;
				ss[j]=card[n+k];
				j++;
			}
			for(j=0;j<n*2;j++)
				card[j]=ss[j];
		}
		else
		{
			for(j=0;j<play;j++)
				ss[n*2-play+j]=card[j];
			for(j=play;j<n*2;j++)
				ss[j-play]=card[j];
			for(j=0;j<n*2;j++)
				card[j]=ss[j];
		}
	}
	for(j=0;j<n*2;j++)
		cout << card[j] << endl;
}

Measured memory_bytes: 0
M=998244353
N=gets.to_i
v=$<.map{|e|Complex(*e.split.map(&:to_i))}
h={}
r=2**N%M-N-1
N.times{|i|(i+1...N).map{|j|
	h[x=[i,j]]&&next
	(j+1...N).map{|k|((v[j]-v[k]).conj*(v[i]-v[k])).imag.abs<1e-12&&x<<k}
	x.size.times{|a|(a+1...x.size).map{|b|
		r=(r-2**(b+~a))%M
		h[[x[a],x[b]]]=1
	}}
}}
p r%M

Measured memory_bytes: 5628
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T>
inline T LCM(T a, T b) { return (a + (b - 1)) / b; }
template<class T>
inline T round_int(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int gra[110][110];

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

	if (!a) {
		cout << "1 1" << endl << "#" << endl;
	}
	if (!b) {
		cout << "1 1" << endl << "." << endl;
	}

	cout << "100 100" << endl;
	for (int i = 1; i <= 100; ++i) {
		for (int j = 1; j <= 100; ++j) {
			if (i <= 50) gra[i][j] = 0;
			else gra[i][j] = 1;
		}
	}

	a--, b--;
	for (int i = 1; i <= 50 && b; i += 2) {
		for (int j = 1; j <= 100 && b; j += 2) {
			gra[i][j] = 1;
			b--;
		}
	}

	for (int i = 1; i <= 50 && a; i += 2) {
		for (int j = 1; j <= 100 && a; j += 2) {
			gra[101 - i][j] = 0;
			a--;
		}
	}

	for (int i = 1; i <= 100; ++i) {
		for (int j = 1; j <= 100; ++j) {
			if (gra[i][j] == 1) {
				cout << "#";
			}
			else cout << ".";
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <map>
// #include <functional>>

using namespace std;
int main()
{
	int N = 0, M = 0;

	map<string, int> card;

	cin >> N; // 青
	for (int i = 0; i < N; ++i) {
		string s;
		cin >> s;
		++card[s];
	}

	cin >> M; // 赤
	for (int i = 0; i < M; ++i) {
		string t;
		cin >> t;
		--card[t];
	}

	int max = 0;
	for (const auto& elem : card) {
		if (elem.second > max) {
			max = elem.second;
		}
	}
	cout << max;

	return 0;
}

Measured memory_bytes: 256
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    r, c, k = ns()

    mat = [[0]*(c + 1) for __ in range(r + 1)]
    for _ in range(k):
        x, y, v = ns()
        x, y = x - 1, y - 1
        mat[x][y] = v

    dp = [[0]*4 for _ in range(c + 1)]

    for i in range(r):
        ndp = [[0]*4 for _ in range(c + 1)]
        for j in range(c):
            for n in range(2, -1, -1):
                dp[j][n + 1] = max(dp[j][n + 1], dp[j][n] + mat[i][j])

            ndp[j][0] = max(dp[j])
            for n in range(4):
                dp[j + 1][n] = max(dp[j + 1][n], dp[j][n])
        dp = ndp

    print(max(dp[c - 1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 224280
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
using namespace std;

void solve() {
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	ll ans = a*c;
	ans = max(a*d, ans);
	ans = max(b*c, ans);
	ans = max(b*d, ans);
	cout << ans << '\n';
}

int main(int argc, char * argv[]) 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:/Users/Fish_Brother/Desktop/in", "r", stdin);
	//freopen("C:/Users/Fish_Brother/Desktop/out", "w", stdout);
#endif

	//int t; cin >> t; while(t--)
	solve();

    return 0;
}

Measured memory_bytes: 3648
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <thread>
#include <unordered_set>
#include <vector>
#include <memory.h>
#include <list>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <stdio.h>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <random>
#include <string>
#include <cassert>


#define getcx _getchar_nolock

using namespace std;
 
namespace std
{
	string to_string(string const& s) { return '"' + s + '"'; }
	string to_string(char c) { return string(1, c); }
	string to_string(const char* s) { return to_string((string)s); }
	string to_string(bool b) { return (b ? "true" : "false"); }
 
	template <class T1, class T2>
	string to_string(pair<T1, T2> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
 
	template <class T>
	string to_string(T c)
	{
		string s = "[";
		for (auto vvv : c) { s += to_string(vvv) + ","; }
		s += "]";
		return s;
	}
 
	void debug_impl() { cerr << endl; };
 
	template <typename T1, typename... T2>
	void debug_impl(T1 a, T2 ... b)
	{
		cerr << " " << to_string(a);
		debug_impl(b...);
	}
}
 
template <typename T>
struct reversion_wrapper
{
	T& iterable;
};
 
template <typename T>
auto begin(reversion_wrapper<T> w) { return std::rbegin(w.iterable); }
 
template <typename T>
auto end(reversion_wrapper<T> w) { return std::rend(w.iterable); }
 
template <typename T>
reversion_wrapper<T> reverse(T&& iterable) { return { iterable }; }
 
template<class T>T gcd(T a, T b) { while (a && b)if (a > b)a %= b; else b %= a; return a + b; }
template<class T>T powmod(T a, T b, T mod) { if (b == 0)return 1 % mod; T res = powmod(a, b / 2, mod); res *= res; res %= mod; if (b & 1) { res *= a; res %= mod; } return res; }
template<class T>T inv(T a, T mod) { return powmod(a, mod - 2, mod); }
 
#ifdef __ASD__
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_impl(__VA_ARGS__)
#define endl "\n"
#else
#define dbg(...) ;
#define endl "\n"
#endif
 
#define lng long long

lng const MOD = 998244353;


int main()
{
#ifdef __ASD__
	auto start_t = chrono::steady_clock::now();
	freopen("input.txt", "r", stdin);
	//freopen("1nul", "w", stderr);
	//freopen("output.txt", "w", stdout);
#else
	ios_base::sync_with_stdio(false);
#endif

	string s;
	cin >> s;
	if (s[2]==s[3] && s[4]==s[5])cout<<"Yes"<<endl; else cout<<"No"<<endl;


#ifdef __ASD__
	auto finish_t = chrono::steady_clock::now();
	cerr << "Elapsed " << chrono::duration_cast<chrono::milliseconds>(finish_t - start_t).count() << " ms" << endl;
#endif
	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() {
	int n;
	vector<ll>list;
	int mcnt = 0;
	ll minn = -9999999999, sum = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		ll num;
		cin >> num;
		list.push_back(num);
		if (num <= 0)mcnt++;
		minn = min(abs(minn), abs(num));
		sum += abs(num);
	}

	if (mcnt % 2 != 0) {
		sum -= minn * 2;
	}
	
	cout << sum << endl;


	return 0;
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[] s = new int[m];
        int[] c = new int[m];

        for(int i = 0; i < m; i++) {
        	s[i] = scan.nextInt();
        	c[i] = scan.nextInt();

        }

        int len = 9 * (int)Math.pow(10, n - 1);
        if(n == 1)
        	len++;
        int start = 0 + (int)Math.pow(10, n - 1);
        if(n==1)
        	start = 0;

        int[] list = new int[len];
        for(int i = 0; i < list.length; i++) {
        	list[i] = start++;
        }

        for(int i = 0; i < list.length; i++) {
        	boolean f = true;
        	String temp = Integer.toString(list[i]);
        	for(int j = 0; j < m; j++) {
        		if(!(temp.substring(s[j] - 1, s[j]).equals(String.valueOf(c[j])))) {
        			f = false;
        			break;
        		}
        	}
        	if(f) {
        		System.out.println(temp);
        		return;
        	}
        }



        System.out.println(-1);
    }
}

Measured memory_bytes: 23764
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " << a << endl;
vector <int> adj[1000001];
bool visited[1000001];

void dfs(ll s, ll &ans) {
	// cout << s << " ->";
	visited[s] = true;
	ans++;
	for (ll i = 0; i < adj[s].size(); ++i)    {
		if (visited[adj[s][i]] == false)
			dfs(adj[s][i], ans);
	}
}
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--)
	{
		ll n, m;
		cin >> n >> m;

		while (m--)
		{
			ll x, y;
			cin >> x >> y;
			adj[x].pb(y);
			adj[y].pb(x);
		}
		ll maxi = INT_MIN;
		for (ll i = 1; i <= n; i++)
		{
			if (visited[i] == false)
			{
				ll ans = 0;
				dfs(i, ans);
				maxi = max(maxi, ans);
			}
		}
		cout << maxi << endl;
	}
	return 0;
}

Measured memory_bytes: 42792
#include<stdio.h>

int search(int A[], int n, int key){
    int i = 0;

    for(i=0; i<n; i++){
        if(A[i] == key) return 1;
    }

    return 0;
}

int main(){
    int i, n, A[10000 + 1], q, key, sum;
    int sea;

    scanf("%d", &n);

    for(i=0; i<n; i++){
        scanf("%d", &A[i]);
    }

    scanf("%d", &q);
    
    sum = 0;
    for(i=0; i<q; i++){
        scanf("%d", &key);
        if(search(A, n, key)) sum++; 
    }

    printf("%d\n", sum);

    return 0;
}



Measured memory_bytes: 2060
// B.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

typedef long long LL;

int main() {
	LL n, a, ans = 1;
	bool overflow = false, zero = false;
	cin >> n;
	for (LL i = 0; i < n; ++i) {
		cin >> a;
		for (int i = 0; i < 4; ++i) {
			if ((a >> i) * (ans >> i) > 1000000000000000000LL) {
				overflow = true;
			}
		}
		ans *= a;
		if (!a) zero = true;
	}
	cout << (zero ? 0 : (overflow ? -1 : ans)) << endl;
	return 0;
}


Measured memory_bytes: 3604
// be name khoda
#include<bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define int long long
#define mpr make_pair 
typedef long long ll;
#pragma GCC optimize("Ofast")

const int maxn = 1e6+10;
const int N = 1e6+5;
const int mod = 998244353;
const int inf = 1e9+10;

int n, a[maxn];

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    cin>> n;
    int mn = n, mx = 0;
    for(int i = 1; i <= n; i++) 
    {cin>> a[i]; mn = min(mn,a[i]); mx = max(mx,a[i]);}

    if(mx - mn > 1) return cout<<"No", 0;
    if(mn == mx)
    {
        if(mx == n-1) return cout<<"Yes", 0;
        if(mx <= n/2) cout<<"Yes";
        else cout<<"No";
        return 0;
    }

    int d = mx, x = 0, y = 0;
    for(int i = 1; i <= n; i++)
        if(a[i] == mn) x++;
        else y++;
    
    if(d <= x+y/2 && d >= x+1) cout<<"Yes";
    else cout<<"No";
}





Measured memory_bytes: 1024
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
using namespace std;
#define INF 100000000
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define rep(i, n) for(int (i)=1; (i)<=(n); (i)++)
typedef pair<int, int> P;
typedef long long ll;

int N, K;
int ans;

int update(int t, int time){
    if(time==0){
        return t;
    }else{
        time--;
        t = min(update(t * 2, time), update(t + K, time));
        return t;
    }
}

int main(){
    cin >> N >> K;
    ans = update(1, N);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;
 
signed main(){
    int r,D,x;
    cin>>r>>D>>x;
    rep(i,10){
        int temp=r*x-D;
        cout<<temp<<endl;
        x=temp;
    }
 
}

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

#define A(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
void _read();
const int nax = 1e6 + 11;
int prime[nax];
void sieve() {
      for( int i = 2; i < nax; i++) {
            if(!!prime[i]) continue;
            for ( int j = i; j < nax; j += i ) {
                  prime[j] = i;
            }
      }
}
int main () { _read(); 
      sieve();
      int n;
      cin >> n;
      vector<vector<int>> pf(n); map<int,int> m;
      int g;
      for( int i = 0; i < n; i++) {
            int x;
            cin >> x;
            g = ( i == 0 ? x : __gcd(g,x));
            while( x > 1 ) {
                  int y = prime[x];
                  pf[i].push_back(y);
                  while( x > 1 and x%y == 0 ) x /= y; 
                  x = prime[x];
            }
            for( int y : pf[i]) {
                  m[y]++;
            }
      }
      
      auto decide = [&]() {
            cout << ( g == 1 ? "setwise coprime" : "not coprime") << '\n';
      };

      for( int i = 0; i < n; i++) {
            for( int p : pf[i]) {
                  if(m[p] > 1 ) {
                        decide();
                        return 0;
                  }
            }
      }
      cout << "pairwise coprime\n";
      return 0;
};

void _read() {
      ios_base :: sync_with_stdio(false);
      cin.tie(NULL);
      
      #ifdef LOCAL
      freopen("input.txt","r",stdin);
      #endif
}


Measured memory_bytes: 65508
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main()
{
  int a = 0, b = 0;
  FOR(i,0,4) {
    int in;
    cin >> in;
    a += in;
  }
  FOR(i,0,4) {
    int in;
    cin >> in;
    b += in;
  }
  cout << (a > b ? a : b) << endl;
  return 0;
}

Measured memory_bytes: 3096
import java.util.Scanner;

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

		long total = 0;
		for ( int i = 1 ; i <= N ; i++ ) {
			total += CNT[i] * (CNT[i] - 1) / 2;
		}

		StringBuilder ans = new StringBuilder();
		for ( int k = 0 ; k < N ; k++ ) {
			int num = A[k];
			long kcnt = total - CNT[num] * (CNT[num] - 1) / 2 + (CNT[num] - 1) * (CNT[num] - 2) / 2;
			ans.append(kcnt);
			ans.append("\n");
		}
		System.out.println(ans.toString());
	}
}


Measured memory_bytes: 98068
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>

using namespace std;

int main(){
        char a[10],s[110],c[10];
        scanf("%s",a);
        scanf("%s",s);
        scanf("%s",c);
        printf("%c%c%c",a[0],s[0],c[0]);
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[15];
int main(){
	scanf( "%s", s );
	int len = strlen(s);
	if( len < 4 ) puts("No");
	else{
		if( s[0] != 'Y' || s[1] != 'A' || s[2] != 'K' || s[3] != 'I' ) puts("No");
		else puts("Yes");
	}
	return 0;
} 

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


def solve(N: int, T: int, A: int, H: "List[int]"):
    tmp = 10**6
    for i,h in enumerate(H):
        if tmp > abs(A - T + h*0.006):
            tmp = abs(A - T + h*0.006)
            ans = i + 1
    print(ans)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, T, A, H)

if __name__ == '__main__':
    main()


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

const int INF=12345678;

typedef pair<int,int> pi;

struct edge
{
    int to,dist,enem;
};

vector<edge> G[100];

int main()
{
    int n,m,l;
    while(cin >>n >>m >>l,n)
    {
        rep(i,100) G[i].clear();

        rep(i,m)
        {
            int a,b,d,e;
            scanf(" %d %d %d %d",&a,&b,&d,&e);
            --a;
            --b;
            G[a].pb(edge{b,d,e});
            G[b].pb(edge{a,d,e});
        }

        //i?????????j????????£?????¶?????§????????????????????°???????°????
        int cost[100][101];

        fill(cost[0],cost[100],INF);
        cost[0][l]=0;

        queue<pi> que;
        que.push(pi(0,l));
        while(!que.empty())
        {
            pi v=que.front();
            que.pop();

            int now=v.fi;
            int money=v.se;
            rep(i,G[now].size())
            {
                edge E=G[now][i];

                //?????????????????????
                if(money>=E.dist)
                {
                    if(cost[E.to][money-E.dist]>cost[now][money])
                    {
                        cost[E.to][money-E.dist]=cost[now][money];
                        que.push(pi(E.to,money-E.dist));
                    }
                }

                //????????????????????????
                if(cost[E.to][money]>cost[now][money]+E.enem)
                {
                    cost[E.to][money]=cost[now][money]+E.enem;
                    que.push(pi(E.to,money));
                }
            }
        }

        int ans=INF;
        rep(i,l+1) ans=min(ans,cost[n-1][i]);
        printf("%d\n", ans);
    }
    return 0;
}

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

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

void solve(){
	//code
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a;
 	return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int N;
    cin >> N;
    vector<ll> a(N);
    for (int i=0; i<N; ++i) cin >> a[i];

    vector<ll> sum(N+1);
    for (int i=1; i<N+1; ++i) sum[i] = sum[i-1] + a[i-1];
    ll res = LINF;
    for (int i=2; i<N-1; ++i) {
        ll b, c, d, e;
        int ok = 0, ng = i;
        while (abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;
            if (sum[mid] - sum[0] <= sum[i] - sum[mid]) ok = mid;
            else ng = mid;
        }
        b = sum[ok] - sum[0], c = sum[i] - sum[ok];
        if (ok + 1 < i) {
            ll tb = sum[ok+1] - sum[0], tc = sum[i] - sum[ok+1];
            if (tb - tc < c - b) {
                b = tb;
                c = tc;
            }
        }
        ok = i, ng = N;
        while (abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;
            if (sum[mid] - sum[i] <= sum[N] - sum[mid]) ok = mid;
            else ng = mid;
        }
        d = sum[ok] - sum[i], e = sum[N] - sum[ok];
        if (ok + 1 < N) {
            ll td = sum[ok+1] - sum[i], te = sum[N] - sum[ok+1];
            if (td - te < e - d) {
                d = td;
                e = te;
            }
        }
        chmin(res, max({b, c, d, e}) - min({b, c, d, e}));
    }
    cout << res << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> H(N);
  for(int i = 0;i<N;i++){
    cin >> H[i];
  }
  int max = 0;

  for(int i = 0;i<N;i++){
    int count = 0;
    for(int j=0;j<i;j++){
      if(H[i] < H[j]){
        break;
      }
      count++;
    }
    if(count == i){
      max+=1;
    }
  }

  cout << max <<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(x, y) x = max(x, y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  vector<int> m, p;
  vector<P> ans;
  m.push_back(a[0]);
  p.push_back(a[n - 1]);
  for(int i = 1; i < n - 1; i++){
    if(a[i] < 0) m.push_back(a[i]);
    else p.push_back(a[i]);
  }

  int sum = m[0];
  for(int pi = 1; pi < p.size(); pi++){
    ans.push_back(make_pair(sum, p[pi]));
    sum -= p[pi];
  }

  ans.push_back(make_pair(p[0], sum));
  sum = p[0] - sum;
  for(int mi = 1; mi < m.size(); mi++){
    ans.push_back(make_pair(sum, m[mi]));
    sum -= m[mi];
  }
  cout << sum << endl;
  rep(i, ans.size()){
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}


Measured memory_bytes: 5320
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double hh = 360.0 * ((double)h*60.0+m) / (12.0 * 60.0);
    double mm = 360.0 * m / 60;
    double t = abs(hh - mm);

    // cout << t << endl;

    if(t > 180){
        t = 360.0 - t;
    }

    t = t * 3.14159265358979 / 180.0;

    double ans = sqrt(pow(b*sin(t),2) + pow(b*cos(t)-a,2));

    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}




Measured memory_bytes: 4104
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
//#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i <= n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i <= n; i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std;

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

    bool inv = false;
    string head, tail;

    irep(i, n) {
        int t;
        cin >> t;
        if(t==1) {
            if(inv) { 
                inv = false; 
            } else {
                inv = true;
            }
        } else {
            int f;
            string c;
            cin >> f >> c;
            string tmp;
            if(f==1) {
                if(inv) {
                    tail = tail + c;
                } else {
                    head = c + head; 
                }
            } else {
                if(inv) {
                    head = c + head; 
                } else {
                    tail = tail + c;
                }
            }
        }
    }
    if(inv) {
        reverse(head.begin(), head.end());
        reverse(tail.begin(), tail.end());
        reverse(s.begin(), s.end());

        cout << tail << s << head << endl;
    } else {
        cout << head << s << tail;
    }
    return 0;
}
/** atcoder **/


Measured memory_bytes: 1160
object Main extends App {
	
	val N = scala.io.StdIn.readInt
	val A = scala.io.StdIn.readLine.split(" ").map(z => func(z.toLong))

	println(A.min)

	def func(x: Long):Long={
		var temp = x
		var sum = 0L
		while(temp%2L != 1){
			temp = temp / 2
			sum = sum + 1
		}

		sum
	}
}

Measured memory_bytes: 25536
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#pragma comment(linker, "/STACK:1024000000,1024000000") 
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define EPS 1e-10
#define set0(x) memset((x),0,sizeof(x))
#define setINF(x) memset((x),63,sizeof(x))
using namespace std;
int n;
long long a,b,s[100005],dp[100005];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>a>>b;
	if(a>b)swap(a,b);
	for(int i=1;i<=n;i++){
		cin>>s[i];
	}
	for(int i=2;i<n;i++){
		if(s[i+1]-s[i-1]<a){
			cout<<"0\n";
			return 0;
		}
	}
	dp[0]=1;
	s[0]=-b;
	long long sum=0;
	int r=0;
	for(int i=1;i<=n;i++){
		while(r<i && s[i]-s[r]>=b){
			sum=(sum+dp[r])%MOD;
			r++;
		}
		dp[i]=sum;
		if(s[i]-s[i-1]<a){
			sum=0;
			r=i-1;
		}
	}
	for(int i=r;i<=n;i++){
		sum=(sum+dp[i])%MOD;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
	int n, t[102]={0}, m, p, x, i;
	scanf("%d", &n);
	for(i=1; i<=n; i++)
	{
		scanf("%d", &m);
		t[i]=t[i-1]+m;
	}
	scanf("%d", &m);
	for(i=1; i<=m; i++)
	{
		scanf("%d %d", &p, &x);
		printf("%d\n", t[n]-t[p]+t[p-1]+x);
	}
	return 0;
}

Measured memory_bytes: 256
use proconio::{input};

fn main() {
    input! {
        n: usize,
        t: [i64; n],
    }

    let mut sum = 0;
    for a in &t {
        sum += a;
    }
    let mut answer = 0;
    for a in t[0..n-1].iter() {
        sum -= a;
        answer += (sum % 1000000007) * a;
        answer %= 1000000007;
    }
    println!("{}", answer);
}

Measured memory_bytes: 5568
N = gets.to_i
As, Bs, Cs = readlines.map{|l| l.split.map(&:to_i).sort}
INF = 1E10.to_i

As << INF; Cs << INF
puts Bs.inject(0){|s, b| s + (0 .. N).bsearch{|i| As[i] >= b} * (N - (0 .. N).bsearch{|i| Cs[i] > b})}

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

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

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

    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    unordered_map<string,int>m;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        m[s]++;
    }
    ll max=0;
    for(auto x:m)
    {
        if(x.second>max)
            max=x.second;
            
    }
    vector<pair<string,int>>v;
    for(auto x:m)
    {
        if(x.second==max)
            v.push_back(make_pair(x.first,x.second));
    }
    sort(v.begin(),v.end());
    for(auto x:v)
        cout<<x.first<<endl;
    return 0;
}


Measured memory_bytes: 29380
import itertools

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

ans = 0
for i in itertools.product(range(2),repeat=H):
  for j in itertools.product(range(2),repeat=W):
    black = 0
    for h in range(H):
      for w in range(W):
        if i[h] == 0 and j[w] == 0 and G[h][w] == '#':
          black += 1
    ans += (black == K)

print(ans)

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

double p[3005];
int n;
double dp[3005][3005];

int main(){
    
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%lf", &p[i]);
        //dp[i][n] = dp[i - 1][n] * p[i];
    }
    dp[0][0] = 1;
    
    for(int i = 1; i <= n; i++)
        dp[i][0] = dp[i-1][0]*(1-p[i]);
    
    //dp[1][1] = dp[0][0]*p + dp[0][1]*(1-p);
    
    for(int j = 1; j <= n; j++)
        for(int i = 1; i <= n; i++)
            dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1 - p[i]);
    double res = 0;
    for(int j = n/2+1; j <= n; j++)
        res += dp[n][j];
    printf("%.9f\n", res);
	return 0;
}


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

using namespace std;


int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(1000000, 0);
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        v[a]++;
    }
    vector<int> A;
    for(int i = 0; i < 1000000; i++) {
        if(v[i] > 0) {
            A.push_back(v[i]);
        }
    }
    long long ans = 0;
    sort(A.begin(), A.end());
    int limit = A.size() - k;
    if(limit < 0) {
        limit = 0;
    }
    for(int i = 0; i < limit; i++) {
        ans += A[i];
    }
    cout << ans << "\n";
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    int k, s,ans = 0;
    cin >> k >> s;
    
    for (int i = 0; i < k+1; i++)
    {
        for (int j = 0; j < k+1; j++)
        {
            if( i+j <= s && s <= i+j+k)
                ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256