akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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")
    };
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

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

#[allow(unused)]
fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x
    } else {
        gcd(y, x % y)
    }
}

#[allow(unused)]
fn lcm(x: i64, y: i64) -> i64 {
    x * y / gcd(x, y)
}

fn main() {
    input! {
        // usize
        // n: usize,
        // vec
        // v: [i64; n],
        n: usize,
        w: [i64; n],
    }

    let mut ans = 10000000;

    for i in 0..n {
        let suma: i64 = w[0..i].iter().sum();
        let sumb: i64 = w[i..n].iter().sum();
        let tmp = (suma - sumb).abs();
        ans = if tmp < ans { tmp } else { ans };
    }

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


Measured memory_bytes: 4352
# Aizu Problem 0024: Physical Experiments
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


for line in sys.stdin:
    v_crack = float(line)
    y = v_crack**2 * 4.9 / 9.8**2
    N = y / 5 + 1
    print(math.ceil(N))

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

int main(void)
{
    int i;

    int cards;
    scanf("%d", &cards);

    int pnt_t = 0, pnt_h = 0;
    char card_t[101], card_h[101];
    for (i = 1; i <= cards; i++) {
        scanf("%s %s", card_t, card_h);
        int cmp = strcmp(card_t, card_h);
        if (cmp > 0) {
            pnt_t += 3;
        } else if (cmp < 0) {
            pnt_h += 3;
        } else {
            pnt_t++;
            pnt_h++;
        }
    }

    printf("%d %d\n", pnt_t, pnt_h);

    return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

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

	ll N ;
	vector<ll> A;
	cin >> N;
	vector<ll> B;
	rep(i,N){
		ll inp;
		cin >> inp;
		A.pb(inp);
	}

	rep(i, N){
		B.pb(abs((N-(i+1) - i)));
	}
	sort(all(A));
	sort(all(B));

	rep(i,N){
		if(A[i] != B[i]){
			cout << 0 << endl;
			return 0;
		}
	}

	map<ll,ll> cnt;
	rep(i,N){
		cnt[A[i]] ++;
	}

	rmsame(A);

	ll ans = 1;
	rep(i,A.size()){
		ans *= cnt[A[i]];
		ans %= 1000000007;
	}
	cout << ans << endl;

	//cout << fixed << setprecision(16) << ans << endl;
	return 0;
}


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


int n, m;
int x[100005], y[100005];
int num[100005];
bool red[100005];
int main()
{
	std::cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		std::cin >> x[i] >> y[i];
		--x[i], --y[i];
	}

	std::fill(num, num + n, 1);
	red[0] = true;
	for (int i = 0; i < m; ++i) {
		if (red[x[i]])
			red[y[i]] = true;
		--num[x[i]], ++num[y[i]];
		if (num[x[i]] == 0)
			red[x[i]] = false;
	}

	int ans = 0;
	for (int i = 0; i < n; ++i)
		if (red[i])
			++ans;

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


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

#define int long long 
#define dou double 
#define endl "\n"

const int MOD=1e9+7;

void solve()
{
	int x,n,b;
	string str;
	cin >> n;
	while(n!=0)
	{
		x = n%26;
		//cout << x << endl;
		if(x==0)
		{
			n--;
			b=25;
		}
		else
			b=-1;
		str.push_back(x+'a'+b);
		n = n/26;
	}
	reverse(str.begin(),str.end());
	cout << str << endl;

}

main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	solve();
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  double r = 0;
  for (; n > 0; n--) {
    int a;
    cin >> a;
    r += 1.0 / a;
  }
  cout << fixed << setprecision(6) << 1.0 / r << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

ll md = (ll)1e9 + 7;

int main()
{
	int N;
	cin >> N;
	
	vector<int> mp(101, 0);
	for (int i = 1; i <= 9; ++i) {
		for (int j = 1; j <= 9; ++j) {
			mp[i * j] = 1;
		}
	}

	if (mp[N] == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3616
def partition(A, p, r):
    COLUMN_SORT = 1

    global flag_stable

    x = A[r][COLUMN_SORT]
    i = p - 1

    for j in range(p, r):
        if A[j][COLUMN_SORT] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]

    q = i + 1
    A[q], A[r] = A[r], A[q]

    for i in range(q + 1, r):
        if A[r] > A[i]:
            flag_stable = False

    return q


def quicksort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quicksort(A, p, q-1)
        quicksort(A, q+1, r)


# INPUT
n = int(input())

list_card = []
for _ in range(n):
    suit, num = input().split()
    list_card.append([suit, int(num)])


# PROCESS
flag_stable = True

quicksort(list_card, 0, n-1)


# OUTPUT
if flag_stable:
    print("Stable")
else:
    print("Not stable")

for card in list_card:
    print(*card)



Measured memory_bytes: 18052
#include<bits/stdc++.h>
#define maxn 120000
using namespace std;
const long long MOD = 1000000007;
char S[maxn];
long long A[2], B[3], C[4], Q;
long long power(long long a, long long r){
	long long result = 1;
	for(long long i = 0; i < r; i += 1){
		result = result * a % MOD;
	}
	return result;
}
int main(){
	scanf("%s", S);
	int n = strlen(S);
	for(int i = 0; i < n; i += 1){
		if(S[i] == 'A'){
			A[0] += 1;
		}
		if(S[i] == 'B'){
			B[0] += A[0];
			B[1] += A[1];
		}
		if(S[i] == 'C'){
			C[0] += B[0];
			C[1] += B[1];
			C[2] += B[2];
		}
		if(S[i] == '?'){
			C[1] += B[0];
			C[2] += B[1];
			C[3] += B[2];
			B[1] += A[0];
			B[2] += A[1];
			A[1] += 1;
			Q += 1;
		}
		//printf("%lld %lld\n%lld %lld %lld\n%lld %lld %lld %lld\n", A[0], A[1], B[0], B[1], B[2], C[0], C[1], C[2], C[3]);
	}
	long long ans = 0;
	ans = (ans + C[0] % MOD * power(3, Q) % MOD);
	ans = (ans + C[1] % MOD * power(3, Q - 1) % MOD);
	ans = (ans + C[2] % MOD * power(3, Q - 2) % MOD);
	ans = (ans + C[3] % MOD * power(3, Q - 3) % MOD);
	printf("%lld", ans % MOD);
}

Measured memory_bytes: 384
public class Main {
		 
		public static void main(String[] args) {
	 
			java.util.Scanner scan = new java.util.Scanner(System.in);
		
		
			long x = scan.nextLong();
			long m = 100;
			
			for(int i = 1 ; m < x; i++) {
				m = m / 100 + m ;
				if (m >= x) {
					System.out.println(i);
				}
			}
	 
		}
	 
	}


Measured memory_bytes: 35836
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
//#define int long long
#define D double
#define inf 123456789
#define mod 1000000007
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
#define rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; ++ i)
#define drep(i , b , a) for(int i = (a) , i##Limit = (b) ; i >= i##Limit ; -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define lb(x) (x)&(-(x))
#define ls k * 2
#define rs k * 2 + 1
#define maxn 2333
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
int n, m, c;
int main() {
	n = read(), m = read(), c = read();
	m = max(n, m);
	printf("%d", (int)(ceil((D)c / (D)m)));
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <map>

using namespace std;

typedef signed long long ll;

int main(void)
{
    char a, b, c, d, e, f;

    cin >> a >> b >> c;
    cin >> d >> e >> f;

    if (a == f && b == e && c == d)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=1;i<=n;i++)
using namespace std;
const double PI=3.14159265358979323846;
int main(){
    double a,b; cin >> a >> b;
    double x; cin >> x;
    double tan,ans;
    if(a<b){
        if(a*a*b < 2*x){
            tan=(double)(2*(a*a*b-x)/(a*a*a));
            ans = atan(tan);
            ans *= 180.00000000000;
            ans/=PI;
        }else{
            tan = (double)(2*x/(a*b*b));
            ans = atan(tan);
            ans *= 180.00000000000;
            ans/=PI;
            ans = 90-ans;
        }
    }
    else{
        if(a*a*b > 2*x){
            tan = (double)(2*x/(a*b*b));
            ans = atan(tan);
            ans *= 180.00000000000;
            ans/=PI;
            ans = 90-ans;
        }else{
            tan=(double)(2*(a*a*b-x)/(a*a*a));
            ans = atan(tan);
            ans *= 180.00000000000;
            ans/=PI;
        }
    }
    cout << setprecision(12) <<  ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(){
    ll i=1;
    while(1){
        ll x;cin>>x;
        if(x==0)return;
        cout<<"Case "<<i++<<": "<<x<<endl;
    }
}

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



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int keta_goukei(int x) {
  int ret_val=0;
  while (0<x) {
    ret_val+=x%10;
    x/=10;
  }
  return ret_val;
}

int main() {
  int N,A,B; cin >>N >>A >>B;
  int ans=0;
  rep_eq(i,1,N) {
    int temp=keta_goukei(i);
    if (A<=temp and temp<=B) ans+=i;
  }
  cout <<ans <<endl;
  return 0;
}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int antenas[5], k;
    rep(0, 5) cin >> antenas[i];
    cin >> k;

    bool impossible = false;
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 5; j++) {
            if (i != j && (antenas[j] - antenas[i] > k)) {
                impossible = true;
                break;
            }
        }
    }

    cout << (impossible ? ":(" : "Yay!") << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

def main():
    N,M,P = map(int,input().split())
    
    def BellmanFord(edges,v,source):
        INF = float("inf")
        dist = [-INF for _ in range(v)]
        dist[source-1] = 0
        for i in range(2*v+1):
            for now,fol,cost in edges:
                b = dist[v-1]
                if (dist[now] != -INF and dist[fol]<dist[now]+cost):
                    dist[fol] = dist[now]+cost
                    if i > v-1:
                        dist[fol] = INF
        if dist[N-1] == INF:
            return -1
        else:
            return max(0,dist[N-1])
    
    edges = []
    for _ in range(M):
        a,b,c = map(int,input().split())
        edges.append((a-1,b-1,c-P))
    
    print(BellmanFord(edges,N,1))

if __name__ == "__main__":
    main()


Measured memory_bytes: 43100
#include "bits/stdc++.h"
using namespace std;
int deg[10];

int main(int argc, char const *argv[])
{
	long long K, A, B;
	cin >> K >> A >> B;
	long long ans = 1;
	if(A+1 < B) {
		ans += min(K, A-1);
		K -= min(K, A-1);
		if(K&1) {
			ans += (K/2) * (B-A);
			ans += 1;
		} else {
			ans += (K/2) * (B-A);
		}
	} else {
		ans += K;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        String[] strArray = str.split("");
        Map<String,Integer> map = new HashMap<>();
        for(String s: strArray){
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        }

        if(map.size() == 2) System.out.println("Yes");
        else System.out.println("No");
    }
}


Measured memory_bytes: 21204
# include<iostream>
# include<queue>
# include<stack>
# include<algorithm>
# include<cmath> 
# include<cstring>
# include<map>
# include<iomanip>
using namespace std;
const int INF =pow(10,9)+7;
int a[1000000];

struct P{
	int x,y;
};
bool cmp(P a,P b)
{
	 return 1;
}

void update(int a,int b,int k,int l,int r)
{
	 
}
double sum(int i)
{
	 double s=1.0*(i+1)/2;
	 return s;
}
int cal(string s)
{
	 int l =s.length();
	 return s[0]-'0'+(l-1)*9;
}
int cal1(string s)
{
	int l =s.length();
	int sum =0;
	for(int i=1;i<l;i++)
	{
		 if(s[i]-'0'>0)
		 {
		 	  sum+=s[i]-'0';
		 	  for(int j=i+1;j<l;j++)
		 	  sum+=9;
		 	  break;
		 }
	}
	return (l-1)*(l-2)*9*9/2+(s[0]-'0'-1)*9*(l-1)+sum;
}

int cal4(int N)
{
	 int s=0;
	 for(int i=1;i<=N;i++)
	 {
	 	s+=i*(i+1)/2;
	  } 
	  
	  return s;
} 

int cal3(string s)
{
	 int l = s.length();
	 string s1 = "";
	 for(int i=1;i<l;i++)
	 {
	 	 if(s[i]!='0')
	 	 {
	 	 	for(int j=i;j<l;j++)
	 	 	s1+=s[j];
	 	 	break;
		  }
		 else if(i==l-1)
		 {
		 	s1+=s[i];
		  } 
	 }
	 
	
	 
	 
	return 9*9*9*cal4(l-3)+(s[0]-'0'-1)*9*9*(l-1)*(l-2)/2+cal1(s1);
}

int main ()
{
	 int t=1;
	 //cin>>t;
	 while(t>0)
	 {
	 	  t--;
	      string N;
		  cin>>N;
		  int K;
		  cin>>K; 
		  if(K==1)
		  cout<<cal(N)<<endl;
		  else if(K==2)
		  cout<<cal1(N)<<endl;  
		  else
		  cout<<cal3(N)<<endl;
	 }
    	
	return 0;
}

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

int n,m,head[100005],nxt[200005],pnt[200005],E = 0,sz[100005],s,t,ans = 0,k[100005];
bool odd = 0;
std::vector<int> v;

void add_edge(int u,int v)
{
	pnt[E] = v;
	nxt[E] = head[u];
	head[u] = E++;
}

void dfs1(int u,int fa)
{
	for (int i = head[u]; i != -1; i = nxt[i])
	{
		int v = pnt[i];
		if (v == fa) continue;
		if (sz[v])
		{
			if (sz[v] == sz[u]) odd = 1;
			s = u;
			t = v;
		}
		else
		{
			sz[v] = -sz[u];
			dfs1(v,u);
		}
	}
}

void dfs2(int u,int fa)
{
	for (int i = head[u]; i != -1; i = nxt[i])
	{
		int v = pnt[i];
		if (v == fa) continue;
		if (v == s && u == t) continue;
		if (v == t && u == s) continue;
		dfs2(v,u);
		sz[u] += sz[v];
		k[u] += k[v];
	}
}

signed main()
{
	memset(head,-1,sizeof(head));
	memset(sz,0,sizeof(sz));
	scanf("%lld%lld",&n,&m);
	for (int i = 1; i <= m; i++)
	{
		int u,v;
		scanf("%lld%lld",&u,&v);
		add_edge(u,v);
		add_edge(v,u);
	}
	sz[1] = 1;
	dfs1(1,0);
	int sum = 0;
	for (int i = 1; i <= n; i++)
	{
		sum += sz[i];
	}
	if (m == n - 1)
	{
		if (sum)
		{
			puts("-1");
			return 0;
		}
	}
	else
	{
		if (odd)
		{
			if (sum & 1)
			{
				puts("-1");
				return 0;
			}
			ans += abs(sum >> 1);
			sz[s] -= sum >> 1;
			sz[t] -= sum >> 1;
		}
		else
		{
			if (sum)
			{
				puts("-1");
				return 0;
			}
			k[s] = 1;
			k[t] = -1;
		}
	}
	dfs2(1,0);
	for (int i = 1; i <= n; i++)
	{
		if (k[i]) v.push_back(k[i] * sz[i]);
		else ans += abs(sz[i]);
	}
	v.push_back(0);
	sort(v.begin(),v.end());
	int len = v.size();
	int mid = v[(len + 1) >> 1];
	for (int i = 0; i < len; i++)
	{
		ans += abs(v[i] - mid);	
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 17480
'use strict';
var NS = {};
function addProps(ns) {
    var isBrowser = function() {
        return typeof window !== 'undefined';
    }
    ns.isBrowser = isBrowser;
    
    var isNodejs = function() {
        return ! isBrowser();
    }
    ns.isNodejs = isNodejs;
    
    if (isBrowser()) {
        var getHtmlEncoded = function(string0) {
            return String(string0)
                    .replace(/&/g, '&amp;')
                    .replace(/"/g, '&quot;')
                    .replace(/'/g, '&#39;')
                    .replace(/</g, '&lt;')
                    .replace(/>/g, '&gt;');
        }
        ns.getHtmlEncoded = getHtmlEncoded;
        
        var outputCode = function() {
            document.getElementById('code').innerHTML = '<pre><code>' + getHtmlEncoded(addProps) + '</code></pre>';
        }
        ns.outputCode = outputCode;
    }
    
    var getInput = function() {
        var inputLines = [];
        if (isBrowser()) {
            var html = document.getElementById('input').innerHTML;
            inputLines = html.split('<br>');
        }
        if (isNodejs()) {
            inputLines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split('\n');
        }
        return inputLines;
    }
    
    var doOutput = function(outputLines) {
        if (isBrowser()) {
            document.getElementById('output').innerHTML = outputLines.map(getHtmlEncoded).join('<br>\n');
        }
        if (isNodejs()) {
            for (var i = 0; i < outputLines.length; i++) {
                console.log(outputLines[i]);
            }
        }
    }
    ns.doOutput = doOutput;
    
    var getNthPower = function(r, n) {
        var power = 1;
        for (var i = 0; i < n; i++) {
            power *= r;
        }
        return power;
    }
    var getArea = function(a, b) {
        return a * b;
    }
    var getCircumference  = function(a, b) {
        return a + b + a + b;
    }
    
    var main = function() {
        var inputLines = getInput();
        var line0 = inputLines[0];
        var numStrings = line0.split(' ');
        var nums = [];
        for (var i = 0; i < numStrings.length; i++) {
            nums.push(Number(numStrings[i]));
        }
        var a = nums[0];
        var b = nums[1];
        var area = getArea(a, b);
        var circumference = getCircumference(a, b);
        var outputLine0 = area + ' ' + circumference;
        doOutput([outputLine0]);
    }
    ns.main = main;
}
addProps(NS);
if (NS.isBrowser()) {
    window.onload = function() {
        NS.outputCode();
    }
}
NS.main();

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

using namespace std;

#define ll long long
#define sf scanf
#define pf printf 
#define nl printf("\n")
#define pi acos(-1)

int main()
{
    #ifndef ONLINE_JUDGE
        //freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
    #endif

    long double r;
    while(cin>>r){
        pf("%Lf\n",(2*pi*r));
    }
    return 0;
}

Measured memory_bytes: 3792
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <cstdlib>  // abs() for integer
#include <iomanip>
#include <cmath>    // abs() for float, and fabs()
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
using namespace std;

int main() {
  int A, B, H, M;
  double ans = 0 ;
  double min1, deglee1,deglee2, min2, X, coos,pi;
  cin >> A >> B >> H >> M;
  min1 = M * 6;
  min2 = H * 30 + M * 0.5;
  deglee1 = abs(min1 - min2);
  deglee2 = 360 - deglee1;
  X = min(deglee1, deglee2);
  pi = 3.14159265358979323846;
  coos = cos (pi * X / 180);
  ans = (A*A + B*B -  2* A* B * coos);
  
  cout << setprecision(11) << pow(ans, 0.5) << endl;
  
  
  
  
  
  

        
  
}


Measured memory_bytes: 4284
function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    let N = parseInt(input[0][0], 10);
    let W = parseInt(input[0][1], 10);
    let arr_wv = [];
    for (let i = 0; i < N; i++){
        arr_wv.push(input[i + 1].map(e => parseInt(e, 10)));
    }
    
    let DP = [Array.from({length: 1e3 * N + 1}, () => Infinity)];
    DP[0][0] = 0;
    let tmpline;
    for (let i = 0; i < N; i++){
        tmpline = arr_wv[i];
        DP.push([]);
        for (let j = 0; j < tmpline[1]; j++){
            DP[i + 1].push(DP[i][j]);
        }
        for (let j = tmpline[1]; j < DP[0].length; j++){
            DP[i + 1].push(Math.min(DP[i][j],  DP[i][j - tmpline[1]] + tmpline[0]));
        }
    }

    let x = DP.pop();
    let ans = 0;
    for (let i = x.length - 1; i >= 0; i--){
        if (x[i] <= W) {
            ans = i;
            break;
        }
    }
    console.log(ans);
}


Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 142236
#include<iostream>
using namespace std;
int main(void)
{
	int n;
	cin>>n;
	int rem1, rem2, rem3;
    while(1)
    {
    	rem1=(n%10);
    	rem2=((n/10)%10);
    	rem3=((n/100)%10);
    	if(rem1==rem2 && rem2==rem3)
    		break;
    	else
    		n++;
    }
    cout<<n<<endl;




	return 0;
}

Measured memory_bytes: 256
from itertools import groupby
s=input()
if s[0]=='>':
  s='<'+s
g=groupby(s)
a=[]
for i,j in g:
  a.append(len(list(j)))
def sum(n):
  return n*(n+1)//2
x=0
if len(a)%2==1:
  a+=[1]
for i in range(0,len(a),2):
  x+=sum(min(a[i],a[i+1])-1)
  x+=sum(max(a[i],a[i+1]))
print(x)


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

int main() {
    string s; cin >> s;
    int n = s.size();

    vector<vector<int>> nxt(n + 1, vector<int> (26, n));

    for(int i = n - 1; i >= 0; --i) {
        for(int j = 0; j < 26; ++j) {
            nxt[i][j] = nxt[i + 1][j];
        }
        nxt[i][s[i] - 'a'] = i;
    }

    vector<int> dp(n + 1, 0);

    for(int i = n - 1; i >= 0; --i) {
        int maxx = 0;
        for(int j = 0; j < 26; ++j) {
            maxx = max(maxx, nxt[i][j]);
        }
        if(maxx < n) {
            dp[i] = dp[maxx + 1] + 1;
        }
    }

    int len = dp[0] + 1;
    int poz = 0;
    
    string ans = "";
    
    while(len)  {
        for(int j = 0; j < 26; ++j) {
            if(nxt[poz][j] == n or (nxt[poz][j] < n and dp[nxt[poz][j] + 1] < len - 1)) {
                ans += ('a' + j);
                poz = nxt[poz][j] + 1;
                break;
            }
        }
        len -= 1;
    }

    cout << ans << "\n";
}

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


int main() {
  int N, M;
  cin >> N >> M;
  dsu d(N);
  // vector<vector<int>> mat(N, vector<N>(0));
  for (int i = 0; i < M; ++i) {
    int ai, bi;
    cin >> ai >> bi;
    // ++mat.at(ai-1).at(bi-1);
    d.merge(ai - 1, bi - 1);
  }
  vector<vector<int>> gs = d.groups();
  cout << gs.size() - 1 << endl;
}


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

typedef long long ll;

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

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

const int MOD = 1e9 + 7;
const char nl = '\n';

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	// freopen("input.in", "r", stdin);
	// freopen("input.out", "w", stdout);
	ll n; cin >> n;
	ll ans = 0, sum = 0;
	vector<ll> a(n);
	F0R(i, n) {
		cin >> a[i];
		ans = (ans + a[i] * sum) % MOD;
		sum = (sum + a[i]) % MOD;
	}
	cout << ans << nl;
}

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

#define gc( ) std::getchar( )
#define pc( i ) std::putchar( i )
#define space ' '
#ifdef ONLINE_JUDGE
#define enter '\n'
#else
#define enter std::endl
#endif
#define RE cout << "Passing [" << __FUNCTION__ << "] on " << __LINE__ << enter
#define DEBUG(...) for( auto &i: __VA_ARGS__ ) cout << i << " "; cout << enter
using std::make_pair;

template < typename T >
inline T read( )
{
 T x = 0;
 char ch = gc( );
 bool f = 0;
 while( !std::isdigit( ch ) )
 {
  f = ( ch == '-' );
  ch = gc( );
 }
 while( std::isdigit( ch ) )
 {
  x = x * 10 + ( ch - '0' );
  ch = gc( );
 }
 return f ? -x : x;
}

template < typename T >
void print( T x )
{
 if( x < 0 )
 {
  x = -x;
  pc( '-' );
 }
 if( x < 10 )
 {
  pc( x + 48 );
  return;
 }
 print < T > ( x / 10 );
 pc( x % 10 + 48 );
 return ;
}

namespace Solution
{
#define IOS std::ios::sync_with_stdio( false ), std::cin.tie( 0 ), std::cout.tie( 0 )
#define Rep( i, j, k ) for( int i = j; i >= k; --i )
#define rdi( ) read < int > ( )
#define rdl( ) read < long long > ( )
#define pti( i ) print < int > ( i ), putchar( space )
#define ptl( i ) print < long long > ( i ), putchar( space )
#define For( i, j, k ) for( int i = j; i <= k; ++i )
 using std::cin;
 using std::cout;
 using std::endl;
 using std::vector;
 using std::map;
 using std::queue;
 using std::deque;
 using std::set;
 using std::pair;
 const int N = 204001, mod = 1e9 + 7;
 long long x, k, d;
 long long abs( long long x )
 {
  return x < 0 ? -x : x;
 }
 void Fakemain( )
 {
  x = rdl( );
  k = rdl( );
  d = rdl( );
  long long I = abs( x ) / d;
  if( I >= k )
  {
   printf( "%lld", abs( x ) - k * d );
   return;
  }
  k -= I;
  x = abs( x );
  x -= I * d;
  if( k & 1 )
   printf( "%lld", abs( abs( x ) - d ) );
  else
   printf( "%lld", abs( x ) );
  return;
 }

} // namespace Solution

int main( int argc, char* argv[] )
{
 Solution::Fakemain( );
 return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int ans=0,f=1;char chr=getchar();
	while(!isdigit(chr)){if(chr=='-')f=-1;chr=getchar();}
	while(isdigit(chr)) {ans=(ans<<3)+(ans<<1)+chr-48;chr=getchar();}
	return ans*f;
}const int M = 2E3+5;
int a[M],n,ans,s[M];
#define lowbit(x) (x&-x)
inline void add(int x,int y){for(;x<=M-1;x+=lowbit(x))s[x]+=y;}
inline int ask(int x){int ans=0;for(;x;x-=lowbit(x))ans+=s[x];return ans;}
signed main(){
	n=read();
	for(int i=1;i<=n;i++)a[i]=read(),add(a[i],1);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++){
			int x=min(a[i],a[j]),y=max(a[i],a[j]);
			int minn=y-x+1,maxn=y+x-1;
			if(x>=minn&&x<=maxn)--ans;
			if(y>=minn&&y<=maxn)--ans;
			ans+=ask(maxn)-ask(max(0ll,minn-1));
		}cout<<ans/3;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

const ll inf = 1LL << 50;

struct node{
    ll r, c, n;
};

ll R, C;
int N;
vector<ll> row, col;
vector<vector<node>> GR, GC;

ll row_min, col_min;
void dfs(node nd){
    ll r = nd.r, c = nd.c, n = nd.n;
//    cout << r << "," << c << "," << n << endl;
//    cout << row[r] << "," << col[c] << endl;
    if(row[r] == inf && col[c] == inf){
        row[r] = n, col[c] = 0;
        row_min = min(row_min, row[r]);
        col_min = min(col_min, col[c]);
    }
    else if(row[r] == inf){
        row[r] = n - col[c];
        row_min = min(row_min, row[r]);
        col_min = min(col_min, col[c]);
    }
    else if(col[c] == inf){
        col[c] = n - row[r];
        row_min = min(row_min, row[r]);
        col_min = min(col_min, col[c]);
    }
    else {
        row_min = min(row_min, row[r]);
        col_min = min(col_min, col[c]);
        return;

    }
    for(node nr: GR[r]){
        dfs(nr);
    }
    for(node nc: GC[c]){
        dfs(nc);
    }

}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    cin >> R >> C >> N;
    row.resize(R + 1, inf), col.resize(C + 1, inf);
    GR.resize(R + 1), GC.resize(C + 1);
    
    rep(i, N){
        ll r, c, a;
        cin >> r >> c >> a;
        GR[r].pb({r, c, a});
        GC[c].pb({r, c, a});
    }
    
    rep(i, R + 1){
        row_min = inf, col_min = inf;
        if(GR[i].size()){
            for(node nd: GR[i]){
                dfs(nd);
            }
        }
//        cout << row_min + col_min << endl;
        if(row_min + col_min < 0){
            output("No");
            return 0;
        }
    }
    rep(i, C + 1){
        row_min = inf, col_min = inf;
        if(GC[i].size()){
            for(node nd: GC[i]){
                dfs(nd);
            }
        }
//        cout << row_min + col_min << endl;
        if(row_min + col_min < 0){
            output("No");
            return 0;
        }
    }
    
    rep(i, R + 1){
        for(node nd: GR[i]){
//            cout << row[nd.r] << "," << col[nd.c] << "," << nd.n << endl;
            if(row[nd.r] + col[nd.c] != nd.n){
                output("No");
                return 0;
            }
        }
    }
    
    output("Yes");

    
    
    return 0;
}

Measured memory_bytes: 22528
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<usize>()[0];

    let h = read_as_vec::<u64>();

    let mut i = 0;
    let mut cur_max = 0;
    loop{
        let mut tmp_max = 0;
        while i+1 < n && h[i] >= h[i+1]{
            tmp_max += 1;
            i += 1;
        }
        cur_max = cmp::max(cur_max, tmp_max);
        i += 1;
        if i+1 >= n{
            break;
        }
    }

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


Measured memory_bytes: 8444
def resolve():
    N, K = list(map(int, input().split()))
    h = [int(input()) for _ in range(N)]
    ans = 10 ** 10
    h.sort()

    for i in range(N - K + 1):
        res = h[i+K-1] - h[i]
        ans = min(ans, res)
    print(ans)
    return


resolve()


Measured memory_bytes: 13208
N = int(input())
D, X = map(int, input().split())
A = [int(input()) for _ in range(N)]


def f(a, D):
    i = 0
    while i * a + 1 <= D:
        i += 1
    return i


consumed = 0
for a in A:
    consumed += f(a, D)
print(X + consumed)


Measured memory_bytes: 38512
using System;
using System.Collections.Generic;
using System.Linq;

class Progaram
{
    static void Main(string[] args)
    {
        var n = Int64.Parse(Console.ReadLine());
        var ts = new List<Int64>();
        ts.Add(Int64.Parse(Console.ReadLine()));
        ts.Add(Int64.Parse(Console.ReadLine()));
        ts.Add(Int64.Parse(Console.ReadLine()));
        ts.Add(Int64.Parse(Console.ReadLine()));
        ts.Add(Int64.Parse(Console.ReadLine()));
        var tm = ts.Min();
        Console.WriteLine(4 + ((n % tm == 0) ? n / tm : n / tm + 1));
    }
}


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

#define ll long long
#define y1 caibictq
#define P pair<int, int>
#define fi first
#define se second

using namespace std;

const int MAXN = 200010;
const int MAXM = 100010;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int n, m, k;
int tot, cnt, ans;

int read() {
	int f = 1, s = 0;
	char ch = getchar();
	while ('0' > ch || ch > '9') {if (ch == '-') f = -1; ch = getchar();}
	while ('0' <= ch && ch <= '9') {s = (s << 1) + (s << 3) + ((int)ch ^ 48); ch = getchar();}
	return s * f;
}

int a[MAXN], b[MAXN];

string s;

int check(int x, int y, int z) {
	if (a[x] + a[y] > a[z] && a[y] + a[z] > a[x] && a[z] + a[x] > a[y]) return 1;
	else return 0;
}

int main() {
	int T;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			for (int k = j + 1; k <= n; k++) {
				if (i != j && j != k && k != i && a[i] != a[j] && a[j] != a[k] && a[k] != a[i]) 
				if (check(i, j, k)) ++ans;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}


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

int main(void) {
  char s[11];
  cin >> s;
  char t[11]; int j = 0;
  
  for (int i = 0; i < 11; i++) {
    if(s[i] == 'B') {
      if (j > 0) 
      t[--j] = ' ';
      else 
      ;
    } else {
      t[j++] = s[i];
    }
  }
  cout << t << endl;
}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int cnt[100001];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;

    long long sum = 0;
    for (int i=0; i<n; i++) {
        int a;
        cin >> a;
        sum += a;
        cnt[a]++;
    }

    int q;
    cin >> q;
    while (q--) {
        int b, c;
        cin >> b >> c;
        sum += (long long) cnt[b] * (c - b);
        cnt[c] += cnt[b];
        cnt[b] = 0;
        cout << sum << "\n";
    }

    return 0;
}


Measured memory_bytes: 3984
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var str=(input.trim()).replace(/gg|hicken/g,"");
while(/ee/.test(str))str=str.replace(/ee/g,"eAe");
while(/cc/.test(str))str=str.replace(/cc/g,"cAc");
var ary=str.split("A");
var ans="";
ary.forEach(function(v){
   if(ans.length<v.length)ans=v;
});
console.log((ans.slice(-1)=="e")?"egg":"chicken");

Measured memory_bytes: 15884
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 0x3f //plus infinite

typedef struct item{
  string name;
  int number;
  int money;
}item;

string s[102],t[102];
item obj[102];


int main(){
  int x,y,z;
  cin >> x >> y >> z;
  int tmp = y;
  y = x;
  x = tmp;
  tmp = z;
  z = x;
  x = tmp;
  cout << x << " "<< y << " " << z  << " "<< endl;
  
}

/*文字列の辞書順について
 *C++の順序では'0'～'9'→'A'～'Z'→'a'～'z'の順に
 *                       なっていることに注意しましょう。
 */

/*行単位での入力
 * getline(cin,文字列変数);
 */


Measured memory_bytes: 256
#!/usr/bin/env python3
# coding: utf-8

import sys

def main():
    s1 = input()
    s2 = input()
    count = 0 # 文字列の操作を行った回数を記録する

    while True:
        if count == len(s2):
            break
        if s1 == s2:
            print("Yes")
            break
        s2 = s2[-1:] + s2[0:-1]
        count = count + 1

    if count == len(s2):
        print("No")

    return 0

if __name__ == "__main__":
    sys.exit(main())


Measured memory_bytes: 3060
// youngjinp20
// 2020 03

#include <bits/stdc++.h>
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; }
#define byr(x) [](const auto& a, const auto& b) { return a.x > b.x; }
#define smax(a, b) ((a) < (b) ? ((a)=(b), true) : false)
#define smin(a, b) ((a) > (b) ? ((a)=(b), true) : false)
using namespace std;

typedef long long ll;

const int MAX = 1e5 + 1;
int N, M;
int dp[MAX];
vector<int> G[MAX];

int solve(int i) {
	if (dp[i]) return dp[i];
	int best = 0;
	for (auto e:G[i]) {
		smax(best, solve(e));
	}
	return dp[i] = best + 1;
}

int main() {
	cin >> N >> M;
	for (int i=0; i<M; i++) {
		int x, y;
		cin >> x >> y;
		G[x].push_back(y);
	}

	int best = 0;
	for (int i=1; i<=N; i++) {
		smax(best, solve(i));
	}

	cout << best-1;

	return 0;
}


Measured memory_bytes: 8192
#include<string.h>
#include<math.h>
 
int main(){
   int count=0;
   char str[101];
   scanf("%s",str);
   int len=strlen(str);
   for(int i=0;i<len;i++) {
    if(str[i]!=str[len-i-1]) count++;    
   }
   printf("%d\n", count/2);
   return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,arr[100009],dp[100009];

int main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    dp[0]=INT_MAX;
    dp[1]=0;
    dp[2]=abs(arr[0]-arr[1]);
    for(int i=3;i<=n;i++){
        ll ya=dp[i-2]+abs(arr[i-1]-arr[i-3]);
        ll yo=dp[i-1]+abs(arr[i-1]-arr[i-2]);
        dp[i]=min(ya,yo);
    }
    /*
    for(int i=1;i<=n;i++){
        cout<<dp[i]<<' ';
    }
    cout<<endl;
    */
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1792
import sys
s=sys.stdin.readline
while 1:
 n=int(s())
 if n==0:break
 d={}
 for _ in[0]*n:
  k,v=s().strip().split()
  d[k]=v
 print(''.join(d.get(*[s().strip()]*2)for _ in[0]*int(s())))


Measured memory_bytes: 7108
def examB():
    N = I()
    SN = 0
    for i in str(N):
        SN += int(i)
    if N%SN==0:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()


Measured memory_bytes: 3444
import sys
sys.setrecursionlimit(10**5)

def expsq(n,k):
    global mod

    if k==0:
        return 1
    elif k%2==0:
        return pow(expsq(n,k/2),2,mod)
    else:
        return expsq(n,k-1)*n%mod

m,n=map(int,input().split())
mod=10**9+7
print(expsq(m,n)%mod)  

Measured memory_bytes: 7736
n=int(input())
l=list(map(int,input().split()))
if(0 in l):
	print(0)
else:
	c=False
	ans=1
	for i in range(n):
		ans=ans*l[i]
		if(ans>10**18):
			c=True
			break
		else:
			continue
	if(c):
		print(-1)
	else:
		print(ans)

Measured memory_bytes: 87852
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

template<ll mod> struct Mod_Int{
    ll x;
    Mod_Int() {}
    Mod_Int(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod){}

    Mod_Int &operator += (const Mod_Int &p) {
        x = (x + p.x) % mod;
        return *this;
    }

    Mod_Int &operator -= (const Mod_Int &p) {
        x = (x + mod - p.x) % mod;
        return *this;
    }

    Mod_Int &operator *= (const Mod_Int &p) {
        x = (x * p.x) % mod;
        return *this;
    }

    Mod_Int &operator /= (const Mod_Int &p) {
        *this *= p.inverse();
        return *this;
    }

    Mod_Int operator -() const {return Mod_Int(-x);}

    Mod_Int operator + (const Mod_Int &p) const {return Mod_Int(*this) += p;}

    Mod_Int operator - (const Mod_Int &p) const {return Mod_Int(*this) -= p;}

    Mod_Int operator * (const Mod_Int &p) const {return Mod_Int(*this) *= p;}

    Mod_Int operator / (const Mod_Int &p) const {return Mod_Int(*this) /= p;}

    bool operator == (const Mod_Int &p) const {return x == p.x;}

    bool operator != (const Mod_Int &p) const {return x != p.x;}

    Mod_Int pow(ll n) const{
        Mod_Int now = *this, ret = 1;
        while(n > 0){
            if(n & 1) ret *= now;
            now *= now, n >>= 1;
        }
        return ret;
    }

    Mod_Int inverse() const{
        return pow(mod-2);
    }
};

using mint = Mod_Int<MOD>;
const int MAX_N = 3e5;
mint fac[MAX_N+1];

void init(){
    fac[0] = {1};
    rep2(i, 1, MAX_N){
        fac[i] = fac[i-1]*mint(i);
    }
}

mint comb(mint n, mint k){
    return fac[n.x]/(fac[n.x-k.x]*fac[k.x]);
}

mint perm(mint n, mint k){
    return fac[n.x]/fac[n.x-k.x];
}

int main(){
    int N, M, K;
    cin >> N >> M >> K;
    init();
    mint ans = comb(N*M-2, K-2);
    mint sum = comb(M+1, 3)*N*N + comb(N+1,3)*M*M;
    ans *= sum;
    cout << ans.x << endl;
}

Measured memory_bytes: 2560
import java.util.*;
import java.lang.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double[] x = new double[n];
		double[] y = new double[n];
		double[] diff = new double[n];
		
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			y[i] = sc.nextInt();
		}
		
		for (double p = 1; p <=3; p++) {
			double sum = 0;
			for (int i = 0; i < n; i++) {
				sum+= Math.pow(Math.abs(x[i]-y[i]), p);
				diff[i] = Math.abs(x[i]-y[i]);
			}
			
			System.out.println(Math.pow(sum, 1/p));
		}
		
		double maxValue = diff[0];
		for(int i=1;i < n;i++){
			if(diff[i] > maxValue){
				maxValue = diff[i];
			}
		}
		
		
		System.out.println(maxValue);
		
			
	}
}


Measured memory_bytes: 26440
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <queue>
using namespace std;
typedef long long LL;

LL n,cnt = 0;
string s;

int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	cin >> s;
	for(LL i = 0;i < n;i ++){
		if(s.substr(i,3) == "ABC") cnt ++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n,ans;
char a,b;
string s;
int main(void){
    cin>>n>>s;
    a=s[0];
    for(int i=1;i<n;i++){
        b=s[i];
        if(a!=b){
            a=b;
            ans++;
        }
    }
    cout<<ans+1<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  int n;
  cin >> n;
  vi c(n-1), s(n-1), f(n-1);
  rep(i,n-1) cin >> c[i] >> s[i] >> f[i];
  
  vi ans(n);
  rep(i,n) {
    int t = 0;
    for (int j = i; j < n-1; ++j) {
      if (t < s[j]) t = s[j] + c[j];
      else if (t%f[j] == 0) t += c[j];
      else t += f[j] - t%f[j] + c[j];
    }
    ans[i] = t;
  }

  rep(i,ans.size()) printf("%d\n", ans[i]);
  return 0;
}

Measured memory_bytes: 256
line1 = list(map(int,input().split()) )
line2 = list(map(int,input().split()))
line3 = list(map(int,input().split()))

N = int(input())
num = []
for _ in range(N):
    num.append(int(input()))
card = line1 + line2 + line3
result = []
for i in card:
    if i in num:
        result.append(1)
    else:
        result.append(0)
count = 0


for i in range(0,7,3):
    if result[i] == 1 and result[i + 1] == 1 and result[i + 2] == 1:
        count = 1
        print("Yes")
        break
if count == 0:
    for i in range(3):
        if result[i] == 1 and result[i+3] == 1 and result[i+6] == 1:
            count = 1
            print("Yes")
            break
if count == 0:
    if result[0] == result[4] == result[8] == 1:
        count = 1
        print("Yes")
        
if count == 0:
    if result[2] == result[4] == result[6] == 1:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3064
a_i, a_o, a_t, a_j, a_l, a_s, a_z = map(int, input().split())

tri_use = min(a_j, a_l, a_i)
p1 = tri_use * 3

j_ex = a_j - tri_use
l_ex = a_l - tri_use
i_ex = a_i - tri_use

p2 = j_ex//2 * 2 + l_ex//2 * 2 + i_ex//2 * 2

extra = j_ex%2 + l_ex%2 + i_ex%2

p3 = 0
if tri_use >= 1:
    if extra == 2:
        p3 = 1
    elif extra == 3:
        p3 = 3
        
print(p1 + p2 + p3 + a_o)

Measured memory_bytes: 3064