akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <utility>
#include <algorithm>

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
#define mp make_pair
#define x first
#define y second

int arr[300003],tree[1025*1025],dp[300003];

void update(int x,int a,int b,int v,int r){
	if(x<a or x>b) return;
	if(x==a and a==b){
		tree[r]=v;
		return;
	}
	int md=(a+b)/2;
	update(x,a,md,v,2*r); update(x,md+1,b,v,2*r+1);
	tree[r]=max(tree[2*r],tree[2*r+1]);
}

int query(int x,int y,int a,int b,int r){
	if(a>=x and b<=y) return tree[r];
	if(y<a or x>b) return 0;
	int md=(a+b)/2;
	return max(query(x,y,a,md,2*r),query(x,y,md+1,b,2*r+1));
}

int main () {
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		scanf("%d",&arr[i]);
		arr[i]++;
	}
	for(int i=1;i<=n;i++){
		int i1=query(max(arr[i]-k,1),arr[i],1,300001,1);
		int i2=query(arr[i],min(300001,arr[i]+k),1,300001,1);
		dp[i]=max(dp[i1],dp[i2])+1;
		update(arr[i],1,300001,i,1);
	}
	int mx=0;
	for(int i=1;i<=n;i++){
		mx=max(mx,dp[i]);
	}
	cout<<mx;



return 0;
}



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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;

  while (A>0 && C>0) {
    C-=B;
    if (C <= 0) {
      cout << "Yes" << endl;
      break;
    }
    A-=D;
    if (A <= 0) cout << "No" << endl;
  }
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
using namespace std;
int main(){

  string S;
  cin>>S;
  int ans1=0;
  int ans2=0;
  for(int i=0;i<=(int)(S.length()-1);i++){
  
    if(i%2==0){
    
      if(S[i]=='0')ans1++;
    }
    else{
    
      if(S[i]=='1')ans1++;
    }
  }
  for(int i=0;i<=(int)(S.length()-1);i++){
  
    if(i%2==0){
    
      if(S[i]=='1')ans2++;
    }
    else{
    
      if(S[i]=='0')ans2++;
    }
  }
  //cout<<ans1<<endl<<ans2;
  int ans=ans1<ans2?ans1:ans2;
  cout<<ans;
  return 0;
}

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

int main(){
	vector<int> A;
	int n,a;
	cin>>n;
	for(int i=0;i<n;i++) {
			cin>>a;
			A.push_back(a);
		}
	make_heap(A.begin(),A.end());
	for(int i=0;i<n;i++) {
			cout<<" "<<A[i];
		}
		cout<<endl;
	return 0;
}


Measured memory_bytes: 4876
#include <stdio.h>
int main(void) {
    int W,H,x,y,r;
	//変数
    scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
	//W,H,x,y,rを入力
    
    if(x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H){
    	//円が左、右、上、下に出ていなかったら
        printf("Yes\n");
    }
    else 
		printf("No\n");
        return 0;
	}


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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define loop(i, n) for(int i = 0;i < n;i++)

int main(void){

    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll ans = 0;

    if(a > d){
        cout << d << endl;
        return 0;
    }

    if(a+b >= d){
        ans += a;
    }else{
        ans += a;
        d -= (a+b);
        ans -= d;
    }

    cout << ans << endl;


    return 0;
}

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

const int mod = 1e9 + 7;

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    if (abs(n - m) > 1) return puts("0"), 0;
    bool flag = abs(n - m);
    long long N = 1;
    for (int i = 1; i <= n; i++)
        N = (N * i) % mod;
    long long M = 1;
    for (int i = 1; i <= m; i++)
        M = (M * i) % mod;
    if (flag) printf("%lld\n", (N * M) % mod);
        else printf("%lld\n", (N * M) % mod * 2LL % mod);
    return 0;
}

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

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

    int A, B;
    cin >> A >> B;
    if (A <= 9 && B <= 9) {
        cout << A * B << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*
Be joyful in hope, patient in affliction, faithful in prayer.
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <vector>
#include <deque>
#include <functional>
#include <iterator>
#include <utility>
#include <bitset>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <cctype>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define SZ(x) ((int)x.size())
#define openfile {freopen("inp.txt","rt",stdin);freopen("out.txt","wt",stdout);}
#define debug 0

template <typename T> inline void next_int(T &x) {
	x = 0; char c; bool neg = false;
	while (!isdigit(c = getchar())) if (c == '-') neg = true;
	do x = x*10 + c - 48; while (isdigit(c = getchar()));
	if (neg) x = -x;
}

template <typename T> inline void write_int(T x, char last = 0) {
	if (x < 0) putchar('-'), x = abs(x);
	char tmp[20]; int cnt = 0;
	while (x >= 10) tmp[cnt++] = x % 10 + 48, x /= 10;
	tmp[cnt] = x + 48;
	FORD(i, cnt, 0) putchar(tmp[i]);
	if (last) putchar(last);
}

const ll oo = (ll)1e18+7;
int n, m;
ll dp[155][15][80];
int k[155], x[155][25], s[155][25];

int main() {
	while(scanf("%d%d", &n, &m) == 2 && n){
		REP(i, 0, 155) REP(j, 0, 15)REP(k, 0, 80) dp[i][j][k] = oo;
		REP(i, 0, n) {
			scanf("%d", &k[i]);
			REP(j, 0, k[i]) scanf("%d%d", &x[i][j], &s[i][j]);
		}
		REP(i, 0, k[0]) dp[0][i][0] = 0;
		REP(i, 0, k[1]) dp[1][i][1] = 0;
		REP(i, 0, n - 1) REP(j, 0, k[i]) {
			int cur = x[i][j];
			REP(l, 0, k[i + 1]) {
				int tmp = x[i + 1][l];
				FOR(used, 0, m) dp[i + 1][l][used] = min(dp[i + 1][l][used], dp[i][j][used] + (s[i][j] + s[i + 1][l]) * abs(cur - tmp));
			}
			if(i + 2 < n) {
				REP(l, 0, k[i + 2]) {
					int tmp = x[i + 2][l];
					REP(used, 0, m) dp[i + 2][l][used + 1] = min(dp[i + 2][l][used + 1], dp[i][j][used] + (s[i][j] + s[i + 2][l]) * abs(cur - tmp));
				}
			}
		}
		ll ans = oo;
		REP(i, 0, k[n - 1]) REP(j, 0, m + 1) ans = min(ans, dp[n - 1][i][j]);
		REP(i, 0, k[n - 2]) REP(j, 0, m) ans = min(ans, dp[n - 2][i][j]);
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 4680
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    if(t.length()>s.length())
    {
        cout<<"UNRESTORABLE\n";
        return 0;
    }
    int index=-1;
    bool f=0;
    for(int i=s.length()-t.length();i>=0;i--)
    {
        bool t2=1;
        for(int j=0;j<t.length();j++)
        {
            if(s[j+i]=='?')
                continue;
            if(s[i+j]!=t[j])
            {
                t2=0;
                break;
            }
        }
        if(t2)
        {
            f=1;
            index=i;
            break;
        }
    }
    if(f){
    for(int j=0;j<t.length();j++)
        s[j+index]=t[j];
    for(int i=0;i<s.length();i++)
        if(s[i]=='?')
            s[i]='a';
        cout<<s<<endl;
   }
else
    cout<<"UNRESTORABLE\n";
    
    return 0;   
}




 
 


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

int main() {
    string a, b;
    cin >> a >> b;

    int aLen = a.length();
    int bLen = b.length();

    if ((aLen < bLen) || (aLen == bLen && a < b)) {
        cout << "LESS" << endl;
    } else if (a == b) {
        cout << "EQUAL" << endl;
    } else {
        cout << "GREATER" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b,c,x;
	scanf("%d %d %d",&a,&b,&c);
	if(a==b)	x=c;
	if(a==c)	x=b;
	if(b==c)	x=a;
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	int A,B;
	char x;
	cin>>A;
	cin>>x;
	cin>>B;
	if(x=='+'){
		cout<<A+B<<endl;
		}
else
{
		cout<<A-B<<endl;
	}

		return 0;
}

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

int main() {

  int n, j;
  cin >> n;

  int a[n];
  for(int i=0; i<n; ++i) cin >> a[i];

  if(n%2) j = 1;
  else j = 0;

  for(int i=n-1; i>=0; i-=2) cout << a[i] << " ";
  for(; j<n; j+=2) cout << a[j] << " ";
  cout << endl;

  return 0;
}

Measured memory_bytes: 2944
#模範解答の通りにやってみる
N,K=map(int,input().split())
P=list(map(int,input().split()))
if K==1:
	print((max(P)+1)/2)
elif N==K:
	print((sum(P)+N)/2)
else:
	T=sum(P[0:(K)])
	S=sum(P[0:(K)])
	for k in range(0,N-K):
		S=S-P[k]+P[k+K]
		if T<=S:
			T=S
		else:
			continue
	print((T+K)/2)


Measured memory_bytes: 25060
#include <iostream>

using namespace std;

int main(){

    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r ;
    if(x-r<0 || x+r>w || y-r<0 || y+r>h)cout << "No" << endl;
    else cout << "Yes" << endl;

    return 0;
}

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

typedef long long Int;
typedef pair<int,int> PII;
typedef vector<int> VInt;
 
#define FOR(i, a, b) for(i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(i = (a) - 1; i >= (b); --i)
#define EACH(it, a) for(auto it = (a).begin(); it != (a).end(); ++it)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define SIZE(a) int((a).size())
#define ALL(a) (a).begin(),(a).end()
#define MP make_pair

int gcd(int a, int b)
{
    return a == 0 ? b : gcd(b % a, a);
}

void solve(int test)
{
    int x;
    cin >> x;
    cout << (360 / gcd(x, 360)) << endl;
}

int main()
{
    int T = 1, t;
    //cin >> T;
    FOR(t, 0, T) solve(t);
    return 0;
}


Measured memory_bytes: 3668
// stdin
macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

// input
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// Test
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
    r"4
" => r"0.5000000000",

r"5
" => r"0.6000000000",

r"1
" => r"1.0000000000"
}

fn solve(src: &str) -> String{
    input! {
        source=src,
        n:usize,
    }
    let odd = (n + 1) / 2;
    let ans = odd as f64 / n as f64;

    format!("{:.10}", ans)
}

fn main() {
    println!("{}", solve(&stdin!()));
}








Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
using namespace std;

string s;
int K;

int main() {
  cin >> s >> K;
  int N = s.size();
  rep(i, N) {
    if (s.at(i) == 'a') {
      continue;
    }
    int dist = 'z' - s.at(i) + 1;
    if (K >= dist) {
      K -= dist;
      s.at(i) = 'a';
    }
  }
  K = K%26;
  s.at(N-1) = s.at(N-1) + K;
  cout << s << endl;
}


Measured memory_bytes: 512
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])
 
def main():
    h,w = inpm()
    if h==1 or w==1:
        print(1)
        return
    if h*w %2 == 0:
        print(h*w//2)
    else:
        print(h*(w-1)//2+(h+1)//2)
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 63980
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		Map <Long,Long>  map = new HashMap<Long,Long>();
		long i=2;
		boolean b = false;
		while(i*i<=N) {
			while (N%i==0) {
				b =true;
				if (map.get(i)==null) {
					map.put(i,1l);
				} else {
					long temp = map.get(i);
					map.put(i, temp+1l);
				}
				N/=i;
			}
			i++;
		}
		if (N>1) {
			map.put(N, 1l);
		}
		if (N>1&&b==false) {
			System.out.println(1);
			return ;
		}
		long sum =0;
		Set<Long> set = map.keySet();
		for (long l: set) {
			long temp = map.get(l);
			i=1;
			while (temp>=i) {
				sum ++;
				temp -=i;
				i++;
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 36012
/*#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
*/

#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr<<#x<<": "<<(x)<<'\n'
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9+7;
const ll inf = 0x3f3f3f3f;
const ll nax = 0;	

int main(){		
	IOS
	int x; cin >> x;
	cout << 1-x << '\n';
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
deque<char> dq, t;
int main(void)
{
	char str[111];
	scanf("%s", str);
	int len = strlen(str);
	int i;
	for (i = 0; str[i]; ++i) {
		dq.push_back(str[i]);
	}
	scanf("%s", str);
	for (i = 0; str[i]; ++i) {
		t.push_back(str[i]);
	}
	while (len--) {
		if (dq == t) return !printf("Yes");
		dq.push_front(dq.back());
		dq.pop_back();
	}
	printf("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int ans = 0;
    if(s[0] == 'p') ans--;
    int g = 1;
    for(int i=1; i<s.size(); i++){
        if(s[i] == 'p'){
            if(g > 0) g--;
            else{
                ans--;
                g++;
            }
        }
        else{
            if(g > 0){
                g--;
                ans++;
            }
            else g++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;

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

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let s: String = cin
        .bytes() // Bytes
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace()) // c が whitespace である限り skip
        .take_while(|c| !c.is_whitespace()) // c が whitespace でない限り要素を返す
        .collect();
    s.parse().ok().expect("failed parsing")
}

fn main() {
    input! {n:usize}
    if n <= 999 {
        println!("ABC")
    } else {
        println!("ABD")
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define f(a,j,k) for(int i = a ; i < j ; i += k)
#define f1(a,j,k) for(int i = a ; i > j ; i -= k)
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
typedef vector<int> vi;
typedef pair<int,int> pri;
typedef pair<long long,long long> prl;
inline int ok(char *s,int i , int j){
	while(i < j){
		if(s[i] != s[j]) return 0;
		++ i , -- j;
	}
	return 1;
}
int main() {
	std::ios::sync_with_stdio(false);
  char s[110] = "";
	cin >> s;
	int len = strlen(s);
	if(ok(s,0,(len-1)/2-1) && ok(s,(len+3)/2-1,len-1) && ok(s,0,len-1)) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
while True:
    try:
        a,b,c,d,e,f=map(int, input().split())
        
        y=(a*f-d*c)/(a*e-d*b)
        x=(-b*y+c)/a
        
        print("{:.3f} {:.3f}".format(x,y))
    
    except EOFError:
        break


Measured memory_bytes: 5620
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>

#pragma warning(disable:4996)

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (c >= a&&c <= b ? "Yes" : "No") << endl;
  return 0;
}


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

char s[Maxn], t[Maxn];
int main()
{
	scanf("%s", s + 1); int len = strlen(s + 1);
	scanf("%s", t + 1);
	for (int i=1; i<=len; i++) if (s[i] != t[i]) { puts("No"); return 0; }
	puts("Yes");
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long n,cap;
    cin>>n>>cap;
    vector<pair<long long,long long>> v;
    for(int i=0;i<n;i++){
        long long x,y;
        cin>>x>>y;
       v.push_back(make_pair(x,y));
    }
   long long dp[cap+1]={0};
   for(int i=0;i<v.size();i++){
     long long st=v[i].first;
     long long val=v[i].second;  
     for(int j=cap;j>=st;j--){
         dp[j]=max(dp[j-st]+val,dp[j]);
 //         cout<<dp[j]<<" ";
     } 
  //   cout<<endl;
   }
   cout<<dp[cap];
}


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

int main () {
	
	int n=0, i=0; 
	long long int val=0;
	vector <long long int> v;

	scanf("%d", &n);

	v.push_back(0);

	for (i=0; i<n; i++) {
		scanf("%lld", &val);
		v.push_back(v[i]+val);
	}

	long long int res = INT_MAX;
	long long int x=0, y=0;
	for (i=1; i<n; i++) {
		x = v[i]-v[0];
		y = v[n]-v[i];
		x = abs(x-y);

		res = min(res, x);
	}

	printf("%lld\n", res);

	return 0;
}

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

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n)cin >> a[i];
	int cnt = 0;
	int ans = 0;
	rep(i,n-1)
	{
		if(a[i]>=a[i+1])
		{
			cnt++;

		}
		else
		{
			//cout<<cnt<<endl;
			ans = max(cnt,ans);
			cnt =0;
		}
	}
	ans = max(cnt,ans);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    vector<int> a(n);
    map<int,int> mp;
    for(int i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]]++;
    }
    sort(a.begin(),a.end());
    int mi=a[0], ma=a[n-1];
    if(ma-mi>=2){
        cout<<"No"<<endl;
        return 0;
    }
    if(ma-mi==1){
        if(mp[mi]<ma && 2*(ma-mp[mi])<=mp[ma]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        return 0;
    }
    if(mi==n-1){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(2*mi<=n){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 5376
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cout << #x << " = " << (x) << endl
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

long long modPow(long long a, long long x, long long p) {
    long long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}

long long modInverse(long long a, long long p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}

long long modFactorial(long long a, long long p) {
    long long fact = 1;
    for (long long i=2; i<=a; i++) {
        fact *= i;
        fact %= p;
    }
    return fact;
}

long long combination(long long n, long long k, long long p) {
    // calculates C(n,k) mod p (assuming p is prime).

    long long numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (int i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    long long denominator = 1; // k!
    for (int i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}


class BFusingSlimes {
public:
    void solve(std::istream& in, std::ostream& out) {
        int N;
        in >> N;
        vector<ll> x(N);
        REP(i,0,N) in >> x[i];

        ll fact = modFactorial(N-1, MOD);
        ll answer = 0;
        vector<ll> pSum(N+1);
        REP(j,1,N) {
            pSum[j] = pSum[j-1] + fact * modInverse(j, MOD);
            pSum[j] %= MOD;
        }
        REP(i, 1, N) {
            answer += (x[i] - x[i-1]) * pSum[i];
            answer %= MOD;
        }
        out << answer << "\n";
    }
};


signed main() {
    BFusingSlimes solver;
    std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    double A,B,N; cin >> A >> B >> N;
    ll k = floor((N+1)/B);
    ll x;
    if(k==0){
        x = floor(N);
    }else{
        x = k*floor(B) - 1;
    }
    cout << floor(A*x/B) - floor(A)*floor(x/B) << endl;
    return 0;
}

Measured memory_bytes: 3924
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

#define int long

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int n, m;
std::vector<int> edge[200005];

signed main(){
	scanf("%ld %ld", &n, &m);
	for(int i = 0; i < m; i++){
		int a, b;
		scanf("%ld %ld", &a, &b);
		edge[a].push_back(b);
	}
	for(int i = 0; i < edge[1].size(); i++){
		int node = edge[1][i];
		for(int j = 0; j < edge[node].size(); j++){
			if(edge[node][j] == n){
				printf("POSSIBLE\n");
				return 0;
			}
		}
	}
	printf("IMPOSSIBLE\n");
	return 0;
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n,d; cin >> n >> d;

  int ans;
  for(int i = 1;i<=n;i++){
    if(i*(1+2*d)>=n){
      ans = i;
      break;
    }
  }

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


Measured memory_bytes: 3640
#include<algorithm>
#include <iostream>
#include  <cstdlib>
#include  <cstring>
#include   <string>
#include   <vector>
#include   <cstdio>
#include    <queue>
#include    <stack>
#include    <ctime>
#include    <cmath>
#include      <map>
#include      <set>
#define ll long long
#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
using namespace std;
char buf[(1 << 22)], *p1 = buf, *p2 = buf;
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' | c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int a[55],b[55],fa[55],n;
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
int solve(int x,int y){
    int res=n;
    for(int i=0;i<55;i++)fa[i]=i;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(a[i]-x==a[j]&&b[i]-y==b[j]){
                int fi=find(i),fj=find(j);
                if(fi!=fj)fa[fi]=fj,res--;
            }
        }
    }
    return res;
}
int main(){
    #ifdef DanDan
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    #endif //DanDan
    n=read();
    for(int i=0;i<n;i++)
        a[i]=read(),b[i]=read();
    int cnt=1e9;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cnt=min(cnt,solve(a[i]-a[j],b[i]-b[j]));
        }
    }
    printf("%d\n",cnt);
    return 0;
}



Measured memory_bytes: 384
n=int(input())
x=list(map(int,input().split()))
x=sorted(x)
ans=10**8
count=0
for i in range(x[0],x[-1]+1):
  count=0
  for j in range(n):
    count+=(x[j]-i)**2
  if ans>count:
    ans=count
    
print(ans)
  

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

using namespace std;

int n, k, q;
int P[100005];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> k >> q;
    for (int i = 0; i < q; ++i) {
        int a;
        cin >> a;
        ++P[a];
    }
    for (int i = 1; i <= n; ++i) {
        P[i] += k - q;
        cout << (P[i] <= 0 ? "No\n" : "Yes\n");
    }
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { //最大公約数
  if (b==0) return a;
  else return gcd(b, a%b);
}

ll lcm(ll a, ll b) { //最小公倍数
  return a * b / gcd(a, b);
}

ll digit_sum(ll a){ //10進桁和
  ll ans=0;
  while(a>0){
    ans+=a%10;
    a/=10;
  }
  return ans;
}



int main()
{
  ll n,a[2][110],ans=0,m=0;
  cin>>n;
  rep(i,n){
    cin>>a[0][i];
    m+=a[0][i];
  }
  rep(i,n)cin>>a[1][i];


  rep(i,n){
    ll tmp=0;
    rep(j,i+1){
      tmp+=a[0][j];
    }
    for(ll k=i;k<n;k++){
      tmp+=a[1][k];
    }
    ans=max(ans,tmp);
  }


  cout<<max(ans,m)<<endl;
  return 0;
}


Measured memory_bytes: 3604
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
LIN=lambda : list(IN())
mod=1000000007

#+++++

def main():
	#a = int(input())
	h, w = IN()
	#s = input()
	map_l = [input() for _ in range(h)]
	l_l = [[0] * w for _ in range(h)]
	l_l[0][0]=1
	for hi in range(h):
		for wi in range(w):
			if map_l[hi][wi] == '#':
				continue
			if wi > 0:
				l_l[hi][wi] += l_l[hi][wi-1]
				l_l[hi][wi] %= mod
			if hi > 0:
				l_l[hi][wi] += l_l[hi-1][wi]
				l_l[hi][wi] %= mod
				
	print(l_l[h-1][w-1])
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 51824
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(defun convert (x)
  (list (- (car x) (cadr x))
        (1- (+ (car x) (cadr x)))))

(defun check (lst)
  (let ((counter 0)
        (tmp -100000000))
       (loop for i from 0 below N
             do (if (< tmp (aref lst i 0))
                    (progn 
                      (incf counter)
                      (setf tmp (aref lst i 1))))
             finally (return counter))))


(defparameter N (parse-integer (read-line)))
(defparameter lst
  (make-array (list N 2)
              :initial-contents
              (sort (mapcar #'convert
                             (loop for i from 0 below N
                                   collect (mapcar #'parse-integer
                                                   (split " " (read-line)))))
                    #'< :key #'cadr)))

(format t "~A" (check lst))


Measured memory_bytes: 74676
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int a,b,c,k; cin >> a >> b >> c >> k;
    int cnt = 0;
    while(1) {
        while(a >= b) {
            cnt++;
            b *= 2;
        }
        while(b>= c) {
            cnt++;
            c *= 2;
        }
        break;
    }
    if(cnt <= k) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a, b;
	int res = 0;

	cin >> a >> b;

	for (int i = a; i <= b; i++)
	{
		stringstream ss;
		ss << i;
		string s, t;
		s = ss.str();
		t = s;
		reverse(t.begin(), t.end());
		if (s == t)
		{
			res++;
		}
	}

	cout << res << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#define MAXN 100005
int n,l;
int a[MAXN];
int main()
{
	bool f=0;
	int pos;
	scanf("%d %d",&n,&l);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(i>1&&a[i]+a[i-1]>=l)
		{
			f=1;
			pos=i-1;
		}
	}
	if(f) 
	{
		printf("Possible\n");
		for(int i=1;i<=pos-1;i++)
			printf("%d\n",i);
		for(int i=n-1;i>=pos;i--)
			printf("%d\n",i);
	}
	else
		printf("Impossible\n");
}

Measured memory_bytes: 1152
import bisect
import collections
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
    
def find_prime(n):
    prime_list = []
    find_list = list(range(2,n+1))
    while True:
        if find_list[0] > n**(1/2):
            prime_list.extend(find_list)
            break
        else:
            head = find_list[0]
            prime_list.append(head)
            find_list.pop(0)
            find_list = [num for num in find_list if num % head != 0]
    return prime_list

find_prime_s = find_prime(50000)
like2017 = []
for i in find_prime(100000)[1:]:
    if (i+1)//2 in find_prime_s:
        like2017.append(i)

Q = int(input())
for i in range(Q):
    l,r = map(int,(input().split()))
    print(bisect.bisect_right(like2017,r) - bisect.bisect_left(like2017,l))

Measured memory_bytes: 61148
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;

int main() {
    int N, T;
    int t[maxn], ans, lst = 0, maxt = 0;
    scanf("%d%d", &N, &T);

    ans = 0;
    for(int i = 0; i < N; i++) {
        scanf("%d", &t[i]);
        if(t[i] <= maxt) maxt = t[i] + T - 1;
        else ans += maxt-lst + 1, lst = t[i], maxt = t[i] + T - 1;
    }
    ans += maxt-lst + 1;
    printf("%d\n", ans);
    return 0;
}


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

int main(){
  int r0, w0, c, r;
  while( cin >> r0 >> w0 >> c >> r ) {
    if(r0 == 0 and w0 == 0 and  c == 0 and r == 0) break;

    int ans = 0;
    for(ans = 0; ; ans++){
      if( r0 + r*ans >= w0*c ) break;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3036
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <typeinfo>
#include <vector>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main()
{
  string s, t;
  cin >> s >> t;
  int n = s.size();
  bool ok = true;
  vector<char> abc(26,'*');
  vector<char> cba(26, '*');
  rep(i, n)
  {
    if(abc.at(s.at(i)-'a')!='*'){
      if(abc.at(s.at(i)-'a')!=t.at(i)){
        ok = false;
        break;
      }
    }else{
      abc.at(s.at(i) - 'a') = t.at(i);
    }
  }
  rep(i,n){
    if(cba.at(t.at(i)-'a')!='*'){
      if(cba.at(t.at(i)-'a')!=s.at(i)){
        ok = false;
        break;
      }
    }else{
      cba.at(t.at(i) - 'a') = s.at(i);
    }
  }
  if (ok)
  {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 776
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;

const double PI = 3.141592653;
 
signed main() {
	IOS;
	#ifdef LOCAL
		freopen("input.txt","r", stdin);
		freopen("output.txt","w",stdout);
	#endif
	int a, b, x;
	cin >> a >> b >> x;
	double y;
	if(2*x >= a*a*b){
		y = 1.0*(2*x - a*a*b)/(a*a);
		y = 1.0*a/(b - y);
	}	
	else{
		y = 2.0*x/(a*b);
		y = y/b;
	}
	y = atan(y)*180/PI;
	y = 90 - y;
	cout << setprecision(10) << fixed << y << endl;
	return 0;
}

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

signed main(){
	lint N, M; cin >> N >> M;
	vector<vector<lint> > num(M + 1);
	for(lint i = 0; i < N; i++){
		lint a, b; cin >> a >> b;
		if(a > M) continue;
		num[a].push_back(b);
	}

	priority_queue<lint> que;
	lint ans = 0;
	for(lint i = 1; i <= M; i++){
		for(lint j = 0; j < num[i].size(); j++){
			que.push(num[i][j]);
		}
	  if(que.size()) ans += que.top(), que.pop();
	}
	cout << ans << endl;
}

Measured memory_bytes: 5632
//dhruv
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define ll long long
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define fro(i,j,n) for(int i = (j);i < (n); ++i)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#define ff first
#define ss second
const int mod = 1e9 + 7;
const int inf = 1e18 + 5;
 
template<typename T>
T binpow(T a,T b,T modi){
	T res = 1;
	while(b){
		if(b&1){
			res = (res*a)%modi;
		}
		b /= 2;
		(a *= a) %= modi;
	}
	return res;
}
 
 
template<typename T>
T binpow(T a,T b){
	T res = 1;
	while(b){
		if(b&1){
			res = (res*a);
		}
		b /= 2;
		a *= a;
	}
	return res;
}
 
template<typename T>
T add(T a,T b){
	return (a + b)%mod;
}
template<typename T>
T sub(T a,T b){
	return add(a,mod - b);
}
template<typename T>
T mul(T a,T b){
	return (a*b)%mod;
}
template<typename T>
T inv(T a){
	return binpow(a,mod - 2,mod);
}

int make_int(string s){
	int x = 0;
	reverse(s.begin(),s.end());
	string tmp = s;
	for(int i = 0;i < s.length(); ++i){
		x *= 10;
		x += (int)(tmp.back() - '0');
		tmp.pop_back();
	}
	return x;
}
 
string make_string(int s){
	string x;
	while(s){
		x.push_back(char(s%10 + '0'));
		s /= 10;
	}
	reverse(x.begin(),x.end());
	return x;
}

random_device rd;
mt19937 g(rd());

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

const int N = 100;

vi fact;

void factorial(){
	fact.resize(N);
	fact[0] = 1,fact[1] = 1;
	fro(i,2,N){
		fact[i] = (fact[i - 1]*i)%mod;
	}
}

int nCr(int n,int r){
	return (mul(fact[n],inv(mul(fact[r],fact[n - r]))));
}

int nPr(int n,int r){
	return(mul(nCr(n,r),fact[r]));
}

// Linear Seive


int lp[N + 1];
vector<int> pr;
void ls(){
	for(int i = 2;i <= N; ++i){
		// means prime
		if(lp[i] == 0){
			lp[i] = i;
			pr.push_back(i);
		}
		for(int j = 0;j < pr.size() && pr[j] <= lp[i] && i*pr[j] <= N; j++){
			lp[i*pr[j]] = pr[j];
		}
	}
}


// getting the prime factorisation

vector<int> getfc(int n){
	vi factors;
	while(n != 1){
		int x = lp[n];
		factors.push_back(x);
		while(n%x == 0){
			n /= x;
		}
	}
	return factors;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	// shuffle(all(a),g);
	int n;
	cin >> n;
	int x = (n - 1)/1000 + 1;
	cout << x*1000 - n;
	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}

string rot(string s, int rot, int l, int r){
    string ret=s;
    range(i,l,r){
        ret[i]=(ret[i]-'0'+rot+10)%10+'0';
    }
    return ret;
}

int solve(string a, string& b, int d){
    if(d==a.size()) return 0;
    if(a[d]==b[d]) return solve(a,b,d+1);
    int need=10;
    //cout<<a<<endl;
    range(i,d+1,a.size()+1){
        //cout<<pii(d,i)<<":"<<rot(a,b[d]-a[d],d,i)<<endl;
        need=min(need,solve(rot(a,b[d]-a[d],d,i),b,d+1));
    }
    return need+1;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n;
	while(cin>>n,n){
		string a,b;
		cin>>a>>b;
		cout<<solve(a,b,0)<<endl;
	}
	return 0;
}



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

#define ll long long
#define vl vector<ll>
#define vvl vector<vector<ll>> //vvl data(10, vector<ll>(10);
#define fo(i,a,b) for(ll i=a; i<b; i++)

int main(){
    ll N;
    cin >> N;

    vl num(N);
    ll limit = pow(10, 18);
    fo(i, 0, N){
        cin >> num[i];
        if(num[i] == 0){
            cout << 0 << endl;
            return 0;
        }
        //if(num[i] > limit){
        //    cout << -1 << endl;
        //    return 0;
        //}
    }

    ll ans = 1;
    fo(i, 0, N){
        ll size1 = log10(ans)+1;
        ll size2 = log10(num[i])+1;
        if(limit/ans<num[i] || size1+size2-1>=20){
            cout << -1 << endl;
            return 0;
        }else{
            ans *= num[i];
        }
    }
    
    cout << ans << endl;
}

/*
　 ◇　　　　 ミ ◇
　◇◇　 /￣|　 ◇◇
◇◇＼　 L＿| ◇◇
　　彡Ｏ(・＿・)/
　 　　ヽ Ｐ`Ｏ
　　 ／彡#_|ミ＼
　　　 </LL凵>
　　　　∪ ∪
pass system test !!
*/

Measured memory_bytes: 4124
#include <bits/stdc++.h>
#define MAXN 500010
#define inf 0x3f3f3f3f
#define LL long long
#define pi acos(-1)
#define MOD 1000000007
using namespace std;


int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	if (a==b&&b==c) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

[N, M] = [int(i) for i in input().split()]

AB = []
for m in range(M):
    [a, b] = [int(i) for i in input().split()]
    AB.append((a, b))

# 東側の順にソート
sorted_AB = sorted(AB, key=lambda ab: ab[1])
#print(sorted_AB)

# 戦争中のペアの最東端の橋を取り除く
removed_bridge_number = 0
easternmost = 0
for (a, b) in sorted_AB:
    #print('(a, b): ({}, {})'.format(a, b))
    if a >= easternmost:
        removed_bridge_number += 1
        easternmost = b

print(removed_bridge_number)

Measured memory_bytes: 19000
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Stack;
import java.util.Scanner;
import java.util.Queue;

/**
 * @author yoshikyoto
 */
class Main{
	static final boolean DEBUG = true;
	static Scanner sc = new Scanner(new InputStreamReader(System.in));
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public static void main(String args[]) throws Exception{
		String line;
		while((line = readLine()) != null)
			p(dfs(parseInt(line), 0));
	}
	
	public static int dfs(int n, int depth){
		if(n > 9 * (4 - depth)) return 0;
		if(n < 0) return 0;
		if(depth == 3) return 1;
		int res = 0;
		for(int i = 0; i < 10; i++){
			res += dfs(n - i, depth + 1);
		}
		return res;
	}

	public static String readLine() throws IOException{return br.readLine();}
	public static int readInt(){return sc.nextInt();}
	public static void pa(Object[] arr){System.out.println(Arrays.toString(arr));}
	public static void pa(int[] arr){System.out.println(Arrays.toString(arr));}
	public static void pa(double[] arr){System.out.println(Arrays.toString(arr));}
	public static void pa(boolean[] arr){System.out.println(Arrays.toString(arr));}
	public static void p(Object o){System.out.println(o.toString());}
	public static void d(Object o){if(DEBUG)System.out.println(o.toString());}
	public static void da(int[] arr){if(DEBUG)System.out.println(Arrays.toString(arr));}
	public static void sort(int[] a){Arrays.sort(a);}
	public static int[] parseInt(String[] arr){
		int[] res = new int[arr.length];
		for(int i = 0; i < arr.length; i++)res[i] = Integer.parseInt(arr[i]);
		return res;
	}
	public static int parseInt(Object o){return Integer.parseInt(o.toString());}
	public static int digit(int n){return String.valueOf(n).length();}
	public static String reverse(String s){
		StringBuffer sb = new StringBuffer(s);
		return sb.reverse().toString();
	}
}

class MyHashMap<E> extends HashMap<E, Integer>{
	ArrayList<E> keyArray = new ArrayList<E>();
	public void add(E key){add(key, 1);}
	public void add(E key, Integer value){
		if(containsKey(key)){
			value += get(key);
		}else{
			keyArray.add(key);
		}
		put(key, value);
	}
}

Measured memory_bytes: 18748
#include <bits/stdc++.h>
using namespace std;
long long int q,h,s,d,n,x,y,z;
int main()
{
	scanf("%lld %lld %lld %lld %lld",&q,&h,&s,&d,&n);
	if(q*4<s)
	{
		s=4*q;
	}
	if(h*2<s)
	{
		s=2*h;
	}
	if(s*2<d)
	{
		d=s*2;
	}
	if(n%2==0)
	{
		long long int ans=(n/2)*d;
		printf("%lld",ans);
		return 0;
	}
	else
	{
		long long int ans=(n/2)*d;
		printf("%lld",ans+s);
		return 0;
	}
	
}


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

using namespace std;
using ll = long long;

int main() {
	int n;
	int keta[31];
	for (int i = 0;i < 31;i++) {
		keta[i] = 0;
	}
	cin >> n;
	int* a = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		int tmp = a[i];
		for (int i = 0;i < 31;i++) {
			keta[i] += tmp % 2;
			keta[i] %= 2;
			tmp /= 2;
		}
	}
	ll ans;
	for (int i = 0;i < n-1;i++) {
		ans = 0;
		for (int j = 0;j < 31;j++) {
			ans += (ll)pow(2, j) * ((keta[j] + a[i] % 2) % 2);
			a[i] /= 2;
		}
		cout << ans << " ";
	}
	ans = 0;
	for (int j = 0;j < 31;j++) {
		ans += (ll)pow(2, j) * ((keta[j] + a[n-1] % 2) % 2);
		a[n-1] /= 2;
	}
	cout << ans <<endl;

}


Measured memory_bytes: 4916