akhauriyash/Code-Regression huggingface dataset:
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;


int main() {
  ll N;

  cin >> N;

  int ans[N];
  vector<P> aLst[N];

  queue<ll> que;
  for (int i = 0; i < N; ++i) {
    ll u, v, w;
    cin >> u;
    cin >> v;
    cin >> w;
    P tmp0(v - 1, w);
    aLst[u - 1].emplace_back(tmp0);
    P tmp1(u - 1, w);
    aLst[v - 1].emplace_back(tmp1);
  }

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

  unordered_map<ll, bool> visited;

  while (!que.empty()) {
    ll cur = que.front();
    que.pop();
    // cout << "cur=" << cur << endl;
    for (size_t i = 0; i < aLst[cur].size(); ++i) {
      ll cur_child = aLst[cur][i].first;
      if (visited.count(cur_child) == 0) {
        que.push(cur_child);
        visited[cur_child] = true;
        if (aLst[cur][i].second % 2 == 0) {
          ans[cur_child] = ans[cur];
        } else {
          ans[cur_child] = 1 - ans[cur];
        }
      }
    }
  }

  for (int i = 0; i < N; ++i) {
    cout << ans[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 12452
n=int(input())
a,b,c=map(int,input().split())
dp=[[a,b,c] for i in range(n)]
for i in range(1,n):
  a,b,c=map(int,input().split())
  dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a
  dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b
  dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c
print(max(dp[n-1]))


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s; cin >> s;
    int cnt0 = 0, cnt1 = 0;
    int n = s.size();
    for(int i=0;i<n;i++){
        if(s[i] == '0') cnt0++;
        else cnt1++;
    }
    cout << min(cnt0, cnt1) * 2 << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int A,B,C,D; cin>>A>>B>>C>>D;
	while(1) {
		C-=B;
		if(C<=0) {
			cout<<"Yes\n"; return 0;
		}
		A-=D;
		if(A<=0) {
			cout<<"No\n"; return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3608
/*
 * a.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 5;
const int MAX_M = 500;

const int INF = 1 << 30;

/* typedef */

/* global variables */

int cs[10], dp[MAX_N + 1][MAX_M + 1];

/* subroutines */

/* main */

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

  int minc = INF;
  for (int i = 0; i < 10; i++) {
    cin >> cs[i];
    if (minc > cs[i]) minc = cs[i];
  }

  if (minc * n > m) {
    puts("NA");
    return 0;
  }

  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) dp[i][j] = INF;
  dp[0][0] = 0;

  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (dp[i][j] < INF) {
	for (int k = 0; k < 10; k++)
	  if (j + cs[k] <= m) {
	    int d = dp[i][j] * 10 + k;
	    if (dp[i + 1][j + cs[k]] > d) dp[i + 1][j + cs[k]] = d;
	  }
      }

  int mind = INF;
  for (int j = 0; j <= m; j++)
    if (mind > dp[n][j]) mind = dp[n][j];
  printf("%0*d\n", n, mind);
  return 0;
}


Measured memory_bytes: 1172
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;

int main(void) {
	int N;

	cin >> N;
	if ('A' <= N && N <= 'Z') cout << "1" << endl;
	else if('a' <= N && N <= 'z') cout << "2" << endl;
	else cout << "0" << endl;

	return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll rpow(ll x, ll n) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) k *= x;
        x *= x;
    }
    return k * x;
}
ll modpow(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) (k *= x) %= mod;
        (x *= x) %= mod;
    }
    return k * x % mod;
}
ll modcomb(ll n, ll r, ll mod) {
    if (r < 0 || n < r) return 0;
    chmin(n - r, r);
    ll mul = 1, div = 1;
    for (ll i = 0; i < r; i++) {
        (mul *= n - i) %= mod;
        (div *= i + 1) %= mod;
    }
    return mul * modpow(div, mod - 2, mod) % mod;
}

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

void solve();

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

    solve();
}
void solve() {
    ll n;
    std::cin >> n;

    vll f(n + 1, 0);
    for (ll i = 1; i <= n; i++) for (ll j = 1; i * j <= n; j++)
        f[i * j]++;

    ll ans = 0;
    for (ll i = 1; i <= n; i++)
        ans += i * f[i];

    std::cout << ans << '\n';
}


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

using namespace std;

#define int long long

int32_t main()
{
  string s;
  cin>>s;
  int n=s.length(),k=2019,ans=0;
   vector<int>cnt(200005);
   ++cnt[0];
   int curr=0,prev=1;
    for(int i=n-1;i>=0;i--){
        curr=(curr+(s[i]-'0')*prev)%k;
        ans+=cnt[curr];
        ++cnt[curr];
        prev=prev*10%k;
    }
    cout<<ans<<endl;
  }




Measured memory_bytes: 5172
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	buffer := make([]byte, 200000)
	scanner.Buffer(buffer, 10*200000)
	var n int
	scanner.Scan()
	n, _ = strconv.Atoi(scanner.Text())
	a := make([]int, n)
	scanner.Scan()
	args := strings.Split(scanner.Text(), " ")
	for i := 0; i < n; i++ {
		var j int
		j, _ = strconv.Atoi(args[i])
		a[i] = j
	}

	b := make([]int, n)
	for i := n - 1; i >= 0; i-- {
		sum := 0
		for j := (i + 1) * 2; j <= n; j += (i + 1) {
			sum += b[j-1]
		}
		if a[i] != (sum % 2) {
			b[i] = 1
		} else {
			b[i] = 0
		}
	}

	ans := make([]string, n)
	m := 0
	for i := 0; i < n; i++ {
		if b[i] == 1 {
			ans[m] = fmt.Sprint(i + 1)
			m++
		}
	}

	buf := strings.Join(ans, " ")

	fmt.Println(m)
	if m != 0 {
		fmt.Println(buf)
	}
}


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

int main() {
  int N;
  string S;
  int counter=0;
  cin >> N >> S;
  for (int i=0; i<N-2; i++){
    if (S.at(i) =='A' && S.at(i+1) == 'B' && S.at(i+2)=='C'){
      counter++;
    }
  }
  cout << counter << endl;
}


Measured memory_bytes: 3560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int h = Integer.parseInt(sc.next());
		int w = Integer.parseInt(sc.next());
		sc.close();

		int cnt=0;
		for(int i=0;i<n-w+1;i++) {
			for(int j=0;j<n-h+1;j++) {
				cnt ++;
			}
		}

		System.out.println(cnt);
	}

}


Measured memory_bytes: 21844
// Problem : A - We Love Golf
// Contest : AtCoder - AtCoder Beginner Contest 165
// URL : https://atcoder.jp/contests/abc165/tasks/abc165_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//look at my code
//my code is amazing
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007 //998244353
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define f(i,n) for(ll i=0;i<n;i++)
#define nl "\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define cout1(a) cout<<a<<nl
#define cout2(a,b) cout<<a<<" "<<b<<nl
#define cout3(a,b,c) cout<<a<<" "<<b<<" "<<c<<nl
#define cout4(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<nl
#define vcout(v,i) cout<<v[i].fi<<" "<<v[i].se<<nl
#define x first
#define y second
#define vc vector
#define pb push_back
#define ar array
#define all(a) (a).begin(), (a).end()
#define ms(v,n,x) fill(v,v+n,x);
#define init(c,a) memset(c,a,sizeof(c))
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define sll set<ll>
#define vll vector<ll>
#define vpll vector<pll>
#define maxi(a,b,c) max(a,max(b,c))
#define maxii(a,b,c,d) max(max(a,b),max(c,d))
#define mini(a,b,c) min(a,min(b,c))
#define md(a,b)  ((a%mod)*(b%mod)+mod)%mod 
#define inf 9e18
#define cases ll T;cin>>T;while(T--)
#define BLOCK 500
//const double PI = 3.141592653589793238460;
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
// const int N=;

int32_t main()
{
    
	fast
	
	
	ll k,a,b;
	cin>>k>>a>>b;
	ll f=0;
	for(ll i=1;i*k<=b;i++){
		if(i*k>=a and i*k<=b)
		{
			f=1;
			cout<<"OK";
			return 0;;
		}
			
	}
	
	cout<<"NG";
	

	



    

	return 0;
    
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, m, n) for (int i = m; i < n; ++i)
const int MOD = 1000000007;
template<class T> void add(T &a, T b) { a = (a + b) % MOD; }

ll dp[101010][2];
int main() {
  string S; cin >> S;
  int N = S.size();
  dp[0][0] = 1;
  rep(i, 0, N) {
    add(dp[i+1][1], dp[i][1] * 3);
    if(S[i] == '0') {
      add(dp[i+1][0], dp[i][0]);
    } else {
      add(dp[i+1][0], dp[i][0] * 2);
      add(dp[i+1][1], dp[i][0]);
    }
  }
  ll ans = 0;
  add(ans, dp[N][0] + dp[N][1]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a == b && b == c) cout << 1 << endl;
    else if(a != b && b != c && c != a) cout << 3 << endl;
    else cout << 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int lenght(int x){
  if(x<0){ 
  return -x;
  }
  else{
  return x;
  }
}
int main(){
  int N,K;
  cin>>N>>K;
  vector<int> x(N);
  for(int i=0;i<N;i++){
    cin>>x.at(i);
  }
  int ans=0;
  for(int i=0;i<N;i++){
    ans+=min(lenght(K-x.at(i)),lenght(x.at(i)))*2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3608
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
const char sp =' ';
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
		ll d,t,s;
		cin >> d>>t>>s;
		if(s*t>=d)cout <<"Yes"<<nl;
		else cout << "No"<<nl;
	
	return 0;
}

// read the question correctly (ll vs int)
// template by bqi343


Measured memory_bytes: 3596
def transform():
    text = input()
    num_order = int(input())

    for _ in range(num_order):
        order = input().split()
        a = int(order[1])
        b = int(order[2])

        if order[0] == "print":
            print(text[a: b + 1])
        elif order[0] == "reverse":
            text = text[0: a] + text[b - len(text): a - len(text) - 1: -1] + text[b + 1:]
        elif order[0] == "replace":
            text = text[0: a] + order[3] + text[b + 1:]


if __name__ == "__main__":
    transform()



Measured memory_bytes: 5616
package main

import (
	"bufio"
	"fmt"
	"os"
	//"strings"
)

//大量のデータを標準入力から受け取る時はnextLineを使うようにすると高速
var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	counter := 0
	
	for {
		for i := 0; i < n; i++ {
			if a[i]%2 == 0 {
				a[i] = a[i] / 2
			}else {
				goto L
			}
		}
		counter++
	}
L:
	fmt.Println(counter)
}


Measured memory_bytes: 640
def main():
    a = [list(map(int, input().split())) for i in range(3)]
    n = int(input())
    for i in range(n):
        x = int(input())
        for j in range(3):
            for k in range(3):
                if a[j][k] == x:
                    a[j][k] = 0
    f = False
    for i in range(3):
        s = True
        for j in range(3):
            if a[i][j] != 0:
                s = False
        if s:
            f = True
    for i in range(3):
        s = True
        for j in range(3):
            if a[j][i] != 0:
                s = False
        if s:
            f = True
    if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
        f = True
    if a[2][0] == 0 and a[1][1] == 0 and a[0][2] == 0:
        f = True
    if f:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

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

const int N = 2e5 + 5;

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	string x, s = ""; cin >> x;
	for (char c : x) {
		if (!s.empty() && s.back() == 'S' && c == 'T') s.pop_back();
		else s += c;
	}
	cout << sz(s) << endl;

	return 0;
}


Measured memory_bytes: 916
use std::io::stdin;

fn abs(a: isize) -> isize {
    if a < 0 { -a } else { a }
}

fn main() {
    let mut n = String::new();
    stdin().read_line(&mut n).unwrap();
    let n: usize = n.trim().parse().unwrap();

    let mut ws = String::new();
    stdin().read_line(&mut ws).unwrap();
    let ws: Vec<isize> = ws.trim().split_whitespace().flat_map(str::parse).collect();

    let mut l = 0;
    let mut r: isize = ws.clone().into_iter().sum();
    let mut best = r;
    for w in ws.into_iter() {
        l += w;
        r -= w;
        let a = abs(l - r);
        if a < best {
            best = a;
        }
    }
    println!("{}", best);
}


Measured memory_bytes: 4352
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define MSG(x) std::cout << #x << " : " << x << "\n";
using namespace std;
using lint = long long;
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; }

int r, D, x2000;
int next_x[1000];


int main()
{
    cin >> r;
    cin >> D;
    cin >> x2000;

    next_x[0] = x2000;
    rep (i, 10)
    {
        next_x[i + 1] = r*next_x[i] - D;
        cout << next_x[i + 1] << "\n";
    }

    return 0;
}


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

using namespace std;
using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main() {
    int R, G;
    cin >> R >> G;

    cout << 2 * G - R << endl;

    return 0;
}

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

#define INF (2e9)
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

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

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

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<ll>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;
using vai = va<ll>;
using vvai = va<vai>;

using pii = pair<ll, ll>;

vi Read(ll n) {
    auto      v = vi(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

template<class T>
void DumpRow(const T& A) {
    for (const auto& value : A)
        cout << value << "\n";
}

template<class T>
void DumpColumn(const T& A) {
    auto isFirst = true;
    for (const auto& value : A) {
        if (isFirst) {
            cout << value;
            isFirst = false;
        } else {
            cout << " " << value;
        }

    }
    cout << endl;
}

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

    ll a, b, k;
    cin >> a >> b >> k;

    if (a >= k) a -= k;
    else {
        k -= a;
        a = 0;
        if (b >= k) b -= k;
        else b = 0;
    }
    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int a[205];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=2*n;i++)
		cin>>a[i];
	int ans=0;
	sort(a+1,a+n*2+1);
	for(int i=1;i<=2*n;i+=2)
		ans+=a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
double ans,p[3010],head,tail,dp[3010][3010];

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

Measured memory_bytes: 69120
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 2000000000
#define LLINF 2000000000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
// #define int long long

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

int lcm(int a, int b){
    return a * b / gcd(a, b);
}

signed main(){
  int n,m;
  cin >> n >> m;
  bool ac[100000]={};
  int wa[100000]={};
  int ans = 0;
  int acd = 0;
  LOOP(i,m){
    int a;
    string s;
    cin >> a >> s;
    if(s=="AC"){
      if(ac[a])continue;
      acd ++;
      ac[a]=true;
      ans += wa[a];
    }else{
      wa[a]++;
    }
  }
  cout << acd << " " << ans << endl;
}


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

ll mod=1e9+7;
vector<ll> tfact(1e7+1,-1);
ll n,k;
ll mpow(ll x, ll n){
   ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mod;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}

ll fact(ll n) {
  if(tfact[n]<0) {
    if(n==0) {
      tfact[n]=1;
    }
    else {
      tfact[n]=fact(n-1)*n%mod;
    }
  }
  return tfact[n];
}

ll comb(ll n, ll k) {
  return fact(n)*mpow(fact(k),mod-2)%mod*mpow(fact(n-k),mod-2)%mod;
}


int main() {
  cin >> n >> k;
  vector<ll> x(n);
  for(int i=0;i<n;i++) {
    cin >> x.at(i);
  }
  sort(x.rbegin(),x.rend());
  
  ll pans=0;
  ll mans=0;
  for(int i=0;i<=n-k;i++) {
    pans = (pans + x.at(i)*comb(n-1-i,k-1)%mod)%mod;
    mans = (mod+mans - x.at(n-1-i)*comb(n-1-i,k-1)%mod)%mod;
  }
  ll ans =(mod+pans+mans)%mod;
  cout << ans << endl;
}

Measured memory_bytes: 82304
/*
By Snickeen
*/
#include<bits/stdc++.h>
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <string>
#include <vector>
#include <bitset>
#include <functional>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
typedef long double ldb;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repu(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define repc(i,a,b,c) for(i=a;i<b;i+=c)
#define repcu(i,a,b,c) for(i=a;i<=b;i+=c)
#define repcd(i,a,b,c) for(i=a;i>=b;i-=c)
#define FIN freopen("input.in","r",stdin)
#define FOUT freopen("output.out","w",stdout)
#define CC(a) memset(a,0,sizeof(a))
#define MST(a,b) memset(a,b,sizeof(a))
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define VI vector<int>
#define VL vector<LL>
#define VII vector<PII >
#define VLL vector<PLL >
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define FF first
#define SS second

template<typename T>inline void gn(T &x){
	x=0;T f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
template<typename T>inline void gt(T x){
	if(!x)return;
	gt(x/10);putchar(x%10+'0');
}
 
const LL MAXN=2e6+10;
LL t,n,m,ans;
LL MOD=1e9+7,inf=0x1f1f1f1f;
db eps=1e-5;

LL f[MAXN];

int main()
{
//	ios_base::sync_with_stdio(false);cin.tie(0);
	LL i,j,k,l,ca=0,u,v;
	u=v=0;
	cin>>n>>m;
	repu(i,1,m)cin>>f[i],u+=f[i],v=max(v,f[i]);
	u-=v;
	v=v-u-1;
	ans=max(v,0LL);
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using P = pair<int, int>;
constexpr array<int, 4> dx = {1, 0, -1, 0};
constexpr array<int, 4> dy = {0, 1, 0, -1};
constexpr int INF = 1234567890;
constexpr int MOD = 1000000000 + 7;
// constexpr int MOD = 998244353;
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;
}
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int fact(int n) { return n > 1 ? n * fact(n - 1) % MOD : 1; }
int modinv(int a)
{
    int b = MOD, u = 1, v = 0;
    while (b)
    {
        int t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= MOD;
    if (u < 0)
        u += MOD;
    return u;
}
constexpr int modpow(int a, int n)
{
    int rtn = 1;
    while (n > 0)
    {
        if (n & 1)
            rtn = rtn * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return rtn;
}

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

    int n;
    cin >> n;

    int ans = -1;

    for (int i = 0; i < 50000; i++)
    {
        if ((int)(i * 1.08) == n)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
}


Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            Console.WriteLine(getAns(n));
        }
    }
    static int getAns(int n)
    {
        var ans = 0;
        var p = 2;
        var tp = n - p * (p - 1) / 2;
        while (tp > 0)
        {
            if (tp % p == 0) ans++;
            p++;
            tp = n - p * (p - 1) / 2;
        }
        return ans;
    }
}



Measured memory_bytes: 13840
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  cout<<(a+b+1)/2<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
int main() {
	int n; ll l; cin >> n >> l;
	int ans = -1;
	ll b; cin >> b;
	for (int i = 1; i < n; i++) {
		ll a; cin >> a;
		if (b + a >= l)ans = i;
		b = a;
	}
	if (ans == -1)cout << "Impossible\n";
	else {
		cout << "Possible\n";
		for (int i = 1; i < ans; i++) cout << i << endl;
		for (int i = n - 1; i > ans; i--) cout << i << endl;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 768
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func calc(n int) float64 {
	tmp := 100000.0
	for i := 0; i < n; i++ {
		tmp *= 1.05
		tmp = ceil(tmp, -3)
	}
	return tmp
}

func ceil(f float64, places int) float64 {
	shift := math.Pow(10, float64(places))
	return math.Ceil(f*shift)/shift
}

func main() {
	scanner.Split(bufio.ScanWords)
	n := nextInt()
	ans := calc(n)
	fmt.Println(int(ans))
}


Measured memory_bytes: 1100
// Last Change: 03/24/2019 21:08:36.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

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

  int ansSize = 0;
  int cnt = 0;
  for (int i = 0; i < S.size(); ++i) {
    if (S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C') {
      ++cnt;
      ansSize = max(ansSize, cnt);
    } else {
      cnt = 0;
    }
  }

  cout << ansSize << endl;

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 256
def iput(): return int(input())
def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))

def solve():
    h1, m1, h2, m2, k = mput()
    hoge = h1*60+m1
    huga = h2*60+m2-k
    piyo = huga - hoge
    print(piyo)
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9184
h,w=map(int,input().split())

a = [input() for _ in range(h)]
dp=[[0 for i in range(w)] for j in range(h)]
MOD=10**9+7
if a[0][0]==".":
    dp[0][0]=1

for i in range(h):
    for j in range(w):
        if a[i][j]==".":
            if j-1>=0 :
                dp[i][j]+=dp[i][j-1]
            if i-1>=0:
                dp[i][j]+=dp[i-1][j]
            dp[i][j]%=MOD
        else:
            continue

print(dp[h-1][w-1]%MOD)

Measured memory_bytes: 44640
#[derive(Clone, Copy, Debug)]
struct Edge {
    to: usize,
    cost: usize,
}

fn diameter(adjl: &Vec<Vec<Edge>>, v: usize, p: usize, ans: &mut usize) -> usize {
    let mut sub_diam = std::collections::BinaryHeap::new();
    for e in &adjl[v] {
        if e.to == p {
            continue;
        } else {
            sub_diam.push(diameter(&adjl, e.to, v, ans) + e.cost);
        }
    }
    match sub_diam.len() {
        0 => 0,
        1 => {
            let m = sub_diam.pop().expect("something wrong");
            *ans = max(*ans, m);
            m
        }
        _ => {
            let m1 = sub_diam.pop().expect("something wrong");
            let m2 = sub_diam.pop().expect("something wrong");
            *ans = max(*ans, m1 + m2);
            m1
        }
    }
}

fn main() {
    let n = read();
    let mut adjl = vec![vec![]; n];
    for _ in 1..n {
        let (s, t, w): (usize, usize, usize) = (read::<usize>(), read::<usize>(), read::<usize>());
        adjl[s].push(Edge { to: t, cost: w });
        adjl[t].push(Edge { to: s, cost: w });
    }
    let mut ans = 0;
    diameter(&adjl, 0, 0, &mut ans);
    println!("{}", ans);
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========



Measured memory_bytes: 29308
import math
line = [int(x) for x in input().split(" ")]
r = line[0]
g = line[1]
b = line[2]
n = line[3]
m = [r,g,b]
m.sort()
m.reverse()

res = 0

ro1 = list(range(math.floor(n / m[0]) + 1))
ro1.reverse()

for i in ro1:
    p = i * m[0]
    ro2 = list(range(math.floor((n - p) / m[1]) + 1))
    ro2.reverse()
    for j in ro2:
        q = p + j * m[1]

        if (n - q) % m[2] == 0:
            res += 1
print(res)


Measured memory_bytes: 3316
S = input()

zero = 0
for i, e in enumerate(S):
    if i % 2 == 0 and e == '1':
        zero += 1
    elif i % 2 == 1 and e == '0':
        zero += 1
one = 0
for i, e in enumerate(S):
    if i % 2 == 0 and e == '0':
        one += 1
    elif i % 2 == 1 and e == '1':
        one += 1

print(min(zero, one))


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

#define len length()
#define sz size()
#define rep(i, n) for(int i = 0; i < n; i++)
#define sort(v) sort(v.begin(), v.end())
#define veci(a, n) vector<int> a(n)
#define vecs(a, n) vector<string> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define sp(n) cout << setprecision(n) << fixed

int main(){
    int N;
    cin >> N;
    N += 0.0000001;
    sp(0);
    cout << pow(int(pow(N, 0.5)), 2) << endl;
    return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop
import sys
n, m, s = map(int, input().split())
edges = list()
for _ in range(m):
  new_u, new_v, new_a, new_b = map(int, input().split())
  edges.append((new_u-1, new_v-1, new_a, new_b))
coins_range = (n-1)*max(edges,key=lambda item:item[2])[2]+1
c, d = list(), list()
for _ in range(n):
  new_c, new_d = map(int, input().split())
  c.append(new_c)
  d.append(new_d)
adjacency = {(i, j): [] for i in range(n) for j in range(coins_range)}
for (node, coins) in adjacency.keys():
  new_coins = coins+c[node]
  if new_coins<=coins_range-1:
    adjacency[(node, coins)].append(((node, coins+c[node]), (d[node])))
for edge in edges:
  node1, node2, cost, weight = edge
  for coins in range(cost, coins_range):
    adjacency[(node1, coins)].append(((node2, coins-cost), weight))
    adjacency[(node2, coins)].append(((node1, coins-cost), weight))
def dijkstra():
  while state_heap:
    distance, state = heappop(state_heap)
    if visited[state]:
      continue
    visited[state] = True
    for (new_state, weight) in adjacency[state]:
      if not visited[new_state]:
        distances[new_state] = min(distances[new_state], distance+weight)
        heappush(state_heap, (distances[new_state], new_state))
distances = {(i, j): float("inf") for i in range(n) for j in range(coins_range)}
initial_state = (0, min(s, coins_range-1))
distances[initial_state] = 0
state_heap = []
heappush(state_heap, (distances[initial_state], initial_state))
visited = {(i, j): False for i in range(n) for j in range(coins_range)}
dijkstra()
final_distances = [float("inf")]*n
for ((node, _), distance) in distances.items():
  final_distances[node] = min(final_distances[node], distance)
[print(distance) for distance in final_distances[1:]]

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

using namespace std;

int main(void)
{
  //5+ 1854-
  int N;
  cin>>N;
  for(int i=1;i<10;i++){
    if(N%i==0){
      if(N/i<10){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }

  cout<<"No"<<endl;

  return 0;
}

Measured memory_bytes: 256
w,h,n = map(int,input().split())
up = h
down = 0
left = 0
right = w
for i in range(n):
    x, y, a = map(int,input().split())
    if a == 1:
        left = max(left,x)
    elif a == 2:
        right = min(right,x)
    elif a == 3:
        down = max(down,y)
    else:
        up = min(up,y)
print(max(0, right - left) * max(0, up - down))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define M 1000000007
#define N 55
using namespace std;
typedef long long ll;
string num[3];
ll d[N][2],ans;

string get_num(int x,int y){
  string res;
  if(num[y][x]!='?')res+=num[y][x];
  else res+="0123456789";
  return res;
}

void update(int x){
  string a=get_num(x,0);
  string b=get_num(x,1);
  string c=get_num(x,2);

  ll A=0,B=0,C=0,D=0;
  for(int i=0;i<a.size();i++){
    for(int j=0;j<b.size();j++){
      for(int k=0;k<c.size();k++){
	int sum=a[i]-'0'+b[j]-'0';
	int Ans=c[k]-'0';
	if(!x&&(a[i]=='0'||b[j]=='0'||c[k]=='0'))continue;
	if(sum%10==Ans){
	  if(sum<10)A++;
	  else B++;
	}
	if((sum+1)%10==Ans){
	  if(sum+1<10)C++;
	  else D++;
	}
      }
    }
  }
  
  if(!x)ans=(d[x][0]*A+d[x][1]*C)%M;
  else{
    d[x-1][0]=(d[x][0]*A+d[x][1]*C)%M;
    d[x-1][1]=(d[x][0]*B+d[x][1]*D)%M;
  }
}

int main(){
  while(1){
    cin>>num[0];
    if(num[0]=="0")break;
    cin>>num[1]>>num[2];

    memset(d,0,sizeof(d));
    d[num[0].size()-1][0]=1;
    
    for(int i=num[0].size()-1;i>=0;i--)update(i);
    
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3188
class SparseTable():
    def __init__(self, array, n):
        '''テーブルを構築する'''
        self.row_size = n.bit_length()

        # log_tableを構築する
        # log_table = [0, 0, 1, 1, 2, 2, 2, 2, ...]
        self.log_table = [0] * (n + 1)
        for i in range(2, n + 1):
            self.log_table[i] = self.log_table[i//2] + 1

        # sparse_tableを構築する
        self.sparse_table = [[0] * n for _ in range(self.row_size)]
        for i in range(n):
            self.sparse_table[0][i] = array[i]
        for row in range(1, self.row_size):
            for i in range(n - (1 << row) + 1):
               self.sparse_table[row][i] = self._merge(self.sparse_table[row - 1][i], \
                                                       self.sparse_table[row - 1][i + (1 << row - 1)])

    def _merge(self, num1, num2):
        '''クエリの内容'''
        return min(num1, num2)

    def query(self, l, r):
        '''区間[l, r)に対するクエリに答える'''
        if r == l:
            return None
        row = self.log_table[r - l]
        return self._merge(self.sparse_table[row][l], self.sparse_table[row][r - (1 << row)])
  
n = int(input())
a = list(map(int, input().split()))
st = SparseTable(a, n)
ans = 0
for i in range(n):
    ok = i + 1
    ng = n + 1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if st.query(ok, mid) < a[i]:
            ng = mid
        else:
            ok = mid
    tmp1 = ok - i - 1
    
    ok = i
    ng = -1
    mid = (ok + ng) // 2
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if st.query(mid, i + 1) < a[i]:
            ng = mid
        else:
            ok = mid
    tmp2 = i - ok
    ans += ((tmp1+1) * (tmp2+1))* a[i]
print(ans)

Measured memory_bytes: 109436
// gunwo kod Marcina
#include <bits/stdc++.h>
 
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define RE(i,n) FOR(i,1,n)
#define R(i,n) REP(i,n)
#define FI first
#define SE second
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
 
template<class C> void mini(C& a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C& a4, C b4) { a4 = max(a4, b4); }
 
template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
 
template<class T> ostream &operator<<(ostream &os, vector<T> V){
  os<<"[";for(auto vv:V)os<<vv<<",";return os<<"]";
} 
 
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}
 
 
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif
 
#define x FI
#define y SE
 
int n;
vector<PII> x;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  PII s,t;
  cin >> s.x >> s.y >> t.x >> t.y;
  bool swa = 0;
  if(s > t){
    swap(s,t);
  }
  if(s.y > t.y){
    s.y *=-1;
    t.y *=-1;
    swa = 1;
  }
  cin >> n;
  R(i,n){
    PII pom;
    cin >> pom.x >> pom.y;
    if(swa){
      pom.y *=-1;
    }
    if(pom < s || pom > t || pom.y > t.y || pom.y < s.y){
      continue;
    }
    x.PB(pom);
  }
//   if((s.x == t.x || s.y == t.y) && SZ(x)){
//     cout << ((t.x - s.x) + (t.y - s.y))*100 - 20 + 10 * M_PI << "\n";
//     return 0;
//   }
  debug(SZ(x));
  sort(ALL(x));
  vector<int> st;
  //st.PB(s.y);
  for(PII el:x){
    int po = -1;
    int ko = SZ(st);
    while(po + 1 != ko){
      int m = (po + ko) / 2;
      if(st[m] <= el.y){
        po = m;
      }else{
        ko = m;
      }
    }
    //debug(ko,st[0],el.y);
    if(SZ(st) == ko)st.PB(0);
    st[ko] = el.y;
  }
  debug(SZ(st)-1);
  const LD C = 5 * M_PI - 20;
  LD res = ((t.x - s.x) + (t.y - s.y)) * 100 + C * (SZ(st));
  if(SZ(st) > min(t.x - s.x, t.y - s.y)){
    debug(":P");
    res += 5 * M_PI;
  }
  cout << res << "\n";
}

Measured memory_bytes: 7788
#include<bits/stdc++.h>
#define N 100005
using namespace std;
const double eps=1e-12;
struct edge{
    double x,y;
}node[N];
edge operator + (const edge &a,const edge &b){
    return (edge){a.x+b.x,a.y+b.y};
}
edge operator - (const edge &a,const edge &b){
    return (edge){a.x-b.x,a.y-b.y};
}
edge operator * (const edge &a,const edge &b){
    return (edge){a.x*b.x,a.y*b.y};
}
edge operator / (const edge &a,const edge &b){
    return (edge){a.x/b.x,a.y/b.y};
}
edge O;
edge c2={2.0,2.0};
double r;
inline double dis(edge a,edge b){
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
inline edge circle(edge xx,edge yy,edge zz){
    double a=yy.y-xx.y,b=zz.y-xx.y,c=yy.x-xx.x,d=zz.x-xx.x;
    double e=yy.x*yy.x-xx.y*xx.y+yy.y*yy.y-xx.x*xx.x;
    double f=zz.x*zz.x+zz.y*zz.y-xx.x*xx.x-xx.y*xx.y;
    double fm=(a*d-b*c)*2.0;
    return (edge){(a*f-b*e)/fm,(d*e-c*f)/fm};
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
        scanf("%lf%lf",&node[i].x,&node[i].y);
    random_shuffle(node+1,node+n+1);
    O=node[1];r=0;
    for(int i=2;i<=n;++i){
        if(dis(node[i],O)>r+eps){
            O=node[i];r=0;
            for(int j=1;j<i;++j){
                if(dis(O,node[j])>r+eps){
                    O=(node[i]+node[j])/c2;
                    r=dis(O,node[j]);
                    for(int z=1;z<j;++z){
                        if(dis(O,node[z])>r+eps){
                            O=circle(node[i],node[j],node[z]);
                            r=dis(O,node[i]);
                        }
                    }
                }
            }
        }
    }
    printf("%.10lf\n",r);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    int m1=0,m2=0;
    rep(i,n){
        cin >> a[i];
        if(m1<=a[i]){
            m2=m1;
            m1=a[i];
        }
        else{
            if(m2<a[i]){
                m2=a[i];
            }
        }
    }
    rep(i,n){
        if(a[i]==m1){
            cout << m2<<endl;
        }
        else{
            cout << m1<<endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3928
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double a = scanner.nextDouble();
        System.out.println(String.format("%.6f", a*a*Math.PI) + " " + String.format("%.6f", (a+a)*Math.PI));
    }
}



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

vector<long> a,b,c;
vector<vector<long long>> data,dp;

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

  a = b = c = vector<long>(N);
  data = vector<vector<long long>>(N+10,vector<long long>(3));
  dp   = vector<vector<long long>>(N+10,vector<long long>(3));
  for(long i=0;i<N;i++){
    cin >> a[i] >> b[i] >> c[i];
    data[i][0] = a[i];
    data[i][1] = b[i];
    data[i][2] = c[i];
  }
  for(long i=0;i<N;i++){
    for(int j=0;j<3;j++){
      dp[i][j] = 0;
    }
  }
  for(long i=0;i<N;i++){
    for(int bf=0;bf<3;bf++){
      for(int af=0;af<3;af++){
        if(bf == af) continue;
        dp[i+1][af] = max(dp[i+1][af],dp[i][bf] + data[i][af]);
      }
    }
  }

  long ans;

  ans = max(dp[N][0],max(dp[N][1],dp[N][2]));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 13568
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define vec_output(v) for(auto it=v.begin();it!=v.end();it++){if(it!=v.begin())cout<<" ";cout<<*it;}cout<<endl;
#define vec_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
template <typename T>T digitsum(T n);
template <typename T>bool isPrime(T n);
template <typename T>vector<pair<T, T>> prime_factor(T n);
long long int intpow(long long int,long long int);
template <typename T>T intlog(T);
long long int combination(long long int,long long int);
long long int arith_sum1(long long int,long long int,long long int);
long long int arith_sum2(long long int,long long int,long long int);
long long int series_sum(long long int);

int main(){
    ll n,a,b,ans;
    cin>>n>>a>>b;
    if(a==b){
        cout<<1<<endl;
        return 0;
    }
    if(a>b){
        cout<<0<<endl;
        return 0;
    }
    if(n>=3){
        cout<<(n-2)*(b-a)+1<<endl;
    }
    if(n==2){
        cout<<1<<endl;
    }
    if(n==1){
        cout<<0<<endl;
    }
}

Measured memory_bytes: 3568
#include<stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d%d", &a, &b);
	c = a * b;
	if (c % 2 == 0) {
		printf("Even");
	}
	else if (c % 2 == 1) {
		printf("Odd");
	}
	return 0;
}

Measured memory_bytes: 128
open Printf
open Scanf

let rec gcd m n =
  if n = 0 then m
  else gcd n (m mod n)

let lcm m n = m * n / (gcd m n)
            
let () =
  let a, b, c = scanf "%d %d %d\n" (fun x y z -> (x, y, z)) in
  let rec check s t =
    if s > t then "NO"
    else if s mod b = c then "YES"
    else check (s + a) t in
  check a (lcm a b) |> printf "%s\n"


Measured memory_bytes: 384
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		String S = s.next();
		int n = 0, m = 0;
		for (int i = 0; i < S.length(); i++){
			if (S.substring(i, i + 1).equals("1")) n++;
			else m++;
		}
		System.out.println(2 * Math.min(n, m));
	}
}


Measured memory_bytes: 31776
#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.at(i);
    }

    int cnt=1;
    int tmp=0;
    
    for (int i = 1; i < N; i++) {
        for (int j=0;j<i;j++){
            if(H.at(j) <= H.at(i)){
                tmp = tmp + 1;
            }
        }
        if (tmp==i){
            cnt = cnt + 1;
        }
        tmp = 0;
    }
    
    cout << cnt << endl;
}


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

int main(){
  int N, K;
  string S;
  cin >> N >> S >> K;

  K--;
  for(int i=0;i<N;i++) cout << ((S[i]!=S[K])?'*':S[i]);
  cout << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000000000000
#define mod 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

signed main() {
	int n;
	cin >> n;
	cout << (n - 2) * 180 << endl;

	return 0;
}


Measured memory_bytes: 256