akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef vector<int,vector<int>> vvec;
typedef long double ld;

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

//----***定数***----
const int MOD=1000000007;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***----
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#define HERE  cout<<"Here"<<endl;

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

signed main(){
  int N,a,b;cin>>N;
  vector<vector<int>> G(N);
  vector<pair<int,int>> I;
  map<pair<int,int>,int> ans;
  REP(i,1,N){
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
    I.emplace_back(a,b);
  }

  int K=0;
  vector<int> cs(N,0),used(N,0);
  used[0]=1;
  queue<int> que;
  que.emplace(0);
  while(!que.empty()){
    int v=que.front();que.pop();
    if(K<(int)G[v].size()){K=G[v].size();}
    int cur=1;
    each (u,G[v]){
      if(used[u])continue;
      if(cur==cs[v])cur++;
      cs[u]=ans[make_pair(u,v)]=ans[make_pair(v,u)]=cur++;
      used[u]=1;
      que.emplace(u);
    }
  }
  print(K)
  for(auto &&p:I){
    print(ans[p])
  }
}


Measured memory_bytes: 22128
# -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect

def s():
    return raw_input().strip()
def n():
    return int(raw_input())
def d():
    return float(raw_input())

def ls():
    return raw_input().strip().split()
def ln():
    return map(int, raw_input().strip().split())
def ld():
    return map(float, raw_input().strip().split())

def fs():
    return [raw_input().strip() for i in xrange(input())]
def fn():
    return [int(raw_input().strip()) for i in xrange(input())]
def fd():
    return [float(raw_input().strip()) for i in xrange(input())]

N = n()

items = []
for i in xrange(N):
    x, y = ln()
    items.append([x + y, x, y])

items.sort(reverse=True)

print sum(map(lambda x: x[1], items[0::2])) - sum(map(lambda x: x[2], items[1::2]))


Measured memory_bytes: 23028
// Beginner163.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
#include <math.h>

typedef long long ll;

using namespace std;
int main()
{
	//A
    /*double r;
	cin >> r;
	cout << 2 * M_PI * r;*/

	//B
	/*int n, m;
	cin >> n >> m;
	int res = n;
	int a;
	for (int i = 0; i < m; ++i)
	{
		cin >> a;
		res -= a;
	}
	cout << (res >= 0 ? res : -1);*/

	//C
	/*int n;
	cin >> n;
	vector<int>a(n);
	a[0] = 0;
	map<int, int> res;
	for (int i = 1; i < n; ++i)
	{
		cin >> a[i];
		a[i]--;
		res[a[i]]++;
	}

	for (int i = 0; i < n; ++i)
	{
		cout << res[i] << '\n';
	}*/

	//D
	ll n, k;
	cin >> n >> k;
	const ll modValue = 1e9 + 7;
	
	ll res = 0;
	for (ll i = k; i <= n + 1; ++i)
	{
		ll min = (0 + i-1) * i / 2;
		ll max = (n - (i-1) + n) * i / 2;
		res += max - min + 1;
		res %= modValue;
	}

	cout << res;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int read(){
	int sum=0,f=1;
	char s=getchar();
	while (s<'0' or s>'9'){
		if (s=='-')f=-1;
		s=getchar();
	}
	while (s>='0' and s<='9'){
		sum=sum*10+s-'0';
		s=getchar();
	}
	return sum*f;
}
int n;
int main(){
	string s;
	cin>>s;
	int m=0;
	for (int i=0;i<s.size();i++){
		if (s[i]=='S')continue;
		int t=0;
		for (int j=i;j<s.size();j++){
			if (s[j]=='R')t++;
			else break;
		}
		m=max(m,t);
	} 
	cout<<m<<endl;
	return 0;
}



Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define DEBUG_MODE
#define endl '\n'
#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_ENDL endl
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_ENDL 0
#define DEBUG_SEPARATOR_LINE 0
#endif
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "")
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }
template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL_S(s);
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL_S(s);
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

void init_io() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(30);
}

int main() {
    init_io();
    ll H, W;
    cin >> H >> W;
    ll h, w;
    cin >> h >> w;
    cout << H * W - (h * W + H * w - h * w) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL N = 200010;
const LL Mod = 1e9+7;
inline LL read()
{
  LL p=0; LL f=1; char ch=getchar();
  while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();}
  while(ch>='0' && ch<='9'){p=p*10+(ch-'0'); ch=getchar();}
  return p*f;
}

vector<LL> V;

LL qpow(LL x,LL k,LL mo){LL s=1; while(k){if(k&1) s=(s*x)%mo; x=(x*x)%mo; k>>=1;} return s;}

LL f[N]; LL n,k;

int main()
{


  n=read(); k=read(); V.clear();
  for(LL i=1;i*i<=n;i++) if(n%i==0)
  {
    V.push_back(i);
    if(i*i!=n) V.push_back(n/i);
  }
  
  sort(V.begin(),V.end());

  LL ans=0; LL ny2=qpow(2,Mod-2,Mod);
  for(LL i=0;i<V.size();i++)
  {
  	LL x=V[i]; f[i]=qpow(k,x/2,Mod);
  	if(x&1) f[i]=f[i]*k%Mod;
  	for(LL j=0;j<i;j++) if(x % V[j] == 0)
  	  f[i] = (f[i] - f[j] + Mod) % Mod;

  	if(x&1) ans = (ans + f[i] * V[i] % Mod ) % Mod;
  	else ans = (ans + f[i] * V[i] % Mod * ny2 % Mod) % Mod;
  	// printf("%lld\n",f[i]);
  }


  return printf("%lld\n",ans),0;
}

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

using namespace std;

bool compare(int i,int j)
{
    return i>j;
}

long long num(long long A,long long B,long long M){
     // Add 1 explicitly as A is divisible by M
    if (A % M == 0)
        return (B / M) - (A / M) + 1;

    // A is not divisible by M
    return (B / M) - (A / M);
}

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

    ll A, B, C, D;
    cin>>A>>B>>C>>D;

    ll P = (C*D)/__gcd(C, D);
    ll solution = num(A, B, C)+num(A, B, D)-num(A, B, P);
    cout<<(B-A+1)-solution;



    return 0;

}


Measured memory_bytes: 256
from math import tan, pi, degrees

a, b, x = map(int, input().split())

def solve(isOK):
    ng, ok = pi/2, 0
    while abs(ok-ng) > 10**-12:
        mid = (ng+ok) / 2
        if isOK(mid):
            ok = mid
        else:
            ng = mid
#    print('ok:', ok)
    print(degrees(ok))

def isOK1(theta):
    return a*a*tan(theta)/2 + x/a <= a*b
def isOK2(theta):
    return b*b/tan(theta)/2 >= x/a

if x/a >= a*b/2:
    solve(isOK1)
else:
    solve(isOK2)



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


int main(void)
{
    string S;
    cin >> S;
    vector<int> val(4, 0);
    for (int i = 0; i < 3; i++)
    {
        if(S[i] == 'R'){
            val[i+1] = val[i] + 1;
        } else {
            val[i+1] = 0;
        }
    }
    cout << *max_element(val.begin(), val.end()) << endl;

    return 0;
}


Measured memory_bytes: 3592
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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

fn main() {
    input!{
        mut k: u64,
        a: u64,
        b: u64,
    }
    let mut ans = 0;
    if a + 2 >= b {
        ans = k + 1
    } else {
        k -= a + 1;
        ans += b;
        loop {
            if k >= 2 {
                k -= 2;
                ans += (b - a);
            } else {
                break;
            }
        }

        ans += k;
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;

const vector<int> times{2, 3, 5};
const ll INF = 8101145141919364364;

int main() {
    int t;
    cin >> t;
    while (t--) {
        ll n;
        vector<ll> coin(4);
        cin >> n >> coin[0] >> coin[1] >> coin[2] >> coin[3];

        map<ll, ll> cost;
        cost[n] = 0;
        priority_queue<p, vector<p>, greater<>> que;
        que.push({0, n});
        while (true) {
            auto x = que.top();
            que.pop();
            ll nowNum = x.second;
            if (x.first > cost[nowNum])continue;
            if (nowNum == 0) break;

            for (int i = 0; i < 3; i++) {
                ll nextNum = nowNum / times[i];
                ll nextCost = x.first + coin[i] + coin[3] * (nowNum % times[i]);
                if (cost.find(nextNum) == cost.end() || cost[nextNum] > nextCost) {
                    cost[nextNum] = nextCost, que.push({nextCost, nextNum});
                }

                nextNum = (nowNum + times[i] - 1) / times[i];
                nextCost = x.first + coin[i] + coin[3] * (times[i] - (nowNum % times[i]));
                if (cost.find(nextNum) == cost.end() || cost[nextNum] > nextCost) {
                    cost[nextNum] = nextCost, que.push({nextCost, nextNum});
                }
            }
        }

        ll ret = INF;
        for (auto x:cost) {
            if (x.first > INF / coin[3] + 1)continue;
            ret = min(ret, x.first * coin[3] + x.second);
        }
        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 4260
#include <iostream>

using namespace std;

int main()
{ int a,b,x,y,z;
  cin>>a>>b;
  x=a+b;
  y=a-b;
  z=a*b;
  if(x>y && x>z)
        cout<<x<<endl;
  else if(z>y && z>x)
        cout<<z<<endl;
  else
        cout<<y<<endl;
    return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	string da[7] = {"thu", "fri", "sat", "sun", "mon", "tue", "wed"};
  ll x;
  cin >> x;
  cout << da[x % 7] << endl;
	return 0;
}


Measured memory_bytes: 3256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	tt := make([]int, n)
	vv := make([]float64, n)
	for i := 0; i < n; i++ {
		tt[i] = getNextInt(scanner)
	}
	for i := 0; i < n; i++ {
		vv[i] = float64(getNextInt(scanner))
	}
	ans := solve(n, tt, vv)
	fmt.Fprintln(writer, ans)

	writer.Flush()
}
func solve(n int, tt []int, vv []float64) float64 {
	var maxv [40005]float64

	t := 0
	maxv[0] = 1e9

	for i := 0; i < n; i++ {
		if maxv[t] > vv[i] {
			maxv[t] = vv[i]
		}
		for ii := t + 1; ii <= t+tt[i]*2; ii++ {
			maxv[ii] = vv[i]
		}
		t += tt[i] * 2
	}
	maxv[0] = 0.0
	maxv[t] = 0.0
	for i := 0; i < t; i++ {
		if maxv[i+1] > maxv[i]+0.5 {
			maxv[i+1] = maxv[i] + 0.5
		}
	}
	for i := t; i > 0; i-- {
		if maxv[i-1] > maxv[i]+0.5 {
			maxv[i-1] = maxv[i] + 0.5
		}
	}
	ans := 0.0
	for i := 0; i < t; i++ {
		ans += (maxv[i] + maxv[i+1]) * 0.25
	}
	return ans
}


Measured memory_bytes: 1024
n,k = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

ax = []
d = 0
for i in a:
    if(d != i):
        ax.append(1)
        d = i
    else:
        ax[-1] += 1

ax.sort()
#print(ax)

print(sum(ax[0:len(ax)-k]))

Measured memory_bytes: 24744
#include<iostream>
using namespace std;
int main(){
    int a,b;
    string x;
    cin >> a >> b;
    if(a>b){
        x = " > ";
    }else if(a<b){
        x = " < ";
    }else{
        x = " == ";
    }
    cout << "a" << x << "b" << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 100005;

int main() {
    LL ans = 0, n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        if (i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <queue>
#include <iomanip>
#include <algorithm>
using namespace std;

typedef pair <int, int> ii;

const int Maxn = 100005;

int n, m;
vector <ii> neigh[Maxn];
bool tk[Maxn];
int val[Maxn];

bool Fill(int v, int col)
{
	if (tk[v]) return val[v] == col;
	tk[v] = true; val[v] = col;
	for (int i = 0; i < neigh[v].size(); i++) {
		ii u = neigh[v][i];
		if (!Fill(u.first, val[v] + u.second)) return false;
	}
	return true;
}

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; i++) {
		int a, b, c; scanf("%d %d %d", &a, &b, &c);
		neigh[a].push_back(ii(b, c));
		neigh[b].push_back(ii(a, -c));
	}
	for (int i = 1; i <= n; i++) if (!tk[i])
		if (!Fill(i, 0)) { printf("No\n"); return 0; }
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 12032
n=int(input())
ss=[input() for _ in range(n)]
m=int(input())
ts=[input() for _ in range(m)]

uniq=list(set(ss+ts))

cost=[]
for u in uniq:
  cost.append(ss.count(u)-ts.count(u))

if max(cost)<0:
  print(0)
else:
  print(max(cost))

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

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

using LL = long long int;
using LD = long double;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

vector<char> D;
int n, k;

bool func(string s) {	
	for (int i = 0; i < s.size(); i++) {
		for (int j = 0; j < D.size(); j++) {
			if (s[i] == D[j]) {
				return false;
			}
		}
	}
	return true;
}

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

	cin >> n >> k;

	D.resize(k);
	for (int i = 0; i < k; i++) {
		cin >> D[i];
	}

	int ans = 0;
	string s;
	for (int i = n;; i++) {
		s = to_string(i);

		if (func(s)) {
			ans = i;
			break;
		}
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int N, M; 
	cin >> N >> M; 
	pair<int, int> A[100010]; 
	for(int i = 0; i < M; i++){
		int a, b; 
		cin >> a >> b; 
		A[i].first = b, A[i].second = a; 
	}
	sort(A, A+M);
	int count = 0, R = 0; 
	for(int i = 0; i < M; i++){
		if(A[i].second >= R){
			count ++; 
			R = A[i].first; 
		}
	}
	cout << count << endl; 
}

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

const int INF = 0x3f3f3f3f;
int n, k;
int h[101010];
int memo[101010];

int main(){
    
    scanf("%d %d", &n, &k);
    
    for(int i=0;i<n;i++)
        scanf("%d",&h[i]);
    
    memo[0] = 0;
    
    for(int i=1;i<n;i++){
        memo[i] = INF;
        for(int j = max(0,i-k) ; j<i ; j++)
            memo[i] = min( memo[i] , memo[j] + abs(h[i]-h[j]) );
    }
    
    printf("%d\n",memo[n-1]);
    
    return 0;
}

Measured memory_bytes: 1024
"use strict";
// inputに入力データ全体が入る
const main = (input) => {
  //分割代入,1行目がq,2行目がb,3行目がcに代入される
  const [a, b, c] = input.trim().split(",");
  console.log(a + " " + b + " " + c);
};

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(void)
{
  int n;
  cin >> n;
  
  long long sumt = 0, suma = 0;
  for(int i=0; i<n; i++){
    int t, a;
    cin >> t >> a;
    
    long long tmpt = t;
    long long tmpa = a;
    if(i!=0){
      long long tmp;
      if(sumt/t > suma/a){
      tmp = (sumt + t - 1)/t;
      tmpt = tmp * t;
      tmpa = tmp * a;
      
      tmp = (tmpa + a - 1)/a;
      tmpt = tmp * t;
      tmpa = tmp * a;
      }
      else{
      tmp = (suma + a - 1)/a;
      tmpt = tmp * t;
      tmpa = tmp * a;
      
      tmp = (tmpt + t - 1)/t;
      tmpt = tmp * t;
      tmpa = tmp * a;
      }
    }
    //printf("%d:  %lld:%lld  %lld %lld\n", i, t,a,tmpt,tmpa);

    sumt = tmpt;
    suma = tmpa;
    
    //cout << i << ": " << sumt << " " << suma << endl;
  }
  cout << sumt + suma << endl;
  
  return 0;
}


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

int findSumOfDigits(int n){
 int sum = 0;
  while(n > 0){
   sum += n%10;
    n /= 10;
  }
  return sum;
}
int main() {
  int n,a,b;
  int total = 0;
  cin >> n >> a>> b;
  for(int i = 1; i <= n; ++i){
   int sum = findSumOfDigits(i);
    if(sum >=a && sum <= b){
     total += i;
    }
  }
  cout << total << endl;
}


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

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

  int n,q; cin >> n >> q;
  string s; cin >> s;
  vector<char> t(q),d(q);
  for(int i = 0; i < q; i++){
    cin >> t[i] >> d[i];
  }

  function< int(int) > check =
  [&](int mid){
    if(n <= mid) return 0LL;
    for(int i = 0; i < q; i++){
      if(s[mid] == t[i]){
        if(d[i] == 'L') mid--;
        else mid++;
      }
      if(mid < 0) return 1LL;
      if(n <= mid) return 2LL;
    }
    return 0LL;
  };

  int ok = -1;
  int ng = n;
  while(ng - ok > 1){
    int mid = (ok + ng) / 2;
    if(check(mid) == 1) ok = mid;
    else ng = mid;
  }
  int left = ok;

  ok = n;
  ng = -1;
  while(ok - ng > 1){
    int mid = (ok + ng) / 2;
    if(check(mid) == 2) ok = mid;
    else ng = mid;
  }

  //cout << left << " " << ok << endl;
  cout << ok - left - 1 << endl;

  return 0;
}


Measured memory_bytes: 976
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
int N, A, B;
bool ans[4000];
bool query(int a, int b) {
  cout << "? " <<a << " "<<b<<endl;
  char res;
  cin >> res;
  return res=='Y';
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> A >> B;
  N = A+B;
  if (A <= B) {
    cout << "Impossible\n";
    return 0;
  }
  vector<int> seq;
  rep(i, N) {
    if (seq.empty()) {
      seq.pb(i);
    }
    else {
      if (query(seq.back(), i)) seq.pb(i);
      else seq.pop_back();
    }
  }
  assert(seq.size());
  int honest = seq.back();
  rep(i, N) ans[i] = query(honest, i);
  cout << "! "; rep(i, N) cout << ans[i]; cout << endl;
  return 0;
}


Measured memory_bytes: 724
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

int N;
ll A[100000];
map<pair<int, int>, ll> mp;
int main(void){
    // Your code here!
    cin >> N;
    ll sum = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    
    for(int i = 1; i < N; i++){
        mp[make_pair(i, i+1)] = A[i-1];
        sum +=  A[i-1];
    }
    mp[make_pair(N, 1)] = A[N-1];
    sum += A[N-1];
    

    int x1 = 0;
    ll tmp = 0;
    for(int i = 2; i <= N-1; i+= 2){
        tmp += mp[make_pair(i, i+1)];
    }
    x1 = sum / 2 - tmp;
    cout << 2 * x1 << " ";
    
    ll ans = x1;
    for(int i = 1; i < N; i++){
        if(i != N-1) cout << 2 * (mp[make_pair(i, i+1)] - ans) << " ";
        else cout << 2 * (mp[make_pair(i, i+1)] - ans) << endl;
        ans = mp[make_pair(i, i+1)] - ans;
    }
}


Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,b="CODEFESTIVAL2016";
	int ans=16;
    cin>>s;
    for(int i=0;i<16;i++)
    {
    	if(s[i]==b[i])
    	{
    		ans-=1;
    	}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var a int
	var b string
	fmt.Scan(&a,&b)
	splitB := strings.Split(b,"")
	b_n := len(splitB)
	dotIndex := 0
	for i:= 0; i<b_n; i++ {
		if splitB[i] == "." {
			dotIndex = i
			break
		}
	}
	mergeString := ""
	for i:= 0; i<dotIndex; i++ {
		mergeString = mergeString + splitB[i]
	}
	for i:= dotIndex+1; i<b_n; i++ {
		mergeString = mergeString + splitB[i]
	}
	// fmt.Println(mergeString)
	mergeInt,_ := strconv.Atoi(mergeString)
	result := a*mergeInt
	resultString := strconv.Itoa(result)
	N := len(resultString)
	results := strings.Split(resultString,"")
	check := false
	for i:= 0; i<N-2; i++ {
		check = true
		fmt.Print(results[i])
	}
	if !check {
		fmt.Println(0)
	}
}


Measured memory_bytes: 1844
from collections import deque

def bfs(E, s):
    N = len(E)
    order = [-1] * N # a bfs ordering of each vertex
    parent = [-1] * N # parent of each vertex in the bfs search tree
    depth = [-1] * N # the depth of each vertex
    q = deque([(s, -1, 0)]) # (vertex, parent, depth)
    num = 0 # current ordering
    while q:
        v, p, d = q.popleft()
        if order[v] < 0: # visited v for the first time
            order[v] = num; parent[v] = p; depth[v] = d
            num += 1
            for u in E[v]:
                if order[u] >= 0: continue
                q.append((u, v, d+1))
    return order, parent, depth

N, M = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    E[a-1].append(b-1); E[b-1].append(a-1)
_, par, _ = bfs(E, 0)
print('Yes')
for p in par[1:]: print(p + 1)

Measured memory_bytes: 44352
fn main() {
    let n = read::<usize>();
    let xs = read_vec::<u32>();
    let mut ys = xs.clone();
    ys.sort();
    let m1 = ys[n/2-1];
    let m2 = ys[n/2];

    for i in 0..n {
        if xs[i] <=m1 {
            println!("{}", m2);
        } else {
            println!("{}", m1);
        }
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 8444
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, m, l;
    cin >> n >> m >> l;

    auto edge = initVec2<int>(n, n, INF);
    rep(i, m){
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        edge[a][b] = c;
        edge[b][a] = c;
    }

    rep(k, n){
        rep(i, n){
            rep(j, n){
                edge[i][j] = min(edge[i][j], edge[i][k] + edge[k][j]);
            }
        }
    }

    rep(i, n){
        rep(j, n){
            if(edge[i][j] <= l){
                edge[i][j] = 1;
            }else{
                edge[i][j] = INF;
            }
        }
    }

    rep(k, n){
        rep(i, n){
            rep(j, n){
                edge[i][j] = min(edge[i][j], edge[i][k] + edge[k][j]);
            }
        }
    }

    int q;
    cin >> q;
    rep(i, q){
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        if(edge[s][t] == INF){
            cout << -1 << endl;
        }else{
            cout << edge[s][t] - 1 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <map>

using namespace std;

int main()
{
  int N, M;
  //vector<string> blueCard;
  //vector<string> redCard;
  int count[100];
  map<string, int> strTag;

  cin >> N;
  for (int i = 0; i < N; i++)
  {
    string str;
    cin >> str;
    //blueCard.push_back(str);
    strTag[str.c_str()]++;
  }

  cin >> M;
  for (int i = 0; i < M; i++)
  {
    string str;
    cin >> str;
    //redCard.push_back(str);
    strTag[str.c_str()]--;
  }

  //最大値探す
  int maxCount = -1;
  //string strName;
  for (auto itr = strTag.begin(); itr != strTag.end(); ++itr)
  {
    if (itr->second > maxCount)
    {
      maxCount = itr->second;
      //strName = itr->first;
    }
  }

  if (maxCount >= 0)
    cout << maxCount << endl;
  else
    cout << 0 << endl;
}


Measured memory_bytes: 256
S = list(input())
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
# print(alphabet)
# print(S)
print('None') if len(set(S)) == 26 else print(sorted(list(set(alphabet) - set(S)))[0])


Measured memory_bytes: 3956
S = list(input())
N = len(S)

count = 0
for i in range(N):
  if(i%2 == 0): #奇数のとき
    if((S[i]=='R')or(S[i]=='U')or(S[i]=='D')): count += 1
  else:
    if((S[i]=='L')or(S[i]=='U')or(S[i]=='D')): count += 1

if(count == N):
 print('Yes')
else:
 print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
char c;
cin >> c;
if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o') {
  cout << "vowel" << endl;
} else {
  cout << "consonant" << endl;
}
return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d", $n, $m, $c);
$b = explode(" ",trim(fgets(STDIN)));
for($i=0; $i<$n; $i++){
    $a[] = explode(" ", trim(fgets(STDIN)));
}

$count = 0;
$sum = 0;
for($i=0; $i < $n; $i++){
    for($s=0; $s < $m; $s++){
        $sum += ($a[$i][$s])*($b[$s]);
    }
    if(($sum) + ($c) > 0){
        $count++;
    }
    $sum = 0;
}
echo $count;
?>

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

int main(){
  string s;
  cin >> s;
 int a = s[0]- '0';
 int b = s[1]- '0';
 int c = s[2]- '0';
 int d = s[3]- '0';
 int e1 = a+b+c+d;
 int e2 = a+b+c-d;
 int e3 = a+b-c+d;
 int e4 = a-b+c+d;
 int e5 = a-b-c+d;
 int e6 = a-b+c-d;
 int e7 = a+b-c-d;
 int e8 = a-b-c-d;
 if(e1 == 7){
   cout << s[0] << "+" << s[1] << "+" << s[2] << "+" << s[3] << "=7";
   return 0;
 }
 if(e2 == 7){
   cout << s[0] << "+" << s[1] << "+" << s[2] << "-" << s[3] << "=7";
   return 0;
 }
 if(e3 == 7){
   cout << s[0] << "+" << s[1] << "-" << s[2] << "+" << s[3] << "=7";
   return 0;
 }
 if(e4 == 7){
   cout << s[0] << "-" << s[1] << "+" << s[2] << "+" << s[3] << "=7";
   return 0;
 }
 if(e5 == 7){
   cout << s[0] << "-" << s[1] << "-" << s[2] << "+" << s[3] << "=7";
   return 0;
 }
 if(e6 == 7){
   cout << s[0] << "-" << s[1] << "+" << s[2] << "-" << s[3] << "=7";
   return 0;
 }
 if(e7 == 7){
   cout << s[0] << "+" << s[1] << "-" << s[2] << "-" << s[3] << "=7";
   return 0;
 }
 if(e8 == 7){
   cout << s[0] << "-" << s[1] << "-" << s[2] << "-" << s[3] << "=7";
   return 0;
 }
}

Measured memory_bytes: 256
//皆さん、第9回シンデレラガール総選挙は、トップでオンリーワンを目指す城ヶ崎美嘉に
//そしてボイスアイドルオーディションは、プログラミングが趣味の才女大石泉に、ぜひ投票をお願いします！
//#城ヶ崎美嘉を009のシンデレラに
//#大石泉の必勝プログラム
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
set<string> s;
int main()
{
	int n;string a;cin>>n;
	rep(i,n){
		cin>>a;s.insert(a);
	}
	cout<<s.size()<<endl;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/04  Problem: ABC 096 C / Link: http://abc096.contest.atcoder.jp/tasks/abc096_c  ----- */


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

	LL H, W; cin >> H >> W;
	vector<string> a(H);
	for (int i = 0; i < H; ++i) {
		cin >> a[i];
	}
	auto is_in = [](int a, int b, int c) {
		return a <= b && b < c;
	};
	LL ans = 0;
	FOR(i, 0, H) {
		FOR(j, 0, W) {
			if (a[i][j] == '#') {
				LL cnt = 0;
				FOR(k, 0, 4) {
					int ny = i + DY[k], nx = j + DX[k];
					if (is_in(0, ny, H) && is_in(0, nx, W)) {
						cnt += a[ny][nx] == '#';
					}
				}
				if (cnt == 0) {
					ans = -1;
				}
			}
		}
	}

	cout << (ans != -1 ? "Yes" : "No") << "\n";

	return 0;
}


Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define     int 	    long long
#define 	pb 	        push_back
#define 	mp 	        make_pair
#define 	pi 	        2*acos(0.0)
#define     scan(i)     scanf("%d",&i)
#define     loop(i,n) 	for(int i = 0 ; i <n ; i++)
#define 	vect 	    vector<int>
#define 	vec_it 	    vector<int>::iterator vi
#define     sorta(v)    sort(v.begin(),v.end())
#define     sortd(v)    sort(v.begin(),v.end(),greater<>())
#define 	mapp 	    map<int,int>
#define 	pairr 	    pair<int,int>
#define 	sett	    set<int>s
#define 	set_it 	    set<int>::iterator si
#define     map_it      map<int,int> :: reverse_iterator mi
#define 	yes 	    cout<<"YES"<<endl
#define 	no 	        cout<<"NO"<<endl
#define 	ff 	        first
#define 	ss 	        second
#define     mx          iNT_MAX
#define     lmx         LLONG_MAX
#define     mn          iNT_MiN
#define     lmn         LLONG_MiN
#define     GCD         __gcd(a,b)
#define     LCM         (a/GCD)*b
template <typename T> T gcd(T a,T b){return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}
int modulo (int a, int b) { return a >= 0 ? a % b : ( b - abs ( a%b ) ) % b; }

void solve()
{
  // freopen ("(input).txt" , "r",  stdin) ;
  // string st,stt ;
  // int low=0,high=0;
  // int l,r;
    int n,k,t,b,c,x,y,z,d=0,temp=0,cnt=0,sum=0,f=0;
    cin>>n  ; vect v ,a  ; sett ; set_it ; mapp m,mp; pairr p; map_it;
    loop(i,n)
    {
        cin>>x;
        m[x]++;
    }
    for(mi=m.rbegin();mi!=m.rend();mi++)
    {
        temp=mi->ss;
        if(temp>3)
        {
            sum=mi->ff;
            break;
        }
        else if(cnt==0&&temp>1)
        {
            d=mi->ff;
            cnt++;
        }
        else if(cnt==1&&temp>1)
        {
            f=mi->ff;
            break;
        }
    }
    cout<<max({sum*sum,f*d,d*sum})<<endl;


}

main()
{
    int t;
  //  cin>>t;
  //  while(t--)
        solve();
}

Measured memory_bytes: 9736
N = int(input())
a = []
a.append(2) #a[0]
a.append(1) #a[1]

temp = 0
if N >= 2:
    for i in range(2, N+1):
        temp = a[i-1] + a[i-2]
        a.append(temp)
print(a[N])

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef long long ll;

ll mod_pow(ll a, ll x, ll mod) {
    if (x == 0)
        return 1;
    if (x % 2 == 0) {
        ll tmp = mod_pow(a, x/2, mod);
        return tmp * tmp % mod;
    }
    else {
        return a * mod_pow(a, x-1, mod) % mod;
    }
}


int main() {
    ll N;   cin >> N;
    ll *A = new ll[N];

    for (int i = 0; i < N; i++)
        cin >> A[i];

    vector<ll> p(1000001);
    p[1] = 1;
    p[2] = 2;
    for (ll i = 3; i <= 1000000; i++)
        p[i] = i;
    for (ll i = 2; i * i <= 1000000; i++) {
        if (p[i] != i)
            continue;
        for (ll j = i * i; j <= 1000000; j += i)
            p[j] = i;
    }

    vector<map<ll,ll> > m(N);
    map<ll, ll> lcm;
    set<ll> fac;
    for (int i = 0; i < N; i++) {
        ll x = A[i];
        while (x > 1) {
            m[i][p[x]]++;
            fac.insert(p[x]);
            x /= p[x];
        }
        for (auto ite = m[i].begin(); ite != m[i].end(); ite++)
            lcm[(*ite).first] = max(lcm[(*ite).first], (*ite).second);
    }

    ll mod = 1e9+7;

    ll l = 1;
    for (auto ite = lcm.begin(); ite != lcm.end(); ite++) {
        for (int i = 0; i < (*ite).second; i++)
            l = l * (*ite).first % mod;
    }

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ll inv = mod_pow(A[i], mod-2, mod);
        ans += l * inv % mod;
        ans %= mod;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 14668
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()
#define var(t, ...) t __VA_ARGS__;in,__VA_ARGS__;

void Calc();
int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
template<class A>int comp(A a, A b) { return a < b ? 1 : b < a ? -1 : 0; }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

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

void Calc() {

  var(int, n, m);
  struct Data {
    int a, i, cost, pre;
    void In() {

    }
    bool operator<(const Data&d)const {
      return d.cost < cost;
    }
  };

  vector<vector<Data>> edge(n);
  rep(i, m) {
    var(int, a, b, c);
    a--, b--;
    edge[a].push_back({ b, i, c });
    edge[b].push_back({ a, i, c });
  }
  vector<int> check(m, 1);
  const int INF = 1e9 - 1;
  auto dijkstra = [&](int s) {
    vector<Data> dist(n, Data{ -1,-1, INF });
    priority_queue<Data> q;

    q.push({ s, 0, 0 });
    while (q.size()) {
      auto p = q.top(); q.pop();
      if (dist[p.a].cost != INF) continue;
      dist[p.a] = { p.a, p.i, p.cost, p.pre };

      for (auto &i : edge[p.a]) {
        if (i.cost + p.cost < dist[i.a].cost) {
          q.push({ i.a, i.i, i.cost + p.cost, p.a });
        }
      }
    }
    return dist;
  };

  rep(i, n) {
    auto dist = dijkstra(i);
    rep(j, n) if (i != j) {
      int now = j;
      while(now != i) {
        err(now, i, j, dist[now].i);
        check[dist[now].i] = 0;
        now = dist[now].pre;
      }
    }
  }
  err(check);
  cout << (accumulate(all(check), 0)) << endl;

}


Measured memory_bytes: 384
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h,w ;
        
        while(true){
            
            h = sc.nextInt();
            w = sc.nextInt();
            
            if(h == 0 && w == 0) break;
            
            for(int i = 0 ; i < h ; i++){
                for(int j = 0 ; j < w ; j++){
                    if(i == 0 || i == h-1 || j == 0 || j == w-1){
                        System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 33744
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
const long long MOD = 998244353;

int main(){
  long long n,ans=0;cin>>n;
  vector<long long> d(n,0);
  REP(i,n) cin>>d.at(i);
  if(!d.at(0)){
    sort(d.begin(),d.end());
    if(d.at(1)){
      ans=1;
      long long l=1,r=0,now=1;
      for(long long i=1;i<=d.at(n-1);i++){
        while(now<n&&d.at(now)==i){
          r++;
          now++;
        }
        REP(j,r){
          ans*=l;
          ans%=MOD;
        }
        l=r;
        r=0;
      }
    }
  }

  cout<<ans;
}

Measured memory_bytes: 1024
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD=10**9+7

r,D,x=rl()
for i in range(10):
    x = r*x-D
    print(x)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
    cin>>a>>b;
    if(a>0) cout<<"Positive";
    else if(a==0||(a<0&&b>0)) cout<<"Zero";
    else if((abs(b)-abs(a))%2!=0) cout<<"Positive";
    else cout<<"Negative";
    return 0;
}

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

int main() {
  
int64_t n;
  cin>>n;
  if(n==1){
    cout<<"0";
  }
  else if(n==2){
    cout<<"2";
  }
  else{
  int64_t ans=2,l=9,k=8,m;
  for(int i=2;i<=n-1;i++){
    l=(9*l)%1000000007;
    k=(8*k)%1000000007;
    m=(ans*10)%1000000007;
    ans=(m+2*(l-k))%1000000007;
  }
    ans=(ans+1000000007)%1000000007;
  cout<<ans<<endl;
  }
}
    
    
  
  

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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

#define ld long double
const ld pi = acos(-1.L);

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int a, b, h, m; gi(a), gi(b), gi(h), gi(m);
	ld H = h + m / 60.L;
	ld x1 = a*cos(2*pi*H/12.L), y1 = a*sin(2*pi*H/12.L);
	ld x2 = b*cos(2*pi*m/60.L), y2 = b*sin(2*pi*m/60.L);
	cout << fixed << setprecision(20) << sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) << endl;
}


Measured memory_bytes: 4192
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int sum = 0;
	for (int i = 0; i < 3; i++) {
		int tmp; cin >> tmp;
		sum += tmp;
	}
	if (sum >= 22) cout << "bust" << endl;
	else cout << "win" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long int lint;

const int NMAX = 100000 + 5;

int N;
lint A[NMAX];
lint APrim[NMAX];

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

    cin >> N;
    for (int i = 1; i <= N; ++ i)
        cin >> A[i];

    lint S = 0;
    for (int i = 1; i <= N; ++ i)
        S += A[i];

    lint onePass = N * (N + 1LL) / 2;
    if (S % onePass != 0) {
        cout << "NO\n";
        return 0;
    }

    lint passes = S / onePass;
    APrim[0] = A[N];
    for (int i = 1; i <= N; ++ i)
        APrim[i] = A[i];

    lint sumAPrim = 0;
    for (int i = N; i; -- i) {
        APrim[i] -= APrim[i - 1];
        APrim[i] -= passes;
        APrim[i] *= (-1);

        if (APrim[i] < 0 || APrim[i] % N != 0) {
            cout << "NO\n";
            return 0;
        }
        APrim[i] /= N;
        sumAPrim += APrim[i];
    }

    if (sumAPrim != passes)
        cout << "NO\n";
    else
        cout << "YES\n";
    return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
 
int devide(int N, int k){
  while(N%k==0){
    N=N/k;
    printf(" %d",k);
  }
  return N;
}

int main(){
  int N,k=3;
  scanf("%d",&N);
  printf("%d:",N);
  N=devide(N,2);
  while(N>1){
    if(N<k*k){
      printf(" %d",N);
      N=1;
    }else{
      N=devide(N,k);
      k+=2;
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 600