akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cctype>
#include <algorithm>

using namespace std;

int g[222][222],f[222][222];;
char s[222222];
int sz = 0;
int pos;
int d[]={0,1,0,-1};
typedef int ll;

int put(int x,int y)
{
  if( x < 0 || x > 200 || y < 0 || y > 200 || !g[y][x] ) return 0;
  g[y][x] = 0;
  int res = 1;
  for( int i = 0; i < 4; i++ ) {
    res += put(x+d[i],y+d[3-i]);
  }
  return res;
}

ll number()
{
  ll a = 0;
  while( isdigit(s[pos]) ) {
    a = a*10+s[pos]-'0';
    ++pos;
  }
  return a;
}
ll fact()
{
  return number();
}

ll term()
{
  ll a = number();
  while( s[pos] == '*' ) {
    pos += 1;
    a *= fact();
  }
  return a;
}

ll expr()
{
  ll a = term();
  while( s[pos] == '+' || s[pos] == '-' ) {
    char o = s[pos];
    pos += 1;
    ll b = term();
    if( o == '+' ) a += b;
    else a -= b;
  }
  return a;
}

ll aaa()
{
  pos = 0;
  return expr();
}

int main(void)
{
  int n;
  scanf("%d",&n);
  for( int i = 0; i < n; i++ ) {
    int x1,y1,x2,y2; scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
    if( x1 == x2 ) {
      if( y2 < y1 ) swap(y1,y2);
      for( int y = y1; y <= y2; y++ ) f[y][x1] = g[y][x1] = 1;
    } else {
      if( x2 < x1 ) swap(x1,x2);
      for( int x = x1; x <= x2; x++ ) f[y1][x] = g[y1][x] = 1;
    }
  }
  for( int x = 0; x <= 200; x++ ) {
    for( int y = 0; y <= 200; y++ ) {
      if( g[y][x] ) {
        int c = put(x,y);
        switch(c) {
        case 12:
          if( !f[y+3][x+0] ) s[sz++] = '9';
          else if( !f[y+2][x+1] ) s[sz++] = '0';
          else s[sz++] = '6';
          break;
        case 5:
          if( f[y+1][x+0] ) s[sz++] = '1';
          else s[sz++] = '+';
          break;
        case 11:
          if( !f[y+1][x+2] ) s[sz++] = '5';
          else if( !f[y+3][x] ) s[sz++] = '3';
          else s[sz++] = '2';
          break;
        case 9:
          s[sz++] = '4';
          break;
        case 7:
          s[sz++] = '7';
          break;
        case 13:
          s[sz++] = '8';
          break;
        case 3:
          s[sz++] = '-';
          break;
        case 1:
          s[sz++] = '*';
          break;
        }
      }
    }
  }
  s[sz] = 0;
  printf("%d\n",aaa());
  return 0;
}


Measured memory_bytes: 1080
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	int N;double d;
	scanf("%d%lf",&N,&d);
	vector<pair<double,double> >v={{d,d}};
	//????????????**2-??????(??????)??????**2 == ?¨?????????????**2
	for(int i=1;i<N;i++){
		scanf("%lf",&d);
		vector<double>a(i);
		transform(v.begin(),v.end(),a.begin(),[&](const pair<double,double> &e)->double{
			return sqrt((e.first+d)*(e.first+d) - (e.first-d)*(e.first-d)) + e.second;
		});
		v.emplace_back(d,max(d,*max_element(a.begin(),a.end())));
	}
	vector<double>a(N);
	transform(v.begin(),v.end(),a.begin(),[&](const pair<double,double> &e)->double{
		return e.first+e.second;
	});
	printf("%f\n",*max_element(a.begin(),a.end()));
}

Measured memory_bytes: 2752
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int n;
    scanf("%d", &n);
    ll ans = 0;
    for (int i = 1; i < n; i++)
    {
        ans += ((n-1)/i);
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 3820
package main

import (
	"fmt"
)

func main() {
	var N, r int
	fmt.Scan(&N)
	arr := make([]int, N)
	var wa [][]int
	for i := 0; i < N; i++ {
		fmt.Scan(&arr[i])
	}
	wa = sliceSplit(arr, 0)
	for len(wa) > 0 {
		v := wa[0]
		wa = wa[0+1:]
		for i := 0; i < len(v); i++ {
			v[i]--
		}
		wa = append(wa, sliceSplit(v, 0)...)
		r++
	}
	fmt.Println(r)

}

func sliceSplit(arr []int, s int) [][]int {
	var warr []int
	var rarr [][]int
	for i := 0; i < len(arr); i++ {
		if arr[i] == s {
			if len(warr) > 0 {
				rarr = append(rarr, warr)
				warr = []int{}
			}
		} else {
			warr = append(warr, arr[i])
		}
	}
	if len(warr) > 0 {
		rarr = append(rarr, warr)
	}
	return rarr
}

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


ll binary(ll x)
{
ll l =0;
    ll r = 1000000000;
    while( l<r)
    {
         ll mid = (l + r) / 2;
         if( mid*(mid+1) >= 2*x  )
         {
             r = mid-1;
             if( ( mid *( mid-1) )< 2*x )
             {
                 return mid;
             }

         } else
         {
             l = mid +1;
         }
    }
}

int main()
{
  ll x;
  cin>>x;
  cout<<binary( x);
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<pair<int, int>, int> PP;
const ll INFL = 1LL << 60;
const ll MOD = 1000000007;
const int INF = 1000000000;
const int MAX = 300000;
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
//------------------------------------------------------------------------------------------------------------------------------

int main(void) {
    int N;
    cin >> N;
    int mi = INF;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int p;
        cin >> p;
        if (p < mi) {
            ans++;
            mi = p;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 06/27/20 20:37:14
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  vector<ll> A(n); for (auto& a:A) cin>>a;
  auto solve = [&]() -> ll {
    ll X = n == 2 ? 0 : accumulate(A.begin()+2, A.end(), 0ll,
                                   [](ll a, ll b) {return a^b;});
    auto f = A[0];
    auto S = f+A[1];
    if (S < X or ((S-X)%2)==1) {
      return -1;
    }
    ll D = (S-X)/2;
    if (D & X or D > f) {
      return -1;
    }
    ll a = D;
    for (int i = 50; i >= 0; i--) {
      auto bit = 1ull<<i;
      if ((X&bit)==0)
        continue;
      if (ll(a|bit) <= f)
        a |= bit;
    }
    auto ans = f-a;

    return ans < f ? ans : -1;
  };
  cout << solve() << endl;

  return 0;
}


Measured memory_bytes: 3624
use std::io::BufRead;

const P: u64 = 1_000_000_007;

fn main() {
    let stdin = std::io::stdin();
    let val = stdin.lock().gets().split(' ')
        .map(|x| x.parse().unwrap()).collect::<Vec<u64>>();
    let (h, w, a, b) = (val[0], val[1], val[2], val[3]);
    let bc = BinomialCoefModP::new(h - 1 + w - 1, P);
    let mut ans = 0;
    for i in 0..std::cmp::min(h - a, w - b) {
        let (px, py) = (b + 1 + i, h - a - i);
        ans += bc.get(px - 1 + py - 1, py - 1) *
            bc.get(w - px + h - py, h - py) % P;
    }
    println!("{}", ans % P);
}

trait Gets { fn gets(&mut self) -> String; }
impl<T: std::io::BufRead> Gets for T {
    fn gets(&mut self) -> String { self.lines().next().unwrap().unwrap() } }

struct BinomialCoefModP {
    num: Vec<u64>,
    denom: Vec<u64>,
    p: u64,
}

impl BinomialCoefModP {
    fn new(max_n: u64, p: u64) -> BinomialCoefModP {
        let mut num = Vec::with_capacity(max_n as usize + 1);
        num.push(1);
        for i in 0..max_n {
            let tmp = num[i as usize] * (i + 1) % p;
            num.push(tmp);
        }
        let denom = num.iter().map(|&x| Self::inv(x, p)).collect();
        BinomialCoefModP { num: num, denom: denom, p: p }
    }

    fn get(&self, n: u64, k: u64) -> u64 {
        let (n, k) = (n as usize, k as usize);
        self.num[n] * self.denom[n - k] % self.p * self.denom[k] % self.p
    }

    fn inv(mut n: u64, p: u64) -> u64 {
        let mut x = p - 2;
        let mut inv = 1;
        while x != 0 {
            if x & 1 != 0 {
                inv = inv * n % p;
            }
            x >>= 1;
            n = n * n % p;
        }
        inv
    }
}


Measured memory_bytes: 8444
#include <iostream>
#include <vector>
#include <algorithm>
#include<string>

using namespace std;


int main(){
    long n, _n;
    cin >> _n;
    n = _n;
    string s = to_string(n);
    
    int k = s.length();
    int sum = 0;
    long _k = 10;

    for(int i = 1; i <= k; i++){
        sum += (n % _k) / (_k/10);
        _k = _k *10;
    }

    if(_n % sum == 0){
        cout << "Yes" <<  endl;
    }else{
        cout << "No"<< endl;
     }
     
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

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

    li k;
    cin>>k;

    vi dp;

    f(i,1,9)
    {
        dp.PB(i);
    }

    li start=0;

    while(dp.size()<=(1e5+5))
    {
        li sz=dp.size();

        f(i,start,sz-1)
        {
            li tp=dp[i];

            if(tp%10==0)
            {
                dp.PB(tp*10);
                dp.PB(tp*10+1);
            }
            else if(tp%10==9)
            {
                dp.PB(tp*10+8);
                dp.PB(tp*10+9);
            }
            else
            {
                dp.PB(tp*10+(tp%10-1));
                dp.PB(tp*10+(tp%10));
                dp.PB(tp*10+(tp%10+1));
            }
        }

        start=sz;
    }

    // f(i,0,k-1)
    // {
        cout<<dp[k-1];
    // }

    return 0;
}

Measured memory_bytes: 2420
N,M = map(int, input().split())
L = [[int(u) for u in input().split()] for i in range(M)]
S,T = map(int, input().split())

edge = [[] for i in range(N+1)]
for i in range(M):
    edge[L[i][0]].append(L[i][1])
    
q = [S]
INF = 10**9
visited = [[INF+1, INF+1, INF+1] for i in range(N+1)]
visited[S][0] = 0
cnt = 1
while len(q) > 0:
    length = len(q)
    for j in range(length):
        temp = q.pop(0)
        for i in range(len(edge[temp])):
            if visited[edge[temp][i]][cnt%3] > INF:
                q.append(edge[temp][i])
                visited[edge[temp][i]][cnt%3] = cnt
    cnt += 1
    
if visited[T][0] < INF:
    print(visited[T][0]//3)
else:
    print(-1)

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

#define LL long long
#define VI vector<int>
#define VB vector<bool>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";

template<class T> T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> void print(T x) { std::cout << x << std::endl; }
// 4近傍（右, 下, 左, 上）
const std::vector<int> dy = { 0, -1, 0, 1 };
const std::vector<int> dx = { 1, 0, -1, 0 };

using namespace std;

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

    while (true) {
        int n, k;
        cin >>  n >> k;
        if (n == 0 and k == 0) { break; }

        map<int, int> A;
        FOR(i, 0, k) {
            int v;
            cin >> v;
            A[v] = 1;
        }

        vector<vector<int>> dp(n + 2, vector<int>(2, 0));
        FOR(i, 0, n + 1) {
            if (A[i + 1]) {
                dp[i + 1][0] = dp[i][0] + 1;
                dp[i + 1][1] = max(dp[i + 1][0], dp[i][1] + 1);
            }
            else {
                dp[i + 1][0] = 0;
                dp[i + 1][1] = dp[i][0] + 1;
            }
        }

        int ans = 0;
        FOR(i, 0, dp.size()) {
            ans = max(ans, dp[i][A[0]]);
        }
        print(ans);
    }

}




Measured memory_bytes: 13200
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
#include <complex>
#include <iomanip>
using namespace std;
int n, q;

struct union_find
{
    vector<int> par, rk;
    union_find(int N) : par(N), rk(N)
    {
        for (int i = 0; i < N; ++i)
        {
            par[i] = i;
            rk[i] = 0;
        }
    }

    int root(int x)
    {
        return par[x] == x ? x : par[x] = root(par[x]);
    }

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

    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return;

        if (rk[x] < rk[y])
        {
            par[x] = y;
        }
        else
        {
            par[y] = x;
            if (rk[x] == rk[y])
                rk[x]++;
        }
    }
};
int main(void)
{
    cin >> n >> q;
    union_find uf(n);
    for (int i = 0; i < q; ++i)
    {
        int com, x, y;
        cin >> com >> x >> y;
        if (com)
            if (uf.same(x, y))
            {
                cout << 1 << endl;
            }
            else
                cout << 0 << endl;
        else
            uf.unite(x, y);
    }
}



Measured memory_bytes: 3200
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
//#define p pair<int,int>
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
using namespace std;
int POW(int x,int y){return int(pow(double(x),double(y)));}


		


int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	rep(i,n){
		cin>>a[i];
		if(a[i]%2==1){
			cout<<"first"<<endl;
			return 0;
		}
	}
	cout<<"second"<<endl;
	/*
	sort(a.begin(),a.end());
	vector<int> b;
	rep(i,n){
		if(a[i]%2==1 &&  (b.empty() ||  b[b.size()-1] != a[i]))
			b.push_back(a[i]);
	}
	if(b.size()%2 == 0){
		cout<< "second" <<endl;
	}else{
		cout<<"first"<<endl;
	}
	*/
}


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

using ll=long long;


int main()
{
    string s;
    long long ans = 0, n = 0, m = 0;
    cin >> s;
    int l = s.size();
    vector<int> a(l+1);
    for(int i = 0; i < l;i++) {
    	if(s[i] == '<' )a[i+1] = max(a[i + 1], a[i] + 1);
    }
    
    for(int i = l-1; i >=0 ;i--) {
    	if(s[i] == '>' )a[i] = max(a[i], a[i + 1] + 1);
    }
    
    for (int i = 0; i <= l; i++) {
        ans += a[i];
    }
    cout <<  ans << endl;
    return 0;
}

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

int main()
{
	string s;
	std::cin >> s;
	for(char var : s)
	{
		if (var == ',') std::cout << " ";
		else std::cout << var;
	}
	std::cout << std::endl;
    return 0;
}

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

using namespace std;

int pow(int x, int n) {
	int tmp = 1;
	for (int i = 0; i < n; i++)
		tmp *= x;
	return tmp;
}

int main() {
	int A, B, C, K;

	cin >> A >> B >> C >> K;

	int coef = pow(2, K);
	int ans = coef * A + B + C;

	ans = max(ans, A + coef * B + C);
	ans = max(ans, A + B + coef * C);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys,math
input = sys.stdin.readline

a,b,h,m = map(int,input().split())


p = 2*math.pi*(h*60+m)/720
x,y = a*math.cos(p),a*math.sin(p)

q = 2*math.pi*m/60
z,w = b*math.cos(q),b*math.sin(q)


print(((x-z)**2 + (y-w)**2)**0.5)

Measured memory_bytes: 9608
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll mod_pow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1)res=res*x%MOD;
		x=x*x%MOD;
		n>>=1;
	}
	return res;
}

ll inverse_element(ll t){
	return mod_pow(t,MOD-2);
}

ll tcs(ll t,ll s){
    ll ret=1;
    for(ll i=t-s+1;i<=t;i++){
        ret*=i;
        ret%=MOD;
    }
    for(ll i=1;i<=s;i++){
        ret*=inverse_element(i);
        ret%=MOD;
    }
    return ret;
}
int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans=(mod_pow(2,n)+MOD-1)%MOD;
    ans=(ans+2*MOD-(tcs(n,a)+tcs(n,b)))%MOD;
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    const double PI = acos(-1.0);
    double a,b,x;
    cin >> a >> b >> x;
    x /=a;
    cout << fixed << setprecision(10);
    if(x>a*b/2)cout << atan2((a*b-x)*2,a*a)*180/PI <<endl;
    else cout << atan2(b*b,x*2)*180/PI<<endl;
}

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

void Main()
{
    int64_t N, M;
    cin >> N >> M;

    vector<int64_t> A(M);
    int64_t sum = 0;
    for(int64_t i = 0; i < M; ++i)
    {
        cin >> A[i];
        sum += A[i];
    }

    if(sum > N)
    {
        cout << "-1" << endl;
    }
    else
    {
        cout << N - sum << endl;
    }
    
}

int main()
{
    Main();
}


Measured memory_bytes: 3712
import java.io.InputStream;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class Main {
	public static void main(String args[]) {
		MyInput in = new MyInput();

    int N = in.nextInt();
    int[] num = new int[N];
    for(int i= 0; i< N; i++) {
        num[i] = in.nextInt();
    }
    Arrays.sort(num);
    boolean flag = false;
    int tmp = 0;
    int count = 0;
    for(int i = 0; i < N; i++) {
        if(tmp == num[i]) {
            flag ^= true;
        }else {
            if(flag) count++;
            flag = true;
            tmp = num[i];
        }
    }
    if(flag)count++;

    System.out.println(count);
	}
}

class MyInput {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr= 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if(ptr < buflen) {
			return true;
		}else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch(IOException e) {
				e.printStackTrace();
			}
			if(buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	public int readByte() { 
		if (hasNextByte()) return buffer[ptr++];
		else return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <=126;
	}

	private void skipUnprintable() {
		while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if(!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while(isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if(!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if(b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while(true) {
			if('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			}else if(b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			}else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if(nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}

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



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

using namespace std;

#define int long long
#define ar array
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

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

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

template<class A>
void read(vt<A> &v);

template<class A, size_t S>
void read(ar<A, S> &a);

template<class T>
void read(T &x) {
    cin >> x;
}

void read(double &d) {
    string t;
    read(t);
    d = stod(t);
}

void read(long double &d) {
    string t;
    read(t);
    d = stold(t);
}

template<class H, class... T>
void read(H &h, T &... t) {
    read(h);
    read(t...);
}

template<class A>
void read(vt<A> &x) {
    EACH(a, x)read(a);
}

template<class A, size_t S>
void read(array<A, S> &x) {
    EACH(a, x)read(a);
}

string to_string(char c) {
    return string(1, c);
}

string to_string(bool b) {
    return b ? "true" : "false";
}

string to_string(const char *s) {
    return string(s);
}

string to_string(string s) {
    return s;
}

string to_string(vt<bool> v) {
    string res;
    FOR(sz(v))res += char('0' + v[i]);
    return res;
}

template<size_t S>
string to_string(bitset<S> b) {
    string res;
    FOR(S)res += char('0' + b[i]);
    return res;
}

template<class T>
string to_string(T v) {
    bool f = 1;
    string res;
    EACH(x, v) {
        if (!f)
            res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}

template<class A>
void write(A x) {
    cout << to_string(x);
}

template<class H, class... T>
void write(const H &h, const T &... t) {
    write(h);
    write(t...);
}

void print() {
    write("\n");
}

template<class H, class... T>
void print(const H &h, const T &... t) {
    write(h);
    if (sizeof...(t))
        write(' ');
    print(t...);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n) {
    v = vt<T>(n, x);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n, size_t m...) {
    v = vt<T>(n);
    EACH(a, v)vti(a, x, m);
}

void solve() {
    int x;
    read(x);
    
    int ans = 0;
    ans = (x / 11) * 2;
    
    if (x % 11 > 6) {
        ans += 2;
    }
    else if (x % 11 > 0) {
        ans += 1;
    }
    print(ans);
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int tt = 1;
    //read(tt);
    FOR(tt) {
//        write("Case #", i + 1, ": ");
        solve();
    }
    
}



Measured memory_bytes: 3708
#include <iostream>

using namespace std;

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

    unsigned long strSize = S.size();

    string result;
    for(unsigned long i = 0; i < strSize ; i = i +2)
    {
        result.push_back(S.at(i));
    }

    cout << result << endl;
    return 0;
}


Measured memory_bytes: 576
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

string S;
ll ans;
Pll dp[20];

Pll dfs(int cur) {
  if (dp[cur].first != -INF) {
    return dp[cur];
  }

  string s = S.substr(cur);
  ll sum = 0;
  sum += stoll(s);
  ll res = 1;
  for (int i = 1; i < s.size(); ++i) {
    string f = s.substr(0, i);
    auto r = dfs(cur + i);
    sum += r.first;
    ll patterns = r.second;
    sum += stoll(f) * patterns;
    res += patterns;
  }
  return dp[cur] = Pll(sum, res);
}

int main() {
  rep(i, 0, 20) { dp[i] = Pll(-INF, -INF); }
  cin >> S;
  Pll res = dfs(0);
  cout << res.first << endl;
}


Measured memory_bytes: 3624
# ITP1_4_C
# 計算機

while  1:
	a, op, b = input().split()
	a, b = int(a), int(b)
	if op == "?":
		break
	elif op == "+":
		ans = a + b
	elif op == "-":
		ans = a - b
	elif op == "*":
		ans = a * b
	elif op == "/":
		ans = a // b
	print(ans)
	


Measured memory_bytes: 5592
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n,m;cin>>n>>m;
    if(n==m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

	int F = S / 100;
	int B = S - F * 100;
	
	if(F < 1 || 12 < F)
	{
		// F は MM ではない
		if(1 <= B && B <= 12)
		{
			// B は MM かもしれない
			cout << "YYMM" << endl;
		}
		else
		{
			// B は MM ではない
			cout << "NA" << endl;
		}
	}
	else
	{
		// F は MM かもしれない
		if(1 <= B && B <= 12)
		{
			// B は MM かもしれない
			cout << "AMBIGUOUS" << endl;
		}
		else
		{
			// B は MM ではない
			cout << "MMYY" << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int n,A[50];

int solve(int i, int m){

  if(m==0)return 1;

  if(i>=n)return 0;

  int res =solve(i+1,m)||solve(i+1,m-A[i]);

  return res;
}

int main(){
 
  int q,M,i;

  scanf("%d",&n);

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

  scanf("%d",&q);

  for(i=0;i<q;i++){

    scanf("%d",&M);

    if(solve(0,M))printf("yes\n");
    else printf("no\n");
    

  }

  return 0;

} 

Measured memory_bytes: 2608
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

int N;
int xs, ys, xt, yt;
vector<int> x, y, r;
double d[1002][1002];

class QInfo {
public:
	int id;
	double dist;

	QInfo() {}
	QInfo(int id, double dist) {
		this->id = id;
		this->dist = dist;
	}

	bool operator< (const QInfo &a) const {
		return dist > a.dist;
	}
};

signed main() {
	cin >> xs >> ys >> xt >> yt;
	cin >> N;

	x.push_back(xs);
	y.push_back(ys);
	r.push_back(0);
	x.push_back(xt);
	y.push_back(yt);
	r.push_back(0);
	for (int i = 2; i <= N + 1; i++) {
		x.push_back(nextInt());
		y.push_back(nextInt());
		r.push_back(nextInt());
	}

	rep(i, N + 2) {
		d[i][i] = 0;
		for (int j = i + 1; j < N + 2; j++) {
			int dx = x[i] - x[j];
			int dy = y[i] - y[j];
			d[i][j] = max(0.0, sqrt(dx*dx + dy*dy) - r[i] - r[j]);
			d[j][i] = d[i][j];
		}
	}

	double minDist[1002];
	rep(i, 1002) {
		minDist[i] = -1;
	}

	priority_queue<QInfo> q;
	q.push(QInfo(0, 0));
	while (!q.empty()) {
		QInfo info = q.top(); q.pop();

		if (minDist[info.id] > -0.1 && info.dist > minDist[info.id]) continue;

		if (info.id == 1) {
			printf("%.10f\n", info.dist);
			break;
		}

		rep(i, N + 2) {
			if (i == info.id) continue;
			if (minDist[i] < -0.1 || minDist[i] > info.dist + d[info.id][i]) {
				minDist[i] = info.dist + d[info.id][i];
				q.push(QInfo(i, minDist[i]));
			}
		}
	}

    return 0;
}


Measured memory_bytes: 12284
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
 
int A, B, C, X, Y;
int main() {
  cin >> A >> B >> C >> X >> Y;
  int total = 0x7fffffff;
  for(int i=0;i<=100000;i++) {
    total=min(total, 
        i * 2 * C + max(0, X-i) *A+max(0,Y-i)*B);
  }
  cout << total << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;

#define M 1000000 
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(ll i = a; i<=b; ++i)
#define NFOR(i,a,b) for(ll i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const ll N = 2097152 + 10;
inline ll add(ll x,ll y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline ll mul(ll x,ll y){
  x = (1LL * x * y) % mod;
  return x;
}

ll dp[N];

int main()
{	

	ll n; cin >> n;
	ll mat[n+1][n+1];
	FOR(i,0,n-1)FOR(j,0,n-1)cin >> mat[i][j];

	fill(dp,0);
	dp[0] = 1;

	FOR(i,1,(1<<n)-1){
		ll p = 0;
		FOR(j,0,n-1){
			if(i&(1<<j))p++;
		}
		FOR(j,0,n-1){
			if(i&(1<<j)){
				if(mat[p-1][j])dp[i] = add(dp[i],dp[i^(1<<j)]);
			}
		}
	}
	// FOR(i,0,(1<<n)-1)cout << dp[i] << " ";
	cout << dp[(1<<n)-1];



	return 0;
}

Measured memory_bytes: 16640
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main(){
  int N, sum=0, flag=0;
  cin >> N;
  vector<pair<int, int> > pairs(N);
  for(int i=0; i<N; i++) cin >> pairs[i].second >> pairs[i].first;
  sort(pairs.begin(), pairs.end());
  for(int i=0; i<N; i++){
    sum += pairs[i].second;
    if(sum > pairs[i].first){
      flag = 1;
      break;
    }
  }
  if(flag == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    string s;
    cin >> s;
    int fi = stoi(s.substr(0,2));
    int se = stoi(s.substr(2));
    if(1 <= fi && fi <= 12) {
        if(1 <= se && se <= 12) cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" << endl;
    } else {
        if(1 <= se && se <= 12) cout << "YYMM" << endl;
        else cout << "NA" << endl;
    }
}

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

using namespace std;

const int N = 1e6 + 2;
int d[N];

int main() {
    std :: ios :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    for(int i = 1 ; i < N ; ++i) {
        for(int j = i ; j < N ; j += i) {
            d[j]++;
        }
    }
    //cout << d[1] << " " << d[3] << " " << d[11] << " " << d[16] << endl;
    int n;
    cin >> n;
    long long ans = 0;

    for(int i = 1 ; i < n ; ++i) {
        int p = n - i; /// n - c
        ans += d[p];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7552
#include<cstdio>
int main(){long long n;while(scanf("%lld",&n)&&n){long long a=0,b=1,s=0,neg=n<0;if(neg)n=-n;while(n>0){int t=n%10;if((neg?!(a&1):a&1)&&t>0){n+=10;s+=b*(10-t);}else{s+=b*t;}n/=10;b*=10;a++;}printf("%lld\n",s);}return 0;}

Measured memory_bytes: 0
import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
  [n] <- readInts
  input <- readNInts n
  print $ solve input

solve :: [[Int]] -> Int
solve input = sum $ foldl' func [1, 1] input
  where
    func a x = map (* mp) x
      where
        mp = maximum $ map (uncurry minmp) (zip a x)
        mv = fst m
        mi = snd m
        m = tmax x
    minmp :: Int -> Int -> Int
    minmp x q = case minmpSub x q of
      Left a -> a
      _ -> error "error"
    minmpSub :: Int -> Int -> Either Int Int
    minmpSub x q = foldM (\_ i ->
      if i `mod` q == 0
        then Left $ i `div` q
        else Right i
      ) 0 [x ..]
    tmax :: [Int] -> (Int, Int)
    tmax xs = head . reverse . sort $ zip xs [0 ..]

-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine

readNIntegers :: Int -> IO [[Integer]]
readNIntegers = flip replicateM readIntegers

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine

toTup2 :: [[a]] -> [(a, a)]
toTup2 = map (\ys -> case ys of y : z : zs -> (y, z))

encIdx2 :: Int -> (Int, Int) -> Int
encIdx2 mx (y, x) = y * mx + x

decIdx2 :: Int -> Int -> (Int, Int)
decIdx2 mx idx = (idx `div` mx, idx `mod` mx)

encIdx3 :: (Int, Int) -> (Int, Int, Int) -> Int
encIdx3 (my, mx) (z, y, x) = z * my * mx + y * mx + x

decIdx3 :: (Int, Int) -> Int -> (Int, Int, Int)
decIdx3 (my, mx) idx = (z, y, x)
  where
    basez = my * mx
    z = idx `div` basez
    y = (idx `mod` basez) `div` mx
    x = idx `mod` mx


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


int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<pair<int, ll>>> edge(N+1, vector<pair<int, ll>>());
    for (int i = 0; i < M; i++) {
        ll l, r, c;
        cin >> l >> r >> c;
        edge[l].push_back({r, c});
    }
    for (int i = 2; i <= N; i++) {
        edge[i].push_back({i-1, 0});
    }
    
    ll inf = LLONG_MAX;
    
    
    vector<ll> dist(N+1, inf);
    dist[1] = 0;
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> q;
    q.push({0, 1});
    while(!q.empty()) {
        int now = q.top().second;
        q.pop();
        for (auto p : edge[now]) {
            int nxt = p.first;
            ll c = p.second;
            if (dist[now] + c >= dist[nxt]) continue;
            dist[nxt] = dist[now] + c;
            q.push({dist[nxt], nxt});
        }
    }
    
    if (dist[N] == inf) cout << -1 << endl;
    else cout << dist[N] << endl;
    
    return 0;
}


Measured memory_bytes: 9340
#include <stdio.h>
#include <stdlib.h>

struct node {
  int id;
  struct node *parent;
  struct node *child[2];
};

struct node *tree;
int *pre, *in, *post, n;

void reconstruction(int root, int l, int r);
void postorder(struct node *p);

int main(int argc, char *argv[])
{
  int i, j;

  scanf("%d", &n);

  tree = (struct node *)malloc(sizeof(struct node) * (n + 1));
  for (i = 0; i <= n; i++) {
    tree[i].id = i;
    tree[i].parent = NULL;
    for (j = 0; j < 2; j++) tree[i].child[j] = NULL;
  }
  pre = (int *)malloc(sizeof(int) * n);
  in = (int *)malloc(sizeof(int) * n);
  post = (int *)malloc(sizeof(int) * n);

  for (i = 0; i < n; i++) scanf("%d", &pre[i]);
  for (i = 0; i < n; i++) scanf("%d", &in[i]);

  for (i = 0; i < n; i++) {
    if (in[i] == pre[0]) break;
  }
  reconstruction(i, 0, n - 1);

  for (i = 1; i <= n; i++) {
    if (tree[i].parent == NULL) break;
  }
  postorder(&tree[i]);
  printf("\n");

  return 0;
}

void reconstruction(int in_root, int l, int r)
{
  int i, j, pre_root, pre_left, pre_right, in_left, in_right;

  if (l == r) return;

  if (in_root != l) {
    for (i = 0; i < n; i++) {
      if (pre[i] == in[in_root]) break;
    }
    pre_left = i + 1;
    for (i = 0; i < n; i++) {
      if (in[i] == pre[pre_left]) break;
    }
    in_left = i;
    tree[in[in_root]].child[0] = &tree[in[in_left]];
    tree[in[in_left]].parent = &tree[in[in_root]];
    reconstruction(in_left, l, in_root-1);
  }

  if (in_root != r) {
    for (i = 0; i < n; i++) {
      if (pre[i] == in[in_root]) break;
    }
    pre_right = i + (in_root - l) + 1;
    for (i = 0; i < n; i++) {
      if (in[i] == pre[pre_right]) break;
    }
    in_right = i;
    tree[in[in_root]].child[1] = &tree[in[in_right]];
    tree[in[in_right]].parent = &tree[in[in_root]];
    reconstruction(in_right, in_root+1, r);
  }  
}

void postorder(struct node *p)
{
  if (p->child[0] != NULL) postorder(p->child[0]);
  if (p->child[1] != NULL) postorder(p->child[1]);
  if (p->parent != NULL) printf("%d ", p->id);
  else printf("%d", p->id);
}

Measured memory_bytes: 600
#include<stdio.h>
 
int binary_search(int* A, int size, int n) {
  int l = 0;
  int r = size;
  while(l < r) {
    int c = (l + r) / 2;
    if(A[c] == n) return 1;
    if(A[c] < n) l = c+1;
    else r = c;
  }
  return 0;
}
 
int main(){
  int S[100000];
  int T[50000];
  int n, q, i, cnt = 0;

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

  for(i = 0; i < q; i++) scanf("%d",&T[i]);
  for(i = 0; i < q; i++) cnt += binary_search(S, n, T[i]);
  printf("%d\n", cnt);
  return 0;
}


Measured memory_bytes: 2288
/*
	好题，构造，从混乱到有序，再到循环 
*/

# include <cstdio>

using namespace std;

int main()
{
	long long n;
	
	scanf("%lld",&n);
	printf("50\n");
	
	for(long long i = 0;i <= 49;i++)
	{
		printf("%lld ",49-i+((49-i+n)/50));
	}
	
	return 0;
} 

Measured memory_bytes: 128
/**********************************************************************************







*************************************************************************************/

#include<bits/stdc++.h>

using namespace std;

/*======================================= Macro Start====================================================*/

#define input freopen("in.txt","r",stdin)
#define output freopen("out.txt","w",stdout)

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)   __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)   __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)   __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))

/*======================================= Macro End====================================================*/

/*====================================== CONSTANT Start===================================================*/

#define INF (1<<30) //infinity value
#define EPS 1e-9
#define MOD 10007
#define SIZ 1005
#define LL long long

/*====================================== CONSTANT End===================================================*/


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

    int tc,cn;
    tc=1;


    //cin>>tc;

    for(cn=1;cn<=tc;cn++)
    {

        //cout<<"Case "<<cn<<": "<<ans<<endl;
        LL a, b;
        cin>>a>>b;
        if((a+b)&1) cout<<"IMPOSSIBLE\n";
        else{
            LL ans= (1.0*(a+b))/2;
            cout<<ans<<endl;
        }

    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  long int x, a, result = 0;
  
  scanf("%ld", &x);
  
  a = x % 500;
  result += ( x / 500 ) * 1000 + ( a / 5 ) * 5;
  
  printf("%Ld", result);
      return 0;
}

Measured memory_bytes: 128
def main():
  x, y = map(int, input().split())
  tokuhyou = [int(t) for t in input().split()]
  th = sum(tokuhyou) / (4 * y)
  count = 0
  for i in tokuhyou:
    if i >= th:
      count += 1
  if count >= y:
    print('Yes')
  else:
    print('No')
main()

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
 	ll n;
	ll a,b,c,d;
 	cin>>n>>a>>b>>c>>d;
 	//if(a>b)swap(a,b);
	if(c>d)swap(c,d);
	for(int i=0;i<n;i++){
		if(-(n-1-i)*d+i*c<=(a-b)&&(a-b)<=-(n-1-i)*c+i*d){
			printf("YES\n");
			return 0;
		}
	}
	printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// atoi : atoi(変数名.c_str())
// to_string(数値)
// %0桁数d とすると表示桁数が「桁数」に満たない場合に0埋めされる
// find(): int i = 変数名.find(“文字列”) 何番目にあるかを得る
// cout << (条件 ? "Yes" : "No") << endl;
// printf("%02d:%02d:%02d",hour,minute,second);
// 降順 sort(a.begin(),a.end(),greater<int>());
// bitset<ビット数> 変数名;  // すべてのビットが0の状態で初期化される
// bitset<ビット数> 変数名("ビット列");  // 指定したビット列で初期化される
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  long x,y;
  cin >> x >> y;
  int count = 1;
  long a = x;
  while(2*a <= y){
    a *= 2;
    count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans;
int main(int argc, char* argv[]){
  long int a,b,c;
  scanf("%ld",&a);
  if (a/100==a-(a/10)*10) {
    printf("Yes\n");
  }else{
    printf("No\n" );
  }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,t,ans=0;cin>>n;
  string s,x;
  vector<ll> tv(n,0);vector<string> sv(n);
  rep(i,n) {cin>>s>>t;sv[i]=s;tv[i]=t;}
  cin>>x;
  ll pos=find(sv.begin(),sv.end(),x)-sv.begin();
  for(ll i=pos+1;i<n;++i) ans+=tv[i];
  print(ans);
  return 0;
}

Measured memory_bytes: 256
use std::cmp::{max, min};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
const MOVES: [(i32, i32); 4] = [(1, 0), (0, 1), (-1, 0), (0, -1)];
use std::collections::BinaryHeap;
fn main() {
    input!{
        r:i64,
        g:i64,
        b:i64,
        n:i64,
    }
    let mut ans  =0 ;
    for j in 0..n+1 {
        for k in 0..n+1 {
            if ((n -(j*r + k*g))/b)*b+j*r + k*g == n &&(n -(j*r + k*g)) >= 0 {
                // println!("{} {} {}",j,k,(n -(j*r + k*g)));
                ans += 1;
            }
        }
    }
    println!("{}",ans);
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9;
const LL LINF = INF * INF;

const int MAX = 1 << 17;
int n;
int a[MAX][3];
int dp[MAX][3];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);
	
	cin >> n;
	FOR(i, 0, n)
		FOR(j, 0, 3)
			cin >> a[i][j];
	
	FOR(i, 0, 3)
		dp[0][i] = a[0][i];
	
	FOR(i, 1, n)
		FOR(j, 0, 3)
			dp[i][j] = max(dp[i][j], a[i][j] + max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]));
	
	int ans = 0;
	FOR(i, 0, 3)
		ans = max(ans, dp[n - 1][i]);
	cout << ans << endl;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Measured memory_bytes: 2688
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<climits>
#include<algorithm>
#include<vector>
#include<valarray>
#include<string>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iostream>
#include<iomanip>
using namespace std;
   
   
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define DREP(i,n) for(int i=n;i>0;i--)
#define Rep(i,m,n) for(int i=m;i<n;i++)
#define ReP(i,m,n) for(int i=m;i<=n;i++)
#define scani(a) scanf("%d",&a)
#define scand(a) scanf("%lf",&a)
#define scans(s) scanf("%s",s)
#define readi(a) int a;scanf("%d",&a)
#define printi(a) printf("%d",a)
#define prints(s) printf("%s",s)
#define even(n) (((n)+1)%2)
#define odd(n) ((n)%2)
#define sg(x) ((x)?1:0)
#define LF printf("\n")
#define SPACE printf(" ")
#define pb push_back
#define mp make_pair
#define bs binary_search
#define all(a) (a).begin(),(a).end()
#define forall(itr,a) for(auto itr=(a).begin();itr!=(a).end();++itr)
   
typedef long long LL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<double,double> pdd;
typedef pair<int,int> pii;

const double pi = acos(-1.0);
double rad(double t){return t*pi/180.0;}
double deg(double d){return d*180.0/pi;}
template<typename T>T GCD(T x,T y){return y?GCD(y,x%y):x;}
template<typename T>T LCM(T x,T y){return x/GCD(x,y)*y;}
template<class T>ostream& operator<<(ostream& os,const set<T>& s){os<<"{";for(auto itr=s.begin();s.end() != itr;++itr){if(itr!=s.begin())os<<',';os<<*itr;}os<<"}";return os;}
template<class S,class T>ostream& operator<<(ostream& os,const pair<S,T>& p){os<<'('<<p.first<<','<<p.second<<')';return os;}
const int MOD = (int)pow(10,9) +7;
 
 
//begin global variable
//


//
//end   global variable

int main(){
  ios::sync_with_stdio(false);
  //begin main()
  //

  LL w,h,x=0,y=0,ans=0;
  cin >> w >> h ;
  vector<LL> p(w,0),q(h,0);
  rep(i,w) cin >> p[i] ;
  rep(i,h) cin >> q[i] ;
  sort(all(p));
  sort(all(q));
  LL banpei = 100000001LL;
  p.pb(banpei);
  q.pb(banpei);

  rep(i,(w+h)){
    if(p[x] < q[y]){
      ans += (h-y+1) * p[x];
      x ++ ;
    }else{
      ans += (w-x+1) * q[y];
      y ++ ;
    }
  }
  cout << ans << endl;
  //
  //end   main()
  return 0;
}


Measured memory_bytes: 2672
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,m;
    cin>>n>>m;

    n=n%m;
    if(n>abs(n-m))
    {
        cout<<abs(n-m)<<endl;
    }
    else
    {
        cout<<n<<endl;
    }
    return 0;
}


Measured memory_bytes: 256