akhauriyash/Code-Regression huggingface dataset:
/*g++ main.cpp -o main.out*/
/*./main.out*/

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

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

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

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

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

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

LL gcd(LL a,LL b,LL c)
{
    return __gcd(__gcd(a,b),c);
}

int main()
{
    LL k,ans=0;
    cin>>k;
    rer(a,1,k)rer(b,1,k)rer(c,1,k)ans+=gcd(a,b,c);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int D,N;
int main()
{
	cin>>D>>N;
	if(D==0)
	{
		if(N==100) cout<<N+1<<endl;
		else cout<<N<<endl;
	}
	else if(D==1)
	{
		if(N==100) cout<<N*100+100<<endl;
		else cout<<N*100<<endl;
	}
	else
	{
		if(N==100) cout<<N*10000+10000<<endl;
		else cout<<N*10000<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <cmath>
 
int main()
{
	int s;
	scanf("%d", &s);
	double diff = 1000000000;
    int n, r;
	std::array<int, 100005> a;
	for (int i = 0; i < s; ++i)
	{
		scanf("%d", &a[i]);
	}
    std::sort(a.begin(), a.begin()+s);
	n = a[s - 1];
	for (int i = 0; i < s; ++i)
	{
		if (diff > std::abs(a[i] - n / 2.0))
		{
			diff = std::abs(a[i] - n / 2.0);
			r = a[i];
		}
	}
 
    printf("%d %d\n", n, r);
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
ll x[10],y[10];
ld res=0;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    for(ll i=0;i<n;i++)
    cin>>x[i]>>y[i];
    ll ind[n];
    for(ll i=0;i<n;i++)
    ind[i]=i;
    do{
        for(ll i=0;i<n-1;i++){
            ll a=ind[i],b=ind[i+1];
            res+=sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b]));
        }
    }while(next_permutation(ind,ind+n));
    for(ll i=1;i<=n;i++)
    res/=i;
    cout<<setprecision(100)<<res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N;cin>>N;
  string a,b;
  int tmp=0;
  cin>>a>>b;
  REP(i,0,N){
    bool flg=true;
    REP(j,0,N-i){
      if(a.at(i+j)!=b.at(j)){
        flg=false;
        break;
      }
    }
    if(flg){
      tmp=N-i;
      br;
    }
  }
  print(2*N-tmp);

}


Measured memory_bytes: 256
// kartikay26
#include <bits/stdc++.h>
using namespace std;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()
#ifdef LOCAL
#include "prettyprint.hpp"
#else
#define debug(...)
#define debuga(arr, n)
#define debugg(grid, n) 
#endif
typedef long long int ll;
#define int ll
#define F first
#define S second
#define float double
const int inf = LLONG_MAX;
int get() { int x; cin >> x; return x; }
void getl(int* ar, int sz){ for(int i=0; i<sz; i++) cin >> ar[i];}
template <typename T> void print(T x) { cout << x << "\n";}
template <typename T> void prints(T x) { cout << x << " ";}
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int mod = 1e9+7;
const int N = 1e5+1;

int n;
int a[N],b[N],c[N];

int32_t main(){
	fast_io();
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i] >> c[i];
	}
	int A=0, B=0, C=0;
	for (int i = 0; i < n; ++i) {
		int new_A = max(B+b[i],C+c[i]);
		int new_B = max(A+a[i],C+c[i]);
		int new_C = max(B+b[i],A+a[i]);
		A = new_A;
		B = new_B;
		C = new_C;
	}
	print(max({A,B,C}));
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#define ll long long
#include <unordered_map>
using namespace std;
 
int main() {
  ll N, M;
  cin >> N >> M;  
  cout << (M * 1900 + (N - M) * 100) * pow(2, M) << endl;
}

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

vector<vector<int>> graph;
vector<int> scores;

void dfs(int v, int p = -1) {
    for (auto i : graph[v]) {
        if (i == p) continue;
        scores[i] += scores[v];
        dfs(i, v);
    }
}

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

    int N, Q;
    cin >> N >> Q;
    graph.resize(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    scores.resize(N);
    for (int i = 0; i < Q; i++) {
        int p, x;
        cin >> p >> x;
        p--;
        scores[p] += x;
    }

    dfs(0);
    for (int i = 0; i < N; i++) {
        cout << scores[i] << "\n";
    }
}

Measured memory_bytes: 23552
#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define td(v) v.begin(),v.end()
#define tdr(v) v.rbegin(),v.rend()
#define endl "\n"
#define Matrix vector<vector<int> >
using namespace std;
const int MOD = 1e9+7;
const int MOD2 = 1e9 + 9;
const int INF = 5e18;
 
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
 
 
inline long long mod(long long n, long long m){
    long long ret = n%m;
    if(ret < 0) ret += m;
    return ret;
}
 
int exp(int a, int b){
    int result = 1;
    while (b > 0){
        if (b & 1)
            result = result*a;
 
        b >>= 1;
        a = a*a;
    }
    return result;
}

void solve(){
    int n; cin>>n;
    vector<int>vet(n+1,0);
    for(int i=1;i<n;i++){
        int x; cin>>x;
        vet[x]++;
    }
    for(int i=1;i<=n;i++){
        cout<<vet[i]<<endl;
    }
}
signed main(){
    fastio; 
    // int x=0;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}

Measured memory_bytes: 4684
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break

    for i in range(a):
        for j in range(b):
            if i % 2 != 0 and j % 2 != 0:
                print("#", end="")
            elif i % 2 != 0 and j % 2 == 0:
                print(".", end="")
            elif i % 2 == 0 and j % 2 != 0:
                print(".", end="")
            elif i % 2 == 0 and j % 2 == 0:
                print("#", end="")
        print("")

    print("")


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

int main(){
  int k,a,b;
  cin >> k>>a>>b;
  for(int i=a;i<=b;i++){
    if(i%k==0){
      cout << "OK"<<endl;
      return 0;
    }
  }
  cout << "NG" <<endl;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var n = ReadNextLong();
            var t = ReadNextLong();
            var ti = ReadLongArray();
            var sum = t;
            for (var i = 0; i < ti.Length - 1; i++)
            {
                sum += Math.Min(t, ti[i + 1] - ti[i]);
            }

            Console.WriteLine($"{sum}");
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);

        public static string[] Buffer = new string[] { };
        public static int Index;
        public static string ReadStringNext()
        {
            if (Buffer.Length == 0 || Buffer.Length <= Index - 1)
            {
                Buffer = ReadStringArray();
                Index = 0;
            }
            return Buffer[Index++];
        }
        public static int ReadNextInt() => int.Parse(ReadStringNext());
        public static long ReadNextLong() => long.Parse(ReadStringNext());
    }
}


Measured memory_bytes: 30880
#include <bits/stdc++.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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

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

    int N,M;
    cin>>N>>M;
    vector<pair<int,int>> ab;
    rep(i,N){
        int a,b;
        cin>>a>>b;
        ab.push_back(make_pair(a,b));
    }
    sort(all(ab));
    ll ans = 0;
    int j = 0;
    priority_queue<int> q;
    for(int i = M-1;i >= 0;i--){
        while(j < N&&ab[j].first + i <= M){
            q.push(ab[j].second);
            j++;
            if(j==M)break;
        }
        if(q.empty())continue;
        ans += q.top();
        q.pop();
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1908
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long gcd(T1 a, T2 b){return a % b ? gcd(b , a % b) : b;}
template<class T1, class T2> void reduce(T1 &a, T2 &b){ll g = gcd(a, b); a /= g; b /= g; return;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

int main(){
    ll N; cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];
    ll Q; cin >> Q;
    vector<ll> ans;
    map<ll, ll> m;
    rep(i, N) m[a[i]]++;
    ll cum = accumulate(all(a), 0LL);
    rep(i, Q){
        ll b, c; cin >> b >> c;
        cum += m[b] * (c - b);
        m[c] += m[b];
        m[b] = 0;
        ans.push_back(cum);
    }
    rep(i, Q) pt(ans[i]);
}

Measured memory_bytes: 10804
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)

	if (a == b && a != c) || (a == c && a != b) || (b == c && a != b) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int i, j, k, l, m, n;
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for(i = 0; i <= n; i++) for(j = 0; j <= m; j++) 
			if(i * m + (n - 2 * i) * j == k) {
				printf("Yes\n");
				return 0;
			}
	printf("No\n");
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

#define MAX 10

int main() {
  int n, d;
  scanf("%d %d", &n, &d);
  int x[MAX][MAX] = {{0}};
  int i, j, k;
  for(i = 0; i < n; i++) {
    for(j = 0; j < d; j++) {
      scanf("%d", &x[i][j]);
    }
  }
  int ans = 0;
  int check;
  for(i = 0; i < n - 1; i++) {
    for(j = i + 1; j < n; j++) {
      double distance = 0.0;
      for(k = 0; k < d; k++) {
        distance += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
      }
      distance = sqrt(distance);
      check = (int)distance;
      if(distance - check == 0) ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <cmath>
#include <string>

using namespace std;

int main(void) {
    vector<int> x,s;
    int n,t;
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> t;
        x.push_back(t);
        s.push_back(t);
    }
    sort(s.begin(),s.end());
    for(int i = 0; i < n;i++) {
        if(x[i] <= s[n/2-1])
            cout << s[n/2] << endl;
        else
            cout << s[n/2-1] << endl;
    }
    return 0;
}


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

int main(){
    string s;
    int counter = 0;
    int ans = 0;
    cin >> s;

    for(int i = 0;i < s.size(); i++){
        if(s.at(i) == 'A' || s.at(i) == 'C' || s.at(i) == 'G' || s.at(i) == 'T'){
            counter++;
        }else{
            if(counter == 0){
                continue;
            }
            if(counter < (s.size()-i)){
                if(counter > ans){
                    ans = counter;
                }
                counter = 0;
                continue;
            }
            else{
                if(counter > ans){
                    ans = counter;
                }
                break;
            }
        }
    }
    if(counter > ans){
        ans = counter;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include <cmath>
#include<bits/stdc++.h>
#include<math.h>
//for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<n;i++) cin >> x[i];
#define pi pair<int,int> 
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
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; }

//  a  //
int main(){
    int n; cin >> n;
    ll h[n]; cinf(n,h);
    ll dp[n];
    for(int i=0;i<n;i++) dp[i]=INF;
    dp[0]=0;
    for(int i=1;i<n;i++){
        chmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
        if(i > 1) chmin(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout << dp[n-1];
    return 0;
}


Measured memory_bytes: 1792
// 2011/02/17 Tazoe

#include <iostream>
#include <string>
using namespace std;

int main()
{
	while(true){
		string gam;
		cin >> gam;
		if(gam=="0")
			break;

		int A = 0;
		int B = 0;
		for(int i=1; i<gam.size(); i++)
			if(gam[i]=='A')
				A++;
			else
				B++;

		if(A>B)
			A++;
		else
			B++;

		cout << A << ' ' << B << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<fstream>
#include<map>
#include<bitset>
#include<unordered_map>
#include<cstring>
#include<cctype>
using namespace std;
#define  ll long long
#define  ull unsigned long long
#define  ul unsigned long
#define all(v) v.begin(),v.end()
#define sz(n) (int)n.size()
#define pb(s) push_back(s);
#define format(n) fixed<<setprecision(n)
#define finl "\n"
#define Mohammed_Atef_Hassan fast();
#define mod 1000000007
#define INF LLONG_MAX
#define PI acos(-1)
#define clr(dp,n) memset(dp,n,sizeof dp)
#define ex(n) return cout<<n<<finl,0;
int dx[] = { 0, 1, 0, -1, 1, 1, -1, -1 };
int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
ll fix_mod(ll x, ll y)
{
	return (y + x % y) % y;
}
void fast() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);


}
int n; 
vector<pair<ll, ll>>v;
ll mem[101][(int)1e5 + 1];
ll solve(int i, ll rem)
{
	if (i == n)return 0;
	ll& ret = mem[i][rem];
	if (~ret)return ret;
	ret = solve(i + 1, rem);
	if (v[i].first <= rem)
		ret = max(ret, solve(i + 1, rem - v[i].first) + v[i].second);
	return ret;
}
int main()
{
	Mohammed_Atef_Hassan
		ll w;
		cin >> n >> w;
	v = vector<pair<ll, ll>>(n);
	for (int i = 0; i < n; i++)
		cin >> v[i].first >> v[i].second;
	clr(mem, -1);
	ex(solve(0, w));
}

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

using namespace std;

int main(){

    long N;

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

	cin >> N;

    long ans = 1;

	for(int i = 1 ;i<= N;i++){
		ans *= i;
		ans%=MOD;
	}

	cout << ans;

    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fcout cout << fixed << setprecision(18)

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

  ll N; cin >> N;
  vector<double> P(N); for (ll i = 0; i < N; i++) cin >> P[i];
  vector<double> dp(N + 1, 0), dp2(N + 1, 0);
  dp2[0] = 1;
  for (ll i = 1; i <= N; i++) {
    double p = P[i - 1];
    dp[0] = dp2[0] * (1 - p);
    for (ll j = 1; j < i; j++) {
      dp[j] = dp2[j - 1] * p + dp2[j] * (1 - p);
    }
    dp[i] = dp2[i - 1] * p;
    dp2 = dp;
  }
  double ans = 0;
  for (ll i = N / 2 + 1; i <= N; i++) {
    ans += dp[i];
  }
  fcout << ans << '\n';
  return 0;
}

Measured memory_bytes: 384
def MAIN():
    n, m = map(int, input().split())
    li = [i for i in range(n)]
    def f(a):
        if li[a] == a:
            return a
        li[a] = f(li[a])
        return li[a]
    def f2(a, b):
        if li[a] == a:
            li[a] = b
            return
        f2(li[a], b)
        li[a] = b
    def solve(a, b):
        if f(a) == f(b):
            return "yes"
        return "no"
    for _ in range(m):
        x, y = map(int, input().split())
        if f(x) > f(y):
            f2(x, li[y])
        else:
            f2(y, li[x])
    for _ in range(int(input())):
        x, y = map(int, input().split())
        print(solve(x, y))
MAIN()



Measured memory_bytes: 9664
counter = [0 for i in range(10**6+1)]
n = int(input())
a = sorted(list(map(int,input().split())))
for i in a:
  counter[i] += 1
l  = [0 for i in range(10**6+1)]
cou = 0
for i in range(n):
  b = a[i]
  if l[b]==0:
    cou += 1
    for j in range(b,10**6+1,b):
      l[j] = 1
    if counter[b]>=2:
      cou -=1
print(cou)

Measured memory_bytes: 40856
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int dp[100][2];

signed main()
{
    int N,P; cin>>N>>P;
    dp[0][0]=1;
    for(int i=1;i<=N;i++){
        int a; cin>>a; a%=2;
        REP(j,2){
            dp[i][j]=dp[i-1][j]+dp[i-1][j^a];
        }
    }
    cout<<dp[N][P]<<endl;
}


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

int main() {
  string s;
  int hug = 0;
  cin >> s;
  for (int i = 0; i < (s.size() / 2); i++) {
    if (s.at(i) != s.at(s.size() - i - 1)) {
      hug++;
    }
  }
  cout << hug << endl;
}


Measured memory_bytes: 256
#import<bits/stdc++.h>
using namespace std;
long long a,b,c,i,j,k,l,m,n,s,x[2040],y[2040],z[2040][2040];
main()
{
scanf("%lld%lld",&n,&m);
for(;i++<n;)scanf("%lld",x+i);
for(i=0;i++<m;)scanf("%lld",y+i);
for(i=0;i<=n;i++)for(j=0;j<=m;j++)z[i][j]=(i<1|j<1?1:
z[i-1][j]+z[i][j-1]-(x[i]==y[j]?0:z[i-1][j-1])+1000000007)%1000000007;
printf("%lld",z[n][m]);
}

Measured memory_bytes: 32128
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Collections;
import java.awt.Point;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] ab = br.readLine().split(" ");
        int a = Integer.parseInt(ab[0]);
        int b = Integer.parseInt(ab[1]);
        String[] pp = br.readLine().split(" ");
        int[] p = new int[n];
        
        for (int i = 0; i < n; i++) {
            p[i] = Integer.parseInt(pp[i]);
        }
        
        int countA = 0;
        int countAB = 0;
        int countB = 0;
        for (int i = 0; i < n; i++) {
            if (p[i] <= a) {
                countA++;
            }
            if (a < p[i] && p[i] <= b) {
                countAB++;
            }
            if (b < p[i]) {
                countB++;
            }
        }
        
        
        
        System.out.println(Math.min(Math.min(countA, countAB), countB));
    }
}

class Box {
    int w;
    int h;
    public Box(int w, int h) {
        this.w = w;
        this.h = h;
    }
}

class BoxComparator1 implements Comparator<Box>{
	public int compare(Box b1, Box b2) {
		return b1.w - b2.w;
	}
}

class BoxComparator2 implements Comparator<Box> {
    public int compare(Box b1, Box b2) {
        return b1.h - b2.h;
    }
}


Measured memory_bytes: 22484
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
using namespace std;
using ll = long long;
void self_max(int &a,int b){
  a = max(a,b);
}

int main(){
  int n; cin >> n;
  int arr[n] = {};
  rep(i,n){
    cin >> arr[i];
  }

  ll ans = 0;

  rep(i,n-1){
    for(int j = i+1; j<n ; j++){
      ans += arr[i]*arr[j];
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
k = int(input())
#k = 200

class GCD:
    def __init__(self):
        self.cache = {}
        self.cache3 = {}
    def gcd2(self, a, b):
        a, b = sorted([a, b], reverse=True)
        if (a in self.cache and b in self.cache[a]):
            return self.cache[a][b]
        if (a % b == 0):
            if (a not in self.cache):
                self.cache[a] = {}
            self.cache[a][b] = b
            return b
        return self.gcd2(b, a % b)
    def gcd3(self, a, b, c):
        a, b, c = sorted([a, b, c], reverse=True)
        if (a in self.cache3 and b in self.cache3[a] and c in self.cache3[a][b]):
            return self.cache3[a][b][c]
        if (a not in self.cache3):
            self.cache3[a] = {}
        if (b not in self.cache3[a]):
            self.cache3[a][b] = {}
        result = self.gcd2(self.gcd2(a, c), b)
        self.cache3[a][b][c] = result
        return result

a = 1
b = 1
c = 1
result = 0
client = GCD()
while (a <= k):
    b = a
    while (b <= k):
        interval = client.gcd2(a, b)
        c = b
        while (c <= k):
            if (a == b and b == c):
                result += client.gcd2(interval, c)
            elif(a != b and b != c and a != c):
                result += client.gcd2(interval, c) * 6
            else:
                result += client.gcd2(interval, c) * 3
            c += 1
        b += 1
    a += 1
print(result)


Measured memory_bytes: 9264
#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    
    long long int ans=0;
    long long int pre_B=-1;
    for(int n=1; n<N; n++) {
        long long int B;
        cin >> B;
        
        if(pre_B==-1) {
            ans += B;
        } else if(pre_B>B) {
            ans += B;
        } else {
            ans += pre_B;
        }
        pre_B = B;
    }
    
    cout << ans+pre_B << endl;


    return 0;
    
}

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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	string ans = "Positive";
	if (a < 0 && b < 0 && (b - a + 1) % 2 == 1) {
		ans = "Negative";
	} else if ((a >= 0 && b <= 0) || (a <= 0 && b >= 0)) {
		ans = "Zero";
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <list>
#include <bitset>
using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> X(N);
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> X[i];
        if (X[i] < abs(X[i] - K))
        {
            ans += 2 * X[i];
        }
        else
        {
            ans += 2 * abs(X[i] - K);
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    double den=-1;
    int sw,s;
    for(int i=0;i*100*A<=F;i++){
        for(int j=0;i*100*A+j*100*B<=F;j++){
            for(int k=0;i*100*A+j*100*B+k*C<=F&&k*C<=E*(i*A+j*B);k++){
                for(int h=0;i*100*A+j*100*B+k*C+h*D<=F&&(k*C+h*D)<=E*(i*A+j*B);h++){
                    double tmp=(double)(k*C+h*D)/(double)(i*100*A+j*100*B+k*C+h*D)*100;
                    if(den<tmp){
                      den=tmp;
                        sw=i*100*A+j*100*B+k*C+h*D;
                        s=k*C+h*D;
                    }
                }
            }
        }
    }
    cout<<sw<<' '<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

const ll mod = 998244353;
const int N = 1e4 + 5, M = 1e5 + 5;
const ll INF = 1e18;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;

#define pi acos(-1)

int cnt[3][N]; //RGB
vector<int> v[3];

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = n - 1; ~i; i--)
	{
		for (int j = 0; j < 3; j++)
			cnt[j][i] = cnt[j][i + 1];
		if (s[i] == 'R')
			cnt[0][i]++;
		else if (s[i] == 'G')
			cnt[1][i]++;
		else
		{
			cnt[2][i]++;
		}
	}
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'R')
			v[0].push_back(i);
		else if (s[i] == 'G')
		{
			v[1].push_back(i);
		}
		else
		{
			v[2].push_back(i);
		}
	}
	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		int len, id;
		if (s[i] == 'R')
		{
			len = v[1].size();
			id = lower_bound(v[1].begin(), v[1].end(), i) - v[1].begin();
			for (int j = id; j < len; j++)
			{
				int k = v[1][j];
				ans += cnt[2][k];
				int d = lower_bound(v[2].begin(), v[2].end(), k + k - i) - v[2].begin();
				if (d != v[2].size() && v[2][d] == k + k - i)
					ans--;
			}
			len = v[2].size();
			id = lower_bound(v[2].begin(), v[2].end(), i) - v[2].begin();
			for (int j = id; j < len; j++)
			{
				int k = v[2][j];
				ans += cnt[1][k];
				int d = lower_bound(v[1].begin(), v[1].end(), k + k - i) - v[1].begin();
				if (d != v[1].size() && v[1][d] == k + k - i)
					ans--;
			}
		}
		else if (s[i] == 'G')
		{
			len = v[0].size();
			id = lower_bound(v[0].begin(), v[0].end(), i) - v[0].begin();
			for (int j = id; j < len; j++)
			{
				int k = v[0][j];
				ans += cnt[2][k];
				int d = lower_bound(v[2].begin(), v[2].end(), k + k - i) - v[2].begin();
				if (d != v[2].size() && v[2][d] == k + k - i)
					ans--;
			}
			len = v[2].size();
			id = lower_bound(v[2].begin(), v[2].end(), i) - v[2].begin();
			for (int j = id; j < len; j++)
			{
				int k = v[2][j];
				ans += cnt[0][k];
				int d = lower_bound(v[0].begin(), v[0].end(), k + k - i) - v[0].begin();
				if (d != v[0].size() && v[0][d] == k + k - i)
					ans--;
			}
		}
		else
		{
			len = v[1].size();
			id = lower_bound(v[1].begin(), v[1].end(), i) - v[1].begin();
			for (int j = id; j < len; j++)
			{
				int k = v[1][j];
				ans += cnt[0][k];
				int d = lower_bound(v[0].begin(), v[0].end(), k + k - i) - v[0].begin();
				if (d != v[0].size() && v[0][d] == k + k - i)
					ans--;
			}
			len = v[0].size();
			id = lower_bound(v[0].begin(), v[0].end(), i) - v[0].begin();
			for (int j = id; j < len; j++)
			{
				int k = v[0][j];
				ans += cnt[1][k];
				int d = lower_bound(v[1].begin(), v[1].end(), k + k - i) - v[1].begin();
				if (d != v[1].size() && v[1][d] == k + k - i)
					ans--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3688
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;


signed main(){
    int n,r; cin >> n >> r;
    if(n>=10) cout << r << endl;
    else cout << r+100*(10-n) << endl;
}


Measured memory_bytes: 764
#include<stdio.h>

void fibo(int);
int F[20000];
main()
{
  int n;
  scanf("%d",&n);
  fibo(n);
  printf("%d\n",F[n]);
  return 0;
}

void fibo(int n)
{
  int i;
  F[0] = 1;
  F[1] = 1;
  for(i=2;i<=n;i++){
    F[i] = F[i-2]+F[i-1];
  }
}

Measured memory_bytes: 596
// In The Name Of God
/*
ID: alimora2
LANG: C++11
TASK: PROB
*/
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int maxn = 2e2 + 1, infinite = 1e9;
int p[maxn][maxn], a[maxn], dist[maxn], adj[maxn + 1][maxn + 1];
bool visited[maxn], sset[maxn];

map<int, vector<pair<int, int> > > g;

int mind(int n) {
    int ans = infinite, mini;
    for (int i = 0; i < n; i++)
        if (sset[i] == 0 && dist[i] <= ans)
            ans = dist[i], mini = i;
    return mini;
}

void dijkstra(int src, int n) {
    for (int i = 0; i < n; i++)
        dist[i] = infinite, sset[i] = 0;
    dist[src] = 0;
    for (int i = 0; i < n; i++) {
        int u = mind(n);
        sset[u] = 1;
        for (int v = 0; v < n; v++)
            if (!sset[v] && adj[u][v] && dist[u] != infinite && dist[u] + adj[u][v] < dist[v])
                dist[v] = dist[u] + adj[u][v];
    }
    for (int i = 0; i < n; i++)
        p[src][i] = dist[i];
}

vector<int> clr(vector<int> v, int x) {
	vector<int> res;
	for (int i = 0; i < v.size(); i++)
		if (i != x)
			res.push_back(v[i]);
	return res;
}

int solve(int n, vector<int> sp, int sof) {
	if (sp.size() == 0)
		return sof + p[n][n];
	int ans = 1e9;
	for (int i = 0; i < sp.size(); i++)
		ans = min(ans, solve(sp[i], clr(sp, i), sof + p[n][sp[i]]));
	return ans;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	int n, m, r;
	vector<int> space;
	cin >> n >> m >> r;
	for (int i = 0; i < r; i++) {
		cin >> a[i];
		a[i]--;
		space.push_back(a[i]);
	}
	for (int i = 0, f, s, w; i < m; i++) {
		cin >> f >> s >> w;
		adj[--f][--s] = w;
		adj[s][f] = w;
	}
	for (int i = 0; i < r; i++) {
		fill(visited, visited + maxn, 0);
		dijkstra(a[i], n);
	}	
	int ans = 1e9;
	for (int i = 0; i < r; i++)
		ans = min(ans, solve(space[i], clr(space, i), 0));
	return cout << ans << endl, 0;
}















Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	int n,k;
	int a[52];
	scanf("%d%d",&n,&k);
	rep1(i,n)scanf("%d",&a[i]);
	k ++;
	rep1(i,n)a[i] = min( a[i] , k );
	
	vector<P> vec;
	int cnt = 0;
	rep1(i,n){
		if(k-a[i] > k/2){
			puts("-1");
			return 0;
		}
		cnt += k-a[i];
		//vec.pb(P(k-a[i],i));
	}
	if(cnt > k-1){
		puts("-1");
		return 0;
	}
	while(cnt < k-1){
		int t = 1;
		while(k-a[t]+1 > k/2)t ++;
		a[t] --;
		cnt ++;
	}
	rep1(i,n){
		vec.pb(P(k-a[i],i));
	}
	int X[52] = {};
	sor(vec);
	rev(vec);
	int loc = 1;
	rep(i,vec.size()){
		P p = vec[i];
		rep(j,p.fr){
			X[loc] = p.sc;
			loc += 2;
			if(loc > k-1)loc = 2;
		}
	}
	X[0] = 1; if(X[1] == 1)X[0] = 2;
	X[k] = 1; if(X[k-1] == 1)X[k] = 2;
	int ret[2502] = {};
	
	rep(i,k){
		loc = 2;
		rep1(j,n){
			if(j == X[i] || j == X[i+1])continue;
			ret[(n-1)*i+loc] = j;
			loc ++;
		}
	}
	rep(i,k+1){
		ret[(n-1)*i+1] = X[i];
	}
	printf("%d\n",(n-1)*k+1);
	rep1(i,(n-1)*k+1){
		printf("%d%c",ret[i],(i==(n-1)*k+1)?'\n':' ');
	}
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

string s;
int a[30], b[30];
signed main() {
	cin >> s;
	fill(a, a + 30, -1);
	rep(i, s.size()) {
		b[s[i] - 'a'] = max(b[s[i] - 'a'], i - a[s[i] - 'a']);
		a[s[i] - 'a'] = i;
	}
	rep(i, 26) {
		b[i] = max(b[i], (int)(s.size() - a[i]));
	}
	int ans = inf;
	rep(i, 26) {
		ans = min(ans, b[i] - 1);
	}
	cout << ans << endl;
	endre;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    cin >> N;
    vector<P> v[15];
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        for(int j = 0; j < a; j++){
            int x, y;
            cin >> x >> y;
            x--;
            v[i].push_back(P(x, y));
        }
    }
    int ans = 0;
    for(int i = 0; i < (1<<N); i++){
        int cnt = 0;
        bool flg = true;
        for(int j = 0; j < N; j++){
            int m = (1<<j);
            if(m&i){
                cnt++;
                for(int k = 0; k < v[j].size(); k++){
                    P p = v[j][k];
                    if(v[j][k].second == 0){
                        if((1<<v[j][k].first) & i) flg = false;
                    }
                    if(v[j][k].second == 1){
                        if(!((1<<v[j][k].first) & i)) flg = false;
                    }
                }
            }
        }
        if(flg) ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		double jiaoduH = h*360/12;
		double jiaoduM = m*360/60;
		if (jiaoduM > 0) {
			jiaoduH+= m * 1.0* 360 / (60 * 12);
		}
		double jiaodu = Math.abs(jiaoduM -jiaoduH);
		if (jiaodu > 180) {
			jiaodu = 360-jiaodu;
		}
		Double c = a*a + b*b - 2*a*b*Math.cos(jiaodu* (Math.PI)/180 );
		System.out.println(Math.sqrt(c));
	}

}


Measured memory_bytes: 36052
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>
#include <bits/stdc++.h>
#include <queue>

using namespace std;
// for loop
#define F(i, L, R) for(long i = L; i < R; i++)
#define FE(i, L, R) for(long i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(long i = L; i > R; i--)
#define FRE(i, L, R) for(long i = L; i >= R; i--)

// data types
#define Int long
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back
#define InputV(a, n) F(i,0,n){long l; cin >> l; a.pb(l);}

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

void printM(vector<vector<long> > &vec, long height, long width){
    F(i, 0, height){
        F(j, 0, width){
            cout << vec[i][j] << space;
        }
        cout << endl;
    }
}

ll flo(ull a, ull b, ull x){
    ull first = a*x;
    first = first/b;
    ull second = x/b;
    second = second * a;
    ll hoge = first  - second;
    return hoge;
}

#define TST 0
int main() {
#if TST==1
    ifstream in ("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    long n,m;
    cin >> n >> m;
    vl h(n);
    F(i, 0, n){
        cin >> h[i];
    }
    vector<vector<long> > table;
    table.resize(n);
    F(i, 0, m){
       long a,b;
       cin >> a >> b;
       a -=1;
       b -=1;
       table[a].pb(b);
       table[b].pb(a);
    }
    long ans = 0;
    F(i, 0, n){
        if(table[i].empty()){
            ans ++;
            continue;
        }
        bool flag = true;
        F(j, 0, table[i].size()){
            if(h[i] <= h[table[i][j]]){
                flag = false;
                break;
            }
        }
        if(flag)ans++;
    }
    cout << ans << endl;


#if TST==1

#endif
}


Measured memory_bytes: 9864
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cmath>

typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

using namespace std;

int main(void) {
    int H, W;
    int h, w;
    cin >> H >> W >> h >> w;
    cout << (H*W) - (h*W + w*H - h*w) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	string s; cin >> s;
	int len = s.length(); len--;
	bool out = true;
	int now = 0;
	if (s[now] == 'A')now++;
	else if (s[now] != 'K')out = false;
	if (now>len||s[now] != 'K')out = false; now++;
	if (now>len||s[now] != 'I')out = false; now++;
	if (now>len || s[now] != 'H')out = false; now++;
	if (now <= len && s[now] == 'A')now++;
	else if (now>len || s[now] != 'B')out = false;
	if (now>len || s[now] != 'B')out = false; now++;
	if (now <= len && s[now] == 'A')now++;
	else if (now>len || s[now] != 'R')out = false;
	if (now>len || s[now] != 'R')out = false; now++;
	if (len - now > 0 || (len==now&&s[now] != 'A'))out = false;
	if (out)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <algorithm>
#include <string>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define vec_all(vec) vec.begin(), vec.end()

int main() {
    int n, k;
    cin >> n >> k;
    
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }

    if (n == k) {
        cout << 1 << endl;
    } else if ((n - k) % (k - 1) == 0) {
        cout << (n - k) / (k - 1) + 1 << endl;
    } else {
        cout << (n - k) / (k - 1) + 2 << endl;
    }

    return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    string s; std::cin >> s;
    int cnt0, cnt1;
    cnt0 = cnt1 = 0;
    for (char &c : s) {
        if (c == '0') cnt0++;
        else cnt1++;
    }
    std::cout << min(cnt0, cnt1)*2 << "\n";
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var nextString func() string

func init() {
	nextString = newReadString(os.Stdin)
}

func main() {
	var W, a, b, ans int
	fmt.Scan(&W, &a, &b)

	if b > a {
		ans = max(0, b-(a+W))
	} else {
		ans = max(0, a-(b+W))
	}
	fmt.Println(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func nextInt() (result int) {
	result, _ = strconv.Atoi(nextString())
	return
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
		}
		return r.Text()
	}
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    ll H, W, N;
    cin >> H >> W >> N;
    ll ma = std::max(H, W);
    ll mi = std::min(H, W);
    ll ans = (N + ma - 1) / ma;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256