akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
 
class Program{
    static void Main(){
        string[] inputs = Console.ReadLine().Split(' ');
        int n = int.Parse(inputs[0]);
        int a = int.Parse(inputs[1]);
        int b = int.Parse(inputs[2]);
        char[] s = Console.ReadLine().ToCharArray();
        int pass = 0;
        int passb = 0;
        for(int i = 0; i < s.Length; i++){
            if(pass < (a + b) && s[i] == 'a'){
                Console.WriteLine("Yes");
                pass++;
            }
            else if(pass < (a + b) && s[i] == 'b'){
                if(passb < b){
                    Console.WriteLine("Yes");
                    pass++;
                    passb++;
                }
                else{
                    Console.WriteLine("No");
                }
            }
            else{
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 7512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

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

int main(void){
	int i;
	ll n,a,m=INFLL,ans;
	cin >> n;
	for(i=0; i<5; ++i){
		cin >> a;
		m = min(a,m);
	}
	ans = 5+((n-1)/m);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
    int N;
    cin>>N;
    vector<long> A(N);
    vector<long> B(N);
    vector<long> C(N);
    for(auto &x:A){
        cin>>x;
    }
    for(auto &x:B){
        cin>>x;
    }
    for(auto &x:C){
        cin>>x;
    }

    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());

    long long ans=0;

    for(int i=0;i<N;++i){
        long long low=lower_bound(A.begin(),A.end(),B[i])-A.begin();
        long long hi=C.end()-upper_bound(C.begin(),C.end(),B[i]);
        if(low<0)low=0;
        if(hi<0)hi=0;
        ans+=hi*low;
    }


    cout<<ans<<endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return b;
    }
    return gcd(b, a % b);
}

int main()
{
    ll A, B;
    cin >> A >> B;

    if (A + B >= 10)
    {
        cout << "error" << endl;
        return 0;
    }
    cout << A + B << endl;
}

Measured memory_bytes: 256
a,b,m = map(int, input().split())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))

aaa = []
bbb = []
ccc = []
for i in range(m):
  e = list(map(int, input().split()))
  aaa.append(e[0])
  bbb.append(e[1])
  ccc.append(e[2])
  
cost = []
for i,j,k in zip(aaa, bbb, ccc):
  u = aa[i-1] + bb[j-1] - k
  cost.append(u)
  
aa.sort()
bb.sort()
minn = aa[0] + bb[0]
cost.append(minn)

cost.sort()
print(cost[0])

Measured memory_bytes: 29356
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

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

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

bool dp[11111];

void solve(ll N, vector<ll> s) {
  dp[0] = true;
  REP(i,N) {
    for (int j = 10000; j >= 0; --j) {
      if (dp[j]) dp[j + s[i]] = true;
    }
  }
  int res = 0;
  REP(i,10001) {
    if (i % 10 == 0) continue;
    if (dp[i]) chmax(res, i);
  }
  cout << res << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	vector<ll> s(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &s[i]);
	}
	solve(N, s);
	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
A = [int(round(float(input()) * 10 ** 9)) for _ in range(N)]

# 2と5で割れる回数を考える
# 両方9回以上あれば整数(10^9分もどしても)OK
# これをDPする
def factor_2_5(n):
    two, five = 0, 0
    while n % 2 == 0:
        two += 1
        n //= 2
    while n % 5 == 0:
        five += 1
        n //= 5
    return two, five

res = defaultdict(int)
two_flag, five_flag = False, False
for ai in A:
    two, five = factor_2_5(ai)
    if two >= 9:
        two_flag = True
    if five >= 9:
        five_flag = True

    res[(two, five)] += 1

ans = 0
if two_flag and five_flag:
    for k, v in res.items():
        two, five = k
        for tk, tv in res.items():
            t_two, t_five = tk
            if two + t_two >= 18 and five + t_five >= 18:
                if two == t_two and five == t_five:
                    ans += v * (tv - 1)
                else:
                    ans += v * tv

print(ans // 2)

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

int main() {
    int n,m;
    cin >> n >> m;
    int l = 0, r = n+1;;
    rep(i,m){
        int tl, tr;
        cin >> tl >> tr;
        l = max(l,tl);
        r = min(r,tr);
    }
    if(l>r) cout << 0 << endl;
    else cout << r-l+1 << endl;
}

Measured memory_bytes: 3632
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long line = sc.nextInt();
		long row = sc.nextInt();
		if (line == 1 && row == 1) {
			System.out.println(1);
		} else if (line == 1) {
			System.out.println(row - 2);
		} else if (row == 1) {
			System.out.println(line - 2);
		} else {
			System.out.println((line - 2) * (row - 2));
		}
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> x(5),y(0);
  int A,B,C,D,E,Z,W;
  cin >> A >> B >> C >> D >> E;
  x[0] = A%10;
  x[1] = B%10;
  x[2] = C%10;
  x[3] = D%10;
  x[4] = E%10;
  for (int i=0; i<5; i++) {
    if (x[i] == 0) continue;
    y.push_back(x[i]);
  }
  W = y.size();
  Z = 0;
  if (W != 0) {
  sort (y.begin(), y.end());
  Z = 10*(W-1);
  for (int i=1; i<W; i++) {
  Z -= y[i];
  }
  }
  cout << A+B+C+D+E+Z << endl;
}

Measured memory_bytes: 256
use std::io;
use std::cmp;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    let v: Vec<u16> =
        line.split_whitespace().map(|n| n.parse().unwrap()).collect();
    let n = v[0];
    let a = v[1];
    let b = v[2];
    let ans = cmp::min(n*a, b);
    println!("{}", ans);
}


Measured memory_bytes: 4352
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
ll n, a[100009], dp[100009];
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    dp[2] = abs(a[2] - a[1]);
    for(int i=3;i<=n;i++) {
        dp[i] = min(dp[i - 1] + abs(a[i - 1] - a[i]), dp[i - 2] + abs(a[i - 2] - a[i]));
    }
    cout<<dp[n];
}
/*
 2
 ((
 )))(
 */


Measured memory_bytes: 1792
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int A,B,C;
	cin>>A>>B>>C;
	if(A==B && B==C && A==C)
	{
		cout<<"Yes"<<endl;
	}	
	else
	{
		cout<<"No"<<endl;
		
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int temprature = Integer.parseInt(scan.nextLine());
    if(temprature>=30) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 35604
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}


int main() {
	ll L, R;
	cin >> L >> R;
	ll ans = inf;
	for (ll i = L; i <= min(R, L + 2020); i++) {
		for (int j = i + 1; j <= min(R, L + 2020); j++) {

			ans = min((i * j) % 2019, ans);
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
H,W=gets.split.map(&:to_i)
res=0
data=H.times.map{gets.chomp}
dir=[[-1,0],[1,0],[0,-1],[0,1]]
H.times do |i|
    W.times do |j|
        dist=Array.new(H){Array.new(W,0)}
        visit=Array.new(H){Array.new(W,false)}
        que=Array.new
        que.push([i,j])
        until que.empty?
            y,x=que.shift
            next if visit[y][x]
            visit[y][x]=true
            next if data[y][x]=="#"
            dir.each do |dx,dy|
                if (0<=x+dx && x+dx<W) && (0<=y+dy && y+dy<H)
                    next if data[y+dy][x+dx]=="#"
                    if !visit[y+dy][x+dx]
                        dist[y+dy][x+dx]=dist[y][x]+1
                    else
                        dist[y+dy][x+dx]=dist[y+dy][x+dx] > dist[y][x]+1 ? dist[y][x]+1 : dist[y+dy][x+dx]
                    end
                    que.push([y+dy,x+dx])
                end
            end
        end
        H.times do |k|
            W.times do |l|
                res=res<dist[k][l] ? dist[k][l] : res 
            end
        end
    end
end
puts res

Measured memory_bytes: 2116
#include<cstdio>
using namespace std;
int main(void)
{
	unsigned int i,j,k,d,f;
	char s[10000];
	int a[10000][8];
	int q,z,x,c,v;
	unsigned int mask[3]={4,2,1};
	scanf("%d",&z);
	scanf("%s",s);
	if(s[0]=='J') q=mask[0];
	else if(s[0]=='O') q=mask[1];
	else q=mask[2];
	for(i=0;i<z;i++){
		for(j=0;j<8;j++)
			a[i][j]=0;
	}
	for(j=1;j<8;j++){
		d=j&4;
		f=j&q;
		if(d==4&&f==q)
			a[0][j]=1;
	}
	for(i=1;i<z;i++){
		if(s[i]=='J') q=4;
		else if(s[i]=='O') q=2;
		else q=1;
		for(j=1;j<8;j++){
			for(k=1;k<8;k++){
				d=j&q;
				f=j&k;
				if(d!=0&&f!=0)
					a[i][j]+=a[i-1][k];
			}
			a[i][j]%=10007;
		}
	}
	v=0;
	for(i=0;i<8;i++)
		v+=a[z-1][i];
	v%=10007;
	printf("%d\n",v);
	return 0;
}

Measured memory_bytes: 2728
N, x = map(int, input().split())
a = list(map(int, input().split()))
count = 0
a.sort()
for i in range(N):
    if x >= a[i]:
        count += 1
        x -= a[i]
    else:
        break
else:
    if x != 0:
        count -= 1
print(count)

Measured memory_bytes: 3060
// ※※※ 解答不能 ※※※
// tourist氏.
// https://atcoder.jp/contests/cf17-relay-open/submissions/8927641
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, n) for(int i = a; i < b; i += n)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)

int main(){
    const int MAX = 301;
    vector<int> cost(MAX);
    int n;
    scanf("%d", &n);
    rep(i, n){
        int x, y;
        scanf("%d %d", &x, &y);
        cost[x] = y;
    }
    int ans = 0;
    vector<bool> is_prime(MAX, true);
    repx(i, 2, MAX){
        if(is_prime[i]){
            repex(j, i + i, MAX, i) is_prime[j] = false;
        }
    }
    function<void(int, LL)> Dfs = [&](int v, LL num){
        if(v * v > MAX){
            int cur = 0;
            vector<int> delta(MAX);
            repx(i, 2, MAX){
                int z = i / __gcd(i, (int) (num % i));
                if(z == 1){
                    cur += cost[i];
                }else{
                    if(z >= v && is_prime[z]) delta[z] += cost[i];
                }
            }
            repx(i, 2, MAX) cur += max(delta[i], 0);
            ans = max(ans, cur);
            return;
        }
        if(!is_prime[v]){
            Dfs(v + 1, num);
            return;
        }
        int c = 1;
        while(c <= MAX){
            Dfs(v + 1, num * c);
            c *= v;
        }
    };
    Dfs(2, 1);
    printf("%d\n", ans);
    return 0;
}

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int a,b,n;

int32_t main()
{
    IOS
    cin>>a>>b>>n;
    int x=min(n,b-1);
    cout<<(a*x/b)-a*(x/b)<<endl;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


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

const int N=200005;


void solve()
{

    int n;
    cin>>n;
    int d=n%10;
    if(d==0||d==1||d==6||d==8)
    {
        cout<<"pon"<<endl;
        return;
    }
    else if(d==3)
    {
        cout<<"bon"<<endl;
        return;
    }
    cout<<"hon"<<endl;
    
    
}


int32_t main()
{
    IOS;
    
    int t;
    t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
                  
using namespace std;
          
typedef long long ll;
#define mp make_pair
#define pub push_back
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define db long double

int n;
map<int, int> was;

int main(){
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++){
    	int x;
    	cin >> x;
    	was[x]++;
    }
    int ans = 0;
    for (auto c : was){
    	if (c.x > c.y){
    		ans += c.y;
    	} else {
    		ans += c.y - c.x;
    	}
    }
    cout << ans;
}

Measured memory_bytes: 4736
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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        ma: usize,
        mb: usize,
        v: [(usize, usize, usize); n]
    }
    let max_c = 100000;
    let nab = n * 10 + 1;
    let mut dp = vec![vec![vec![max_c; nab]; nab]; n + 1];
    dp[0][0][0] = 0;
    for i in 0..n {
        dp[i + 1] = dp[i].clone();
        for j in v[i].0..nab {
            for k in v[i].1..nab {
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j - v[i].0][k - v[i].1] + v[i].2);
            }
        }
    }
    let mut ans = max_c;
    let mut a = ma;
    let mut b = mb;
    while a < nab && b < nab {
        ans = min(ans, dp[n][a][b]);
        a += ma;
        b += mb;
    }
    if ans == max_c {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}


Measured memory_bytes: 65788
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    double v[50];
    for(int i=0;i<N;i++)
        cin >> v[i];
    
    sort(v, v + N);
    double ans = v[0];
    for(int i=1;i<N;i++){
        ans = (ans + v[i])/2;
    }

    printf("%.10lf\n", ans);

}

Measured memory_bytes: 384
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll INFL = 1LL << 50;//10^18 = 2^60
int INF = 1 << 30;//10^9
ll MOD  = 1000000007;
vector<int> dy = {0,0,1,-1};
vector<int> dx = {1,-1,0,0};
//vector<int> dy = {1, 1, 1, 0, -1, -1, -1, 0};
//vector<int> dx = {1, 0, -1, -1, -1, 0, 1, 1};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll mypow(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}


ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){
  return x / gcd(x, y) * y % MOD;
}
vector<ll> sum(1000002);


ll N;
ll d[310][310];






int main(){
  cin >> N;
  rep(i, N)rep(j, N) cin >> d[i][j];
  rep(k, N)rep(i, N)rep(j, N){
    if(d[i][j] > d[i][k] + d[k][j]){
      cout << -1 << endl;
      return 0;
    }
  }

  rep(k, N)rep(i, N)rep(j, N){
    if(i == k || j == k) continue;
    if(d[i][j] == d[i][k] + d[k][j]){
      d[i][j] = INF;
    }
  }

  ll ans = 0;
  rep(i, N)rep(j, N){
    if(d[i][j] != INF) ans += d[i][j];
  }
  ans /= 2;
  printf("%lld\n", ans);
}


Measured memory_bytes: 8832
#if defined(_WIN32)
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

using ulong = unsigned long;
using ll = long long;
using ull = unsigned long long;

using namespace std;

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

	ll n;
	cin >> n;

	vector<ll> c, s, f;
	for (int i = 0; i < n - 1; i++)
	{
		ll c_, s_, f_;
		cin >> c_ >> s_ >> f_;
		c.push_back(c_);
		s.push_back(s_);
		f.push_back(f_);
	}

	for(int i = 0; i < n; i++)
	{
		ll now = 0;
		for(int j = i; j < n - 1; j++)
		{
			if (now <= s[j]) now = s[j] + c[j];
			else
			{
				while (now % f[j] != 0) now++;
				now += c[j];
			}
		}
		cout << now << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  string s;
  cin >> s;
  int n = s.length();
  int g_cnt = 0; //1番目以降のグーの個数
  for (int i = 1; i < n; ++i) {
    if (s[i] == 'g') g_cnt++;
  }
  int ans = 0;
  if (s[0] == 'p') ans = -1;

  int p_cnt = n-1 - g_cnt;
  int pa = n/2; //パーを出せる回数
  if (g_cnt <= pa) {
    ans += g_cnt;
    pa -= g_cnt;
    ans -= p_cnt-pa; //あいこにする
  }
  else {
    ans += pa;
    pa = 0;
    ans -= p_cnt;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  char a[120];
  pair<pair<string,int>,int> b[110];
  for(int i=0;i<N;i++){
 int t;
    cin>>a>>t;
    string A=a;
    b[i]=make_pair(make_pair(a,-t),i);
    
  
  }
  sort(b,b+N);
  for(int i=0;i<N;i++){
    cout<<b[i].second+1<<endl;
    
  }

}


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

string s; 
vector<int> oc[26];

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> s;

    int n = s.size();
    for (int i = 0; i < n; i++) {
        oc[s[i] - 'a'].push_back(i);
    }
    
    int ans = n;
    for (int i = 0; i < 26; i++) {
        if (oc[i].size() == 0) continue;
        else {
            int mxdist = 0;
            for (int j = 0; j < (int)oc[i].size(); j++) {
                if (j == 0) mxdist = max(mxdist, oc[i][j]);
                if (j > 0) mxdist = max(mxdist, oc[i][j] - oc[i][j - 1] - 1);
                if (j == oc[i].size() - 1) mxdist = max(mxdist, n - oc[i][j] - 1);
            }
            ans = min(mxdist, ans);
        }
    }
    cout << ans;
}



Measured memory_bytes: 256
// ITP1_6_D:   Matrix Vector Multiplication
// 2017.7.27
 
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int a[101][101], b[101], c[101];
    int i, j;
    int n, m;
 
    scanf("%d%d", &n, &m);
    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) scanf("%d", &a[i][j]);
    }
    for (j = 0; j < m; j++) scanf("%d", &b[j]);
 
    for (i = 0; i < n; i++) {
        c[i] = 0;
        for (j = 0; j < m; j++) c[i] += a[i][j] * b[j];
    }
 
    for (i = 0; i < n; i++) {
        printf("%d\n", c[i]);
    }
    return 0;
}


Measured memory_bytes: 2112
import sys, math,os
from io import BytesIO, IOBase
from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
sys.setrecursionlimit(100000)
from fractions import Fraction
INF = float('inf')
mod = 998244353


def main():

    h1,m1,h2,m2,k=mdata()
    out(h2*60+m2-h1*60-m1-k)

if __name__ == '__main__':
    main()

Measured memory_bytes: 10456
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}
unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
#define int ll
int win[200000];
void solve() {
    int n, k;
    cin >> n >> k;
    int r[3];
    REP(i, 3) {
        cin >> r[i];
    }
    string t;
    cin >> t;
    int ans = 0;
    for (int i = 0; i < t.length(); ++i) {
        if (i >= k) {
            if (t[i] == t[i - k] && win[i - k] == 1) {
                continue;
            }
        }
        win[i] = 1;
        if (t[i] == 'r') {
            ans += r[2];
        }
        else if (t[i] == 's') {
            ans += r[0];
        }
        else {
            ans += r[1];
        }
    }
    cout << ans << endl;
}
#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 1232
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
using LL = long long;
using ULL = unsigned long long;
#define NUM 1000000007

using namespace std;

int main()
{
    string s;
    cin >> s;
    cout << s[0] << s.size() - 2 << s.back() << endl;
}

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

#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

int main(){
    ll n, c;
    cin >> n >> c;

    vector<ll> s(n), t(n), ch(n);
    rep(i, n)cin >> s[i] >> t[i] >> ch[i];

    vector<ll> ord(n);
    iota(ALL(ord), 0);
    sort(ALL(ord), [&](ll x, ll y){
        return s[x] < s[y];
    });

    vector<pll> recoder;
    recoder.push_back(make_pair(t[ord[0]], ch[ord[0]]));

    for(ll i = 1; i < n; ++i){
        ll pos = ord[i];
        bool find_ch = false;
        rep(j, recoder.size()){
            if(recoder[j].first < s[pos]){
                find_ch = true;
                recoder[j].first = t[pos];
                recoder[j].second = ch[pos];
                break;
            }
            else if(recoder[j].first == s[pos] & recoder[j].second == ch[pos]){
                find_ch = true;
                recoder[j].first = t[pos];
                break;
            }
        }
        if(!find_ch){
            recoder.push_back(make_pair(t[pos], ch[pos]));
        }
    }

    cout << recoder.size() << endl;
}

Measured memory_bytes: 3328
n,y1=map(int,input().split())
y=y1//1000
aa=y//10

for a in range(aa+1) :
    #print(a)
    yf=y-a*10
    nf=n-a
    b1=(yf-nf)%4
    b2=(yf-nf)//4 #print(b1,b2,yf,nf)
    if yf<nf or 5*nf-yf<0:continue
    elif b1==0:
        print(a,b2,nf-b2)
        break
    else: continue

else :
    print(-1,-1,-1)


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

int main(){
    int n;
    cin>>n;
    int num[n],raw[n];
    for (int i = 0; i < n; ++i) {
        cin>>num[i];
        raw[i]=num[i];
    }
    sort(num,num+n);
    for (int j = 0; j < n; ++j) {
        if(raw[j]==num[n-1])cout<<num[n-2]<<endl;
        else cout<<num[n-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
  
int main(){
  int N;
  long long sum=0;
  cin >> N;
  for(int i=0;i<N;i++){
    if((i+1)%3!=0 && (i+1)%5!=0){
      sum+=i+1;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
#include<string.h>


int main()
{
	char s[100005];
	int a[100005] = {0}, i=0, bsr,bsl, len;
	scanf("%s", s);
	len = strlen(s);
	while (i < len-1)
	{
		for (bsr=0; (bsr+i) < len-1; bsr++)/*寻找RL字符串*/
		{
			if ((s[i + bsr] == 'R') && (s[i + bsr + 1] == 'L'))
			{
				if (bsr % 2 == 0)
				{
					a[i + bsr] += (bsr / 2 + 1); a[i + bsr + 1] += bsr / 2;
				}
				else
				{
					a[i + bsr] += ((bsr + 1) / 2); a[i + bsr + 1] += ((bsr + 1) / 2);
				}
				for (bsl = 1; (i + bsr + bsl) < len; bsl++)
				{
					if (s[i + bsr + bsl] == 'R')
					{
						bsl--;
						break;
					}
					if ((i + bsr + bsl) == (len - 1))
						break;
				}
				if (bsl % 2 == 1)
				{
					a[i + bsr] += bsl / 2; a[i + bsr + 1] += (bsl / 2 + 1);
				}
				else
				{
					a[i + bsr] += bsl / 2; a[i + bsr + 1] += bsl / 2;
				}
				i = i + bsr + bsl + 1;
				break;
			}
		}
	}
	for (i = 0; i < len-1; i++)
		printf("%d ", a[i]);
	printf("%d\n", a[i]);
}

Measured memory_bytes: 2216
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a=700,i;
	char c[4];
	scanf("%s",&c);
	for(i=0;i<3;i++)
	{
		if(c[i]=='o')
			a+=100;
	}
	printf("%d",a);
	return 0;
}

Measured memory_bytes: 256
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7

def modpow(a, n):
    ret = 1
    while n > 0:
        if n & 1:
            ret = ret * a % MOD
        a = a * a % MOD
        n >>= 1
    return ret

def modinv(a):
    return modpow(a, MOD - 2)

def modfac(x):
    ret = 1
    for i in range(2, x + 1):
        ret *= i
        ret %= MOD
    return ret

ans = 0
if (X + Y) % 3 == 0:
    a = (2 * X - Y) // 3
    b = (2 * Y - X) // 3
    if a >= 0 and b >= 0:
        n = a + b
        r = a
        ans = modfac(n)
        ans *= modinv(modfac(n - r) * modfac(r))
        ans %= MOD
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<int>a(n);
  for (int i; i<n; i++) cin >> a[i];
  vector<int>b(n);
  b=a;
  sort(a.begin(),a.end());
  int cnt =0;
  for(int i; i<n; i++){
    if(a[i]!=b[i]) cnt++;
  }
  cout << ( cnt==2 || cnt == 0 ? "YES":"NO" ) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int A,B,C,D,Ans;
	scanf("%d %d %d",&A,&B,&C);
	D=A-B;
	if(C-D>0)
		Ans=C-D;
	else
		Ans=0;


	printf("%d",Ans);
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
int n;
long long a[100000];
long long f(long long x){
    long long ans=0;
    for(int i=0;i<n;i++)ans+=x^a[i];
    return ans;
}

int main(){
    long long k;
    scanf("%d%lld",&n,&k);
    for(int i=0;i<n;i++)
        scanf("%lld",&a[i]);
    bool digit[40];
    long long fzero=f(0);
    for(int i=0;i<40;i++){
        digit[i]=(fzero<f(1LL<<i));
    }
    long long nowk=k+1,mask=(nowk&(-nowk))-1,ans=0;
    while(nowk>0){
        nowk-=nowk&(-nowk);
        long long maxx=nowk;
        for(int i=0;i<40;i++){
            if((mask&(1LL<<i))>0 && digit[i]){
                maxx+=1LL<<i;
            }
        }
        long long fx=f(maxx);
        if(fx>ans)ans=fx;
        mask=(nowk&(-nowk))-1;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 896
n,m = map(int,input().split())
A = list(map(lambda x:-int(x),input().split()))
import heapq
heapq.heapify(A)
for i in range(m):
    a = heapq.heappop(A)
    heapq.heappush(A,-(-a//2))
print(-sum(A))


Measured memory_bytes: 14224
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<int, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 310;
const int MAXM = 600010;
const int MAXK = 110;
const int MAXQ = 200010;

int n, k, a[MAXN];
ll dp[MAXN][MAXN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> k;
    FOR(i,1,n) cin >> a[i];
    FOR(i,0,n+1)
        FOR(j,0,k) dp[i][j] = 1e15;
    dp[0][0] = 0;
    FOR(i,1,n+1)
        FOR(j,0,k)
            FOR(p,0,j) {
                if (i - p - 1 < 0) break;
                dp[i][j] = min(dp[i][j], dp[i-p-1][j-p] + max(0, a[i] - a[i-p-1]));
            }
    ll res = 1e18;
    FOR(j,0,k) res = min(res, dp[n+1][j]);
    cout << res;
    return 0;
}


Measured memory_bytes: 1024
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
    arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
    for (auto& i : arr) {
        fill_all(i, v);
    }
}

int64_t N,K;
int64_t A[300000];
int64_t R[300000];
int64_t L[300000];

int main()
{
    using std::endl;
    in.sync_with_stdio(false);
    out.sync_with_stdio(false);
    in.tie(nullptr);
    out.tie(nullptr);

    in >> N >> K;
    for (size_t i = 1; i <= N; i++)
    {
        in >> A[i];
    }

    for (int32_t iKKKK = 0; iKKKK < K; iKKKK++)
    {
        fill_all(R, 0);
        fill_all(L, 0);
        for (int64_t i = 1; i <= N; i++)
        {
            R[i] += 1;
            R[std::min(i + A[i], N + 2)+1] -= 1;
        }
        for (int64_t i = 1; i <= N; i++)
        {
            L[i] -= 1;
            L[std::max(i - A[i], (int64_t)0)] += 1;
        }

        for (int64_t i = 1; i <= N; i++)
        {
            R[i] += R[i - 1];
        }
        for (int64_t i = 1; i <= N; i++)
        {
            L[i] += L[i - 1];
        }

        for (int64_t i = 1; i <= N; i++)
        {
            A[i] = R[i] + L[i];
        }

        bool cont = false;
        for (int64_t i = 1; i <= N; i++)
        {
            if (A[i] < N) {
                cont = true;
            }
        }
        if (!cont) {
            break;
        }
    }
    for (int64_t i = 1; i < N; i++)
    {
        out << A[i] << ' ';
    }
    out << A[N] << endl;

    return 0;
}
#endif


Measured memory_bytes: 9412
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,a,b,n,l;
	cin>>n;

	l=100000000000;
	for(i=1;i<n;i++){
		a=i;
		b=n-i;
		k=0;
		while(a>0){
			k=k+(a%10);
			a=a/10;
		}
		while(b>0){
			k=k+(b%10);
			b=b/10;
		}
		if(k<l) l=k;
	}
	cout<<l;
	
	return 0;
}
//ctrl H replace

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;

struct Point { double x, y; };

void print(struct Point p) {
    cout << fixed << setprecision(5) << p.x << " " << p.y << endl;
}

void koch(int n, struct Point a, struct Point b) {
    if (n == 0) return;

    struct Point s, u, t;
    double th = M_PI * 60.0 / 180.0;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(n - 1, a, s);
    print(s);
    koch(n - 1, s, u);
    print(u);
    koch(n - 1, u, t);
    print(t);
    koch(n - 1, t, b);
}

int main() {

    int n;
    cin >> n;

    struct Point a, b;
    a.x = 0.0;
    a.y = 0.0;
    b.x = 100.0;
    b.y = 0.0;

    print(a);
    koch(n, a, b);
    print(b);

    return 0;
}

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

int hex2arab(char c){
  char hex[] = {'A', 'B', 'C', 'D', 'E', 'F'};
  int  arab[] = {10, 11, 12, 13, 14, 15};

  for(int i=0; hex[i]; i++)
    if(c == hex[i]) return arab[i];
  return 0;
}

int main()
{
  char a,b;
  int x,y;

  std::cin >> a>>b;

  x = hex2arab(a);
  y = hex2arab(b);

  if(x<y)
    std::cout << "<" << '\n';
  else if(x>y)
    std::cout << ">" << '\n';
  else
    std::cout << "=" << '\n';

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static int MAX = 10010017;
    static int MOD = 1000000007;
    static long[] fac;  // 階乗
    static long[] finv;
    static long[] inv;  // 逆元
    
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        COMinit();
        
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        long all = modpow(2, n) - 1;
        all %= MOD;
        long tmp1 = nCkMOD(n, a);
        long tmp2 = nCkMOD(n, b);
        
        long tmp = all - tmp1;
        
        if (tmp < 0) {
            tmp += MOD;
        }
        
        tmp = tmp - tmp2;
        
        if (tmp < 0) {
            tmp += MOD;
        }
        
        System.out.println(tmp);
        
    }
    
    // テーブルを作る前処理
    public static void COMinit() {        
        fac = new long[MAX];
        finv = new long[MAX];
        inv = new long[MAX];
        
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }
    // 二項係数計算(1 ≦ n ≦ 10^9, 1 ≦ k ≦ 10^7 程度)
    public static long nCkMOD(int n, int k){
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        
        long res = 1;
        for (int i = 1; i <= k; i++) {
            res = (res * ((n + 1) - i)) % MOD;
            res = (res * inv[i]) % MOD;
        }
        
        return res;
    }
    
    public static long modpow(long a, long n) {
        long res = 1;
        while (n > 0) {
            long tmp = n & 1;
            if (tmp > 0) res = res * a % MOD;
            a = a * a % MOD;
            n >>= 1;
        }
        return res;
    }
}

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

int main() {
    int N;
    int a[10001];
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    int cnt = 0;
    for (int i = 0; i < N; i++) {
        while (a[i] % 2 == 0) {
            cnt++;
            a[i] /= 2;
        }
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 888
#include <iostream>

using namespace std;

int main(void)
{
  int m1, d1, m2, d2;

  cin >> m1 >> d1;
  cin >> m2 >> d2;

  if (m1 == m2) {
    cout << 0;
  } else {
    cout << 1;
  }

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{
    public static void Main()
    {
        long[]Nx = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        long K = Nx[0], x = Nx[1];
        long ans = 0;
        long[] children = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var sorted = children.OrderBy(v => v);
        for (int i = 0; i < sorted.Count(); i++) {
            if (sorted.ElementAt(i) > x) break;
            if (i + 1 == sorted.Count()) { ans += (sorted.ElementAt(i) == x ? 1 : 0); break; }
            x -= sorted.ElementAt(i);
            if (0 > x) break;
            else ans += 1;
        }
        Console.WriteLine(ans);
    }
}

public class Atcoder
{
    public static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static long LCM(long a, long b)
    {
        long c = a * b;
        if (a < b) Swap(ref a, ref b);
        long d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string StrReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int IntRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static int[] SpIntRead(char c)
    {
        return Console.ReadLine().Split(c).Select(int.Parse).ToArray();
    }
    public static string ToConvertBit(int N, int e)
    {
        string ret = "";
        int r = 0;
        while (N != 0)
        {
            r = N % e;
            ret += r.ToString();
            N -= r;
            N /= e;
        }
        ret = StrReverce(ret);
        return ret;
    }
}


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

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

#define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i];

int main(void){

  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  vector<string> S(n);
  REP(i, n) cin >> S[i];


  vector<int> v0(26, 50);

  static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");

  REP(i, n){
    vector<int> v(26, 0);
    REP(j, S[i].length()) REP(k, 26){
      if(S[i][j] == abet[k]) v[k]++;
    }
    REP(k, 26) if(v0[k] > v[k]) v0[k] = v[k];
  }

  REP(i, 26) REP(j, v0[i]) if(v0[i] != 50) cout << abet[i];
  cout << endl;

  return 0;

}


Measured memory_bytes: 256
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import qualified Data.Array.IO as A
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

toTup [a,b] = (a,b)


main :: IO ()
main = do
    n <- readLn :: IO Int
    as <- r' :: IO [Int]
    print $ 1 / (sum $ map ((\x -> 1/x).fromIntegral) as)






Measured memory_bytes: 508
// inputに入力データ全体が入る
function Main(input) {
	var ans = 'No'
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.trim().split("\n");
	s = input[0].split(' ').map((n) => (parseInt(n)))
	s.sort()
	if (s[0] === s[1]) {
		if (s[0] !== s[2]) {
			ans = 'Yes'
		}
	}

	if (s[1] === s[2]) {
		if (s[0] !== s[2]) {
			ans = 'Yes'
		}
	}



	//出力
	console.log(ans)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require('fs').readFileSync('./input.txt', 'utf-8'));

Measured memory_bytes: 21064