akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;


double r(string s){
	if( s == "north" ) return 0;
	if( s == "west" ) return 90;
	int n = count(s.begin(),s.end(),'w') + count(s.begin(),s.end(),'n') - 1;
	if( s[0] == 'n' ){
		return r(s.substr(5)) - 90. / (1<<n);
	}else{
		return r(s.substr(4)) + 90. / (1<<n);
	}
}
int main(){
	string s;
	while( cin >> s ,s != "#"){
		double A = r(s), B = 1;
		while( A != (int)A ){
			A *= 2;
			B *= 2;
		}
		int G = __gcd((int)abs(A),(int)B);
		A /= G;
		B /= G;
		if( B == 1 ){
			cout << (int)A << endl;
		}else{
			cout << (int)A << "/" << (int)B << endl;
		}
		
		
		
	}
}

Measured memory_bytes: 1200
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <ctime>

using namespace std;
#define RN cout << "\r\n";
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef long long int ll;
typedef pair<ll, ll> P;

// combination
const int MAX = 510000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int a, b;
    cin >> a >> b;
    int ans;
    if (a % b == 0) {
        ans = 0;
    } else {
        ans = 1;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

// https://beta.atcoder.jp/contests/arc065/tasks/arc065_b

// 各ノードが接続しているノードを2次元配列で返す
fn node_to_list(node_num: usize, link_num: usize, sc: &mut Scanner) -> Vec<Vec<usize>> {
    let mut ret: Vec<Vec<usize>> = vec![Vec::new(); node_num];
    for i in 0..link_num {
        let (p, q): (usize, usize) = (sc.read(), sc.read());
        ret[p-1].push(q-1); ret[q-1].push(p-1);
    }
    ret
}

fn dfs(
    paths: &Vec<Vec<usize>>,
    cnct: &mut Vec<i32>,
    p: usize,
    num: i32
) {
    cnct[p] = num;
    for next in paths[p].iter() {
        if cnct[*next] == -1 {
            dfs(paths, cnct, *next, num);
        }
    }
}

fn main() {
    let cin = stdin(); let cin = cin.lock(); let mut sc = Scanner::new(cin);

    let n: i32 = sc.read();
    if n > 2 { println!("{}", n / 3); }
    else { println!("0"); }
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

Measured memory_bytes: 4476
h = int(input())
w = int(input())
n = int(input())

if h >= w:
  if n%h == 0:
    print(str(n//h))
  else:
    print(str(n//h+1))
else:
  if n%w == 0:
    print(str(n//w))
  else:
    print(str(n//w+1))
  


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
#define clrg(i, l, r) for(int i=(int)(l);i<(int)(r);i++)vis[i]=0,v[i].clear();
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<< endl;}}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<"\n";
#define ln length()
#define sz size()
#define mod 1000000007
#define elif else if
int32_t main(){
   int arr[3][3];
   rep(i,0,3)rep(j,0,3)cin>>arr[i][j];
   int n; cin>>n;
   while(n--){
     int t; cin>>t;
     rep(i,0,3)rep(j,0,3){
       if(arr[i][j]==t)arr[i][j]=0;
     }
   } int ok=0;
   rep(i,0,3){
     int sum=0;
     rep(j,0,3){
      sum+=arr[i][j];
     }
     if(sum==0)ok=1;
   }
   rep(i,0,3){
     int sum=0;
     rep(j,0,3){
      sum+=arr[j][i];
     }
     if(sum==0)ok=1;
   }
   if(arr[0][0]==0 and arr[1][1]==0 and arr[2][2]==0)ok=1;
   if(arr[2][0]==0 and arr[1][1]==0 and arr[0][2]==0)ok=1;
   cout<<(ok?"Yes":"No");
   return 0;
}
/*
Edge cases? n=1? a[i]<=0?
long vs int? 1LL? 64bits?
Re-read problem. Is it as easy as it seems?
KEEP CORRECTING AND SUBMITTING!
*/


Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')

from math import pi


R = I()
print(2 * R * pi)


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

bool f(vector<int> y, vector<int> z, int n) {
    double x = 0;
    for (int i = 0; i < n; i++) {
        x += (y.at(i) - z.at(i)) * (y.at(i) - z.at(i));
    }
    x = sqrt(x);
    return floor(x) == ceil(x);
}

int main(void) {
    int n, d;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));
    for (int i = 0; i < n; i++) {
        for (int ii = 0; ii < d; ii++) {
            cin >> x.at(i).at(ii);
        }
    }
    int ans = 0;
    for (int i = 1; i < n; i++) {
        for (int ii = 0; ii < i; ii++) {
            if (f(x.at(i), x.at(ii), d)) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BMultiplication2 solver = new BMultiplication2();
        solver.solve(1, in, out);
        out.close();
    }

    static class BMultiplication2 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = in.readLongArray(n);

            for (long x : a) {
                if (x == 0) {
                    out.println(0);
                    return;
                }
            }

            final BigInteger MAX = BigInteger.valueOf(1_000_000_000_000_000_000L);

            BigInteger answer = BigInteger.ONE;
            for (long x : a) {
                answer = answer.multiply(BigInteger.valueOf(x));
                if (answer.compareTo(MAX) > 0) {
                    out.println(-1);
                    return;
                }
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long[] readLongArray(int n) {
            long[] x = new long[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextLong();
            }
            return x;
        }

    }
}



Measured memory_bytes: 48352
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

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




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

int main(){

    ll X;
    cin >> X;

    FOR(a, -200, 201){
        FOR(b, -200, 201){
            if (pow(a, 5) - pow(b,5) == X){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 4048
import scala.math._

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val r = sc.nextInt
  val g = sc.nextInt

  val ans = g * 2 - r

  println(ans)

  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 25420
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll H,W,N;
    cin >>H>>W>>N;
    vector<ll>A;
    rep(i,N){
        ll a;
        cin>>a;
        rep(j,a){
            A.pb(i+1);
        }
    }
    vector<vector<ll>>ans(H,vector<ll>(W));
    rep(i,H){
        if(i%2==0){
            rep(j,W){
                ans[i][j]=A[W*i+j];
            }
        }else{
            rep(j,W){
                ans[i][W-j-1]=A[W*i+j];
            }
        }
        
    }
    
    rep(i,H){
        rep(j,W){
            cout<<ans[i][j]<<" ";
        }
        cout<<endl;
    }



    return 0;
    

}

Measured memory_bytes: 3676
X = int(input())

ok = False
for a in range(200):
    for b in range(200):
        if a**5 - b**5 == X:
            ok = True
            A, B = a, b
            break
        
        if a**5 + b**5 == X:
            ok = True
            A, B = a, -b
            break
    
    if ok == True:
        break

print(A, end=' ')
print(B)

Measured memory_bytes: 8920
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int[] P = new int[4];
		int[] T = new int[4];
		for (int i = 0; i < 4; i++) {
			P[i] = sc.nextInt();
		}
		for (int i = 0; i < 4; i++) {
			T[i] = sc.nextInt();
		}
		int[] dp = new int[201];
		Arrays.fill(dp, 200000);
		dp[0] = 0;
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j + T[i] < dp.length; j++) {
				dp[j + T[i]] = Math.min(dp[j + T[i]], dp[j] + P[i]);
			}
		}
		int ans = Integer.MAX_VALUE;
		for (int i = N; i < dp.length; i++) {
			ans = Math.min(ans, dp[i]);
		}
		System.out.println(ans);
	}

}



Measured memory_bytes: 26340
#include <iostream>

int main() {

    int l;
    int r;
    int d;
    std::cin >> l;
    std::cin >> r;
    std::cin >> d;

    int count = 0;

    for (int i=l; i<=r; ++i) {
        if (i % d == 0) {
            count++;
        }
    }

    std::cout << count << std::endl;

    return 0;

}

Measured memory_bytes: 3544
#include <stdio.h>
float a[13],x,s;
int i;
int main(void){
	for(;~scanf("%f,",&x);){
		++i;
		a[i]=i<11?s+=x:x;
		if(i>11){
			x=a[10]/(1+a[12]/a[11]);
			for(i=1;a[i]<x||!printf("%d\n",i);++i);
			i=s=0;
		}
	}
	return 0;
}

Measured memory_bytes: 0
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    """
    N = read_int()
    A = read_ints()
    T = [0, 0, 0]
    answer = 1
    modulo = 1000000007
    for a in A:
        if a not in T:
            return 0
        answer = (answer*T.count(a))%modulo
        T[T.index(a)] += 1
    return answer


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 83744
#include <iostream>
#include <cstdlib>
#include <string>
#include <algorithm>
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if(b-a == c-b){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

N, K = map(int, input().split())
V = list(map(int, input().split()))
ans = 0
for i in range(N + 1):
    for j in range(N + 1):
        if i + j > N or i + j > K:
            continue
        removed = sorted(V[:i] + V[N-j:])
        sm = sum(removed)
        for k in range(K - i - j):
            if k < len(removed) and removed[k] < 0:
                sm -= removed[k]
        ans = max(ans, sm)
print(ans)



Measured memory_bytes: 41964
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

const long long MOD = 1000000000 + 7;

struct GCDInfo {
    long long x;
    long long y;
    long long g;
    GCDInfo(long long px, long long py, long long pg) : x(px), y(py), g(pg) {
    }
};

GCDInfo gcd(long long a, long long b) {
    if (b == 0) {
        return GCDInfo(1, 0, a);
    }

    // ax+by = g
    // bx'+(a-a/b*b)y' = g
    GCDInfo v = gcd(b, a%b);
    return GCDInfo(v.y, v.x-(a/b)*v.y, v.g);
}

// Get a * x mod p = 1
long long findInv(long long a, long long p) {
    return gcd(a, p).x;
}

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

    const long long MOD = 1000000000 + 7;
    vector <long long> fact(M+1);
    fact[0] = 1;

    for (int v = 1; v <= M; ++v) {
        fact[v] = (fact[v-1] * v) % MOD;
    }

    // K => the Same in A & B (P M K)
    // N-K in A or B (P M-K N-K)

    auto getP = [&fact, &MOD] (long long a, long long b) { return (fact[a] * findInv(fact[a-b], MOD)) % MOD; };
    auto getC = [&fact, &MOD, &getP] (long long a, long long b) { return getP(a, b) * findInv(fact[b], MOD) % MOD; };

    long long ans = 0;
    long long sign = 1;

    for (int k = 0; k <= N; ++k) {
        long long combK = getC(M, k) * getP(N, k) % MOD;
        long long combA = getP(M-k, N-k) % MOD;

        ans += sign * (combK*combA%MOD) * combA % MOD;
        sign *= -1;
        ans %= MOD;
    }

    cout << (ans%MOD + MOD) % MOD << endl;

    return 0;
}

Measured memory_bytes: 7088
// インクルード(GCC only)
#include <bits/stdc++.h>

// 長い型名
using namespace std;
typedef long long LL;

// 省略記法
#define INF 1e9
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i##_len=(n), i=(i##_len-1); i>=0; --i)
#define FOR(i,m,n) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define sizei(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define printvector(x) rep(i,sizei(x)){cout << x[i] << endl;}
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; }

// mod付き四則演算(mod関数のオーバーヘッドが重いかも)
// TODO: 二項係数、離散対数、平方剰余の実装
#define MOD 1000000007
inline LL mod(LL const &a) { return (a % MOD + MOD) % MOD; }
inline LL madd(LL const &a, LL const &b) { return mod(mod(a) + mod(b)); }
inline LL msub(LL const &a, LL const &b) { return mod(mod(a) - mod(b)); }
inline LL mmul(LL const &a, LL const &b) { return mod(mod(a) * mod(b)); }
inline LL mpow(LL a, LL b) {
  LL r = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) (r *= a) %= MOD;
    (a *= a) %= MOD;
  }
  return r;
}
inline LL minv(LL const &a) { return mpow(a, MOD-2); }
inline LL mdiv(LL const &a, LL const &b) { return mod(mod(a) * minv(b)); }


// デバッグ用
#ifdef LOCAL
    #define eprint(...) fprintf(stderr, __VA_ARGS__)
    #define eprintvector(x) printvector(x)
#else
    #define eprint(...) 42
    #define eprintvector(x) 42
#endif

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

  vector<int> H(N);
  rep(i, N) {
    cin >> H[i];
  }

  int count = 1;
  rrep(i, N) {
    rrep(j, i) {
      if (H[i] < H[j]) {
        break;
      }
      if (j == 0) {
        count ++;
      }
    }
  }

  cout << count << endl;

  return 0;
}


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

const int N = 200005, Tlg = 36;
const long long inf = 1e17;
int n, t, x, y, ni, m, fp;
vector<pair<long double, pair<int, int> > > v;
vector<int> ve;
long long dp[N][Tlg], nb[N];
bool bn;

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> t;
	for(int i = 0; i <= n; ++i) {
		if(i) cin >> x >> y;
		else x = 1000000001, y = 0;
		if(x) v.push_back({(long double)x / (y + 1), {x, y}});
		else ve.push_back(y);
	}
	m = v.size(); --m;
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	for(int i = 1; i < Tlg; ++i) dp[0][i] = -1;
	for(int i = 1; i < v.size(); ++i) {
		for(int j = 1; j < Tlg; ++j) {
			dp[i][j] = min((dp[i - 1][j - 1] == -1 ? inf : (dp[i - 1][j - 1] + 1 + (dp[i - 1][j - 1] + 1) * v[i].second.first + v[i].second.second)), (dp[i - 1][j] == -1 ? inf : dp[i - 1][j]));
			if(dp[i][j] > t) dp[i][j] = -1;
			//if(dp[i][j] == inf) dp[i][j] = -1;
		}
	}
	sort(ve.begin(), ve.end());
	for(int i = 0; i < ve.size(); ++i) {
		++ni;
		nb[ni] = nb[ni - 1] + 1 + ve[i];
	}
	for(int i = 0; i < Tlg; ++i) {
		if(dp[m][i] != -1) {
			for(int j = 0; j <= ni; ++j) {
				if(dp[m][i] + nb[j] <= t) {
					fp = max(fp, i + j);
				}
			}
		}
	}
	cout << fp << endl;
	return 0;
}


Measured memory_bytes: 64744
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int m1=sc.nextInt();
int d1=sc.nextInt();
int m2=sc.nextInt();
int d2=sc.nextInt();
if(m1==1 && d1==31 || m1==3 && d1==31 || m1==5 && d1==31 || m1==7 && d1==31 || m1==8 && d1==31 || m1==10 && d1==31 || m1==12 && d1==31 || m1==4 && d1==30 || m1==6 && d1==30 || m1==9 && d1==30 || m1==11 && d1==30 || m1==2 && d1==28)
System.out.println(1);
else
System.out.println(0);
}

}



Measured memory_bytes: 23764
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll a,c=0;cin>>a;
  
  string b;cin>>b;
  c+=b[3]-'0';
  c+=10*(b[2]-'0');
  c+=100*(b[0]-'0');


  cout<<a*c/100<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?


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

namespace D2
{
    class Program
    {
        static void Main()
        {
            var nw = Console.ReadLine().Split().Select(int.Parse).ToList();
            var N = nw[0];
            var W = nw[1];
            var w = new List<int>();
            var v = new List<int>();
            w.Add(0);
            v.Add(0);
            for (int i = 0; i < N; ++i)
            {
                var nw2 = Console.ReadLine().Split().Select(int.Parse).ToList();
                w.Add(nw2[0]);
                v.Add(nw2[1]);
            }
            var dp = new decimal[N+10, W+10];
            for (int i = 1; i <= N; ++i)
            {
                for (int j = 0; j <= W; ++j)
                {
                    if (j - w[i] >= 0)
                        dp[i, j] = Math.Max(dp[i - 1, j], dp[i - 1, j - w[i]] + v[i]);
                    dp[i, j] = Math.Max(dp[i, j], dp[i - 1, j]);
                }
            }
            Console.WriteLine(dp[N , W]);
        }
    }
}


Measured memory_bytes: 170720
#include <bits/stdc++.h>
using namespace std;
using LL = int64_t;
using ULL = uint64_t;
using P = pair<string, LL>;
#define rep(i, n) for (LL i = 0; i < (n); ++i)
//#define DEBUG

LL f(const string &s_orig, const string &&s_exp, const LL depth) {
  #ifdef DEBUG
  cout << s_exp << endl;
  #endif
  if (depth == s_orig.size()) {
    LL sum = 0;
    LL head = 0;
    while (s_exp.find('+', head) != string::npos) {
      auto plus_pos = s_exp.find('+', head);
      sum += stoll(s_exp.substr(head, plus_pos - head));
      head = plus_pos + 1;
    }
    sum += stoll(s_exp.substr(head, s_exp.size() - head));
    return sum;
  } else {
    return f(s_orig, s_exp + "+" + s_orig[depth], depth + 1)
           + f(s_orig, s_exp + s_orig[depth], depth + 1);
  }
}


int main() {
  string s;
  cin >> s;
 
  cout << f(s, string("") + s[0], 1) << endl;

  #ifdef DEBUG
  #endif
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
vector<int> v(13);
vector<int> now;
int ans = 0;

void g() {
    int val = 25;
    for(int i = 0; i < now.size(); i++) {
        for(int j = i + 1; j < now.size(); j++) {
            int delta = abs(now[i] - now[j]);
            chmin(val, min(delta, 24 - delta));
        }
    }
    chmax(ans, val);
}

void f(int index) {
    if(index == 13) {
        g();
        return;
    }
    if(v[index] == 0) f(index + 1);
    if(v[index] == 1) {
        now.push_back(index);
        f(index + 1);
        now.pop_back();
        now.push_back(24 - index);
        f(index + 1);
        now.pop_back();
    }
    if(v[index] == 2) {
        now.push_back(index);
        now.push_back(24 - index);
        f(index + 1);
        now.pop_back();
        now.pop_back();
    }
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    v[0]++;
    for(int i = 1; i <= N; i++) {
        int D;
        cin >> D;
        if(v[D] == 2) {
            cout << 0 << endl;
            return 0;
        }
        v[D]++;
    }
    f(0);
    cout << ans << endl;
    return 0;
}


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

int main()
{
  int a, b;
  cin >> a >> b ;
  if ( a > 0 )
    {
    cout <<"Positive"<<endl; 
    }
  else if ( b < 0 )
  {
   if ( abs(b + a)%2  == 0 )
     {
     cout <<"Negative"<<endl;
     }
   else if ( abs(b + a)%2  == 1 )
     {
      cout <<"Positive"<<endl;
     }
  }
  else if ( a <= 0 <= b )
    { 
     cout <<"Zero"<<endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct data{ int mp,damage; };
#define INF (1e9)
int N,M;
int HP[100];
vector< data > single,all;
 
int dp[100001];
int dp2[100001];
 
int main(){
   
  int b,d;
  string a,c;
  while(1){
    cin>>N;
    single.clear();
    all.clear();
    if(N==0)break;
    for(int i=0;i<N;i++)cin>>HP[i];
 
    cin>>M;
    for(int i=0;i<M;i++){
      cin>>a>>b>>c>>d;
      if(d==0)continue;
      if(c=="Single"){
    single.push_back( (data){b,d} );
      }else{
    all.push_back( (data){b,d} );
      }
    }
    for(int i=0;i<=100000;i++)dp[i]=dp2[i]=INF;
    dp[0]=dp2[0]=0;
 
 
    for(int i=0;i<(int)single.size();i++){
      data d=single[i];
      for(int j=0;j<=100000;j++){
    if(j-d.damage<=0)dp[j]=min(dp[j],d.mp);
    else dp[j]=min(dp[j],dp[j-d.damage]+d.mp);
      }
    }
    for(int i=0;i<(int)all.size();i++){
      data d=all[i];
      for(int j=0;j<=100000;j++){
    if(j-d.damage<=0)dp2[j]=min(dp2[j],d.mp);
    else dp2[j]=min(dp2[j],dp2[j-d.damage]+d.mp);
      }
    }
 
    int ans=INF,sum;
    for(int i=0;i<=100000;i++){
      if(dp2[i]==INF)break;
      sum=0;
      for(int j=0;j<N;j++){
    if(HP[j]<=i)continue;
    if(dp[HP[j]-i]==INF){sum=INF;break;}
    sum+=dp[HP[j]-i];
      }
       
      ans=min(ans,dp2[i]+sum);
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;

double EPS = 1e-10;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }
};

struct segment{
  point a,b;
};

double dot(point a, point b) {
  return (a.x * b.x + a.y * b.y);
}

double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

int ccw(point p0, point p1, point p2){
  point a = p1 - p0;
  point b = p2 - p0;
  if(cross(a,b)>EPS)return +1;
  if(cross(a,b)<EPS)return -1;
  if(dot(a,b)<-EPS)return +2;
  if(a.x*a.x+a.y*a.y<b.x*b.x+b.y*b.y)return -2;
  return 0;
}

int point_contain(segment* ps, point p, int n){
  int cnt=ccw(ps[0].a,ps[0].b,p);

  for(int i=0;i<n;i++)
    if(cnt!=ccw(ps[i].a,ps[i].b,p))return 0;
  
  return 1;
}

int main(void){
  int n;
  point p[3],k,s;
  segment seg[3];

  cin >> n;
  while(n--){
    for(int i=0;i<3;i++)
      cin >> p[i].x >> p[i].y;
    
    cin >> k.x >> k.y >> s.x >> s.y;
    int cnt=0,l=0;
    for(int i=0;i<3;i++)
      for(int j=0;j<3;j++)
	for(int k=0;k<3;k++)
	  if(i!=j && i!=k && j!=k){
	    if(ccw(p[i],p[j],p[k])==1){
	      seg[i].a=p[i];
	      seg[i].b=p[j];
	      l++;
	    }
	}
     

    if(point_contain(seg,k,l)!=point_contain(seg,s,l))cout << "OK" << endl;
    else cout << "NG" << endl;
    
  }

  return 0;
}

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

using namespace std;

int main(){
  int n, l;
  vector<string> strs;

  cin >> n >> l;
  for(int i=0; i<n; i++){
    string temp;
    cin >> temp;
    strs.push_back(temp);
  }

  sort(strs.begin(), strs.end());

  string ans;
  for(int i=0; i<n; i++){
    string temp = strs.at(i);
    ans = ans + temp;
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 256
// In god we trust
 
#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>
#include <signal.h>
#include <thread>
#include <pthread.h>
#include <omp.h>
 
#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define Q queue
#define Qi Q<int>
#define INF 1000000000 
#define LINF 1000000000000000000
#define int long long
#define _USE_MATH_DEFINES
using namespace std;
using namespace std::chrono;

unordered_map<int, int> factor(int n){
  int cnt = 0;
  unordered_map<int, int> m;
  int nn = n;
  while (!(nn & 1))
    cnt++, nn /= 2;
  if(cnt)
    m[2] = cnt;
  for (int i = 3; i <= sqrt(n); i++){
    cnt = 0;
    while(nn % i == 0)
      nn /= i, cnt++;
    if (cnt)
      m[i] = cnt;
  }
  if (nn > 2)
    m[nn] = 1;
  
  return m;
}



Vi g[200100];
bool visited[200100];

int dfs(int v, int par = -1){
  visited[v] = true;
  int cnt = 1;
  for (auto item: g[v])
    if (item != par and not visited[item])
      cnt += dfs(item, v);
  return cnt;
}


bool red[200100];

signed main(){
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL);
  cout << fixed;
  cout.precision(12);
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double tetha = abs(h / 12. + m / 60. / 12. - m / 60.) * 2 * M_PI;
  cout << sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(tetha)) << endl;

}


Measured memory_bytes: 8896
// AOJ 099: Surf Smelt Fishing Contest II
// 2019.9.29 bal4u

#include <stdio.h>
#include <stdlib.h>

#if 1
int getchar_unlocked(void);
int putchar_unlocked(int c);
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in() {  // 整数の入力
	int n = 0, c = gc();
	while (c <= ' ') c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n) { // 非負整数の表示（出力）
	int i; char b[30];

	if (!n) pc('0');
	else {
		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
}


#define MAX 1000005
typedef struct { int x, qid; char f; } T; // 得点、キューでの位置、新規登録か
T tbl[MAX];


#define QSIZE MAX
#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

typedef struct { int id, key; int idx; } QUE;
QUE que[QSIZE+5]; int qsize;

//void idx_update(int idx, int pos);
#define idx_update(idx, pos) (tbl[idx].qid = pos)

void max_heapify(int i) {
	int l, r, max;
	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && (que[l].key > que[i].key
		|| (que[l].key == que[i].key && que[l].id < que[i].id))) max = l;
	else max = i;
	if (r < qsize && (que[r].key > que[max].key ||
		(que[r].key == que[max].key && que[r].id < que[max].id))) max = r;
	if (max != i) {
		idx_update(que[i].idx, max);
		idx_update(que[max].idx, i);
		QUE t = que[i]; que[i] = que[max], que[max] = t;
		max_heapify(max);
	}
}

void deq(void) {
	que[0] = que[--qsize];
	idx_update(que[qsize].idx, 0);
	max_heapify(0);
}

void qup(int i) {
	int max;
	while (i > 0 && (que[max = PARENT(i)].key < que[i].key
		|| (que[max].key == que[i].key && que[max].id > que[i].id))) {
		idx_update(que[i].idx, max);
		idx_update(que[max].idx, i);
		QUE t = que[i]; que[i] = que[max], que[max] = t;
		i = max;
	}
}
	
void enq(int id, int x, int idx) {
	int i = qsize++;
	que[i].id = id, que[i].key = x, que[i].idx = idx;
	idx_update(idx, i);
	qup(i);
}

void pri_update(int qid, int x) {
	QUE t = que[qid]; que[qid].key = x;
	if (x < t.key) max_heapify(qid);
	else           qup(qid);
}

int main()
{
	int n, q, a, v;

	n = in(), q = in();
	while (q--) {
		a = in(), v = in();

		tbl[a].x += v;
		if (tbl[a].f == 0) tbl[a].f = 1, enq(a, tbl[a].x, a);
		else pri_update(tbl[a].qid, tbl[a].x);

		out(que[0].id), pc(' '), out(que[0].key), pc('\n');
	}
	return 0;
}



Measured memory_bytes: 14432
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    int64 N,A,B,C,D;
    cin>>N>>A>>B>>C>>D;
    string s;
    cin>>s;
    A--;
    B--;
    C--;
    D--;
    bool f1,f2,f3,f4,fs,ft,fj;
    f1=f2=f3=f4=true;
    fs=ft=fj=false;
    if(C<D){
        for(int64 i=A;i<C;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                f1=false;
                break;
            }
        }
        for(int64 i=B;i<D;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                f2=false;
                break;
            }
        }
        if(f1&&f2){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
        
    }else{
        for(int64 i=A;i<C;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                f1=false;
                break;
            }
        }
        for(int64 i=B;i<D;i++){
            if(s[i]=='#'&&s[i+1]=='#'){
                f2=false;
                break;
            }
        }
        if(B==D-1){
            if(s[B-1]=='.'||s[D-1]=='.'){
                fj=true;
            }
        }else{
            for(int64 i=B-1;i<=D-1;i++){
                if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.'){
                    fj=true;
                    break;
                    
                }
            }
        }
        if(f1&&f2&&fj){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
string alphabet = "abcdefghijklmnopqrstuvwxyz";
string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
 int a , b;
 cin >> a >> b;
 if(a <= 8 && b <= 8)cout << "Yay!" << endl;
 else cout << ":(" << endl;
}

Measured memory_bytes: 256
n = int(input())

a = []

top_num = 0
second_num = 0

for _ in range(n):
    a_i = int(input())
    if a_i >= top_num:
        second_num = top_num
        top_num = a_i
    else:
        second_num = max(a_i, second_num)
    a.append(a_i)

for a_i in a:
    if a_i == top_num:
        print(second_num)
    else:
        print(top_num)

Measured memory_bytes: 12532
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


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

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}

int main() {
	cin >> n;
	vector<ll> a(n);
	vector<ll> b(n-1);
	ll res = 0;
	rep(i, n-1) {
		cin >> b[i];
		a[i] = ma;
	}
	a[0] = b[0];
	a[1] = b[0];
	a[n - 1] = b[n - 2];
	rep(i, n-2) {
		a[i + 1] = b[i];
		chmin(a[i + 1], b[i + 1]);
	}
	rep(i, n) {
		res += a[i];
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
using i64 = long long;
using f64 = double;

#define FOR(i, s, n) for (size_t i = (s); i < (size_t)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

template <typename T, typename U>
inline bool chmax(T &a, U b) {
  return a < b ? (a = b, true) : false;
}

template <typename T, typename U>
inline bool chmin(T &a, U b) {
  return a > b ? (a = b, true) : false;
}

int main() {
  string s;
  cin >> s;
  if (s.back() == 's') {
    s += "es";
  } else {
    s += "s";
  }

  cout << s;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int n;
	vector<vector<int>> abc(100001, vector<int>(4));
	cin >> n;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < 3; j++)
			cin >> abc[i][j];

	vector<vector<int>> dp(100001, vector<int>(4));
	dp[0][0] = abc[0][0];
	dp[0][1] = abc[0][1];
	dp[0][2] = abc[0][2];
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			int x, y;
			switch (j) {
			case 0:
				x = 1; y = 2;
				break;
			case 1:
				x = 0; y = 2;
				break;
			case 2:
				x = 0; y = 1;
				break;
			}

			dp[i][j] = max(dp[i - 1][x], dp[i - 1][y]) + abc[i][j];
		}
	}
	cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;
}

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

int main() {
  int X,Y;
  cin>>X>>Y;
  if (Y>=2*X&&(Y-2*X)%2==0&&(4*X-Y)>=0) {
    cout <<"Yes" <<endl;
  }
  else {
    cout <<"No" <<endl;
  }
}

Measured memory_bytes: 3568
import math
import sys

while True:
	try:
		a,b = map(int, input().split())
		p = a
		q = b
		while True:
			r = p%q
			if r == 0:
				x = q
				break
			else:
				p = q
				q = r
		i = 1
		while True:
			if a*i%b == 0:
				y = a*i
				break
			else:
				i = i+1
		print(x,y)
	except EOFError:
		break

Measured memory_bytes: 7772
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    priority_queue<double,vector<double>,greater<double> >que;
    for(int i=0;i<n;i++){
        double v;
        cin >> v;
        que.push(v);
    }
    while(que.size()>1){
        double a = que.top();
        que.pop();
        double b = que.top();
        que.pop();
        que.push((a+b)/2);
    }
    cout<<que.top()<<endl;
}

Measured memory_bytes: 3808
N = int(input())
A = list(map(int,input().split()))
count =0
for i in range(N):
    minj = i
    for j in range(i,N):
        if A[j] < A[minj]:
            minj = j
    if minj != i:
        dummy = A[i]
        A[i] = A[minj]
        A[minj] = dummy
        count +=1
for i in range(N-1):
    print(f"{A[i]}",end=" ")
print(f"{A[N-1]}\n{count}")


Measured memory_bytes: 5616
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
const ll mod=1e9+7;
int n,vis[200001],x;
int main()
{
	scanf("%d",&n);
	for(int i=2;i<=n;i++){
		scanf("%d",&x);
		vis[x]++;
	}
	for(int i=1;i<=n;i++)
		printf("%d\n",vis[i]);
	return 0;
}

Measured memory_bytes: 4496
'use strict'

function main(input) {

    let ary = input.split(' ').map(v => ~~v)

    let a = ary.reduce((x, y) => x + y)
    let b = ary.reduce((x, y) => x - y)
    let c = ary.reduce((x, y) => x * y)

    let ans = Math.max(a, b, c)
    console.log('%d',ans)
}

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

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

int main(void){
  int n;
  cin>>n;
  double h;
  int Dist[6]={0};
  for(int i=0;i<n;i++){
    cin>>h;
    if (h<165.0){
      Dist[0]+=1;
    }
    else if(h<170.0){
      Dist[1]+=1;
    }
    else if(h<175.0){
      Dist[2]+=1;
    }
    else if(h<180.0){
      Dist[3]+=1;
    }
    else if(h<185.0){
      Dist[4]+=1;
    }
    else{
      Dist[5]+=1;
    }
  }
  for(int i=0;i<6;i++){
    cout<<i+1<<":";
    for(int j=0;j<Dist[i];j++){
      cout<<"*";
    }
    cout<<endl;
  }
  return 0;
}



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

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

	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a.at(i);
	}

	sort(a.begin(), a.end(), greater<int>());

	int ans = 0;
	for (int i = 0; i < a.size(); i++) {
		ans += (i % 2 == 0 ? a.at(i) : -a.at(i));
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <cmath>
#include <queue>
#include <set>
#include <map>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

std::map<ll,ll> dp;
std::set<ll> pq;

ll const inf = 1000000000000000000;

void update(ll pos, ll val) {
  pq.insert(pos);
  if(dp.find(pos) == dp.end())
    dp[pos] = val;
  else
    dp[pos] = std::min(dp[pos], val);
}

void solve() {
  dp.clear();
  pq.clear();

  ll n, a, b, c, d;
  std::cin >> n >> a >> b >> c >> d;
  ll result = inf;
  dp[n] = 0; 
  pq.insert(n);

  while(0 < pq.size()) {
    std::set<ll>::iterator it = pq.end();
    it--;
    ll node = *it;
    pq.erase(it);
    if(d <= inf / node)
      result = std::min(result, dp[node] + d * node);

    if(node < 2)
      break;

    int rest = node % 2;

    update((node - rest) / 2, dp[node] + rest * d + a);
    update((node + (2 - rest) % 2) / 2, dp[node] + (2 - rest) % 2 * d + a);
    
    rest = node % 3;
    update((node - rest) / 3, dp[node] + rest * d + b);
    update((node + (3 - rest) % 3) / 3, dp[node] + (3 - rest) % 3 * d + b);

    rest = node % 5;
    update((node - rest) / 5, dp[node] + rest * d + c);
    update((node + (5 - rest) % 5) / 5, dp[node] + (5 - rest) % 5 * d + c);
    
  }
  std::cout << result << '\n';
}

int main() {
  int t;
  std::cin >> t;
  for(int testcase = 1; testcase <= t; testcase++)
    solve();
}


Measured memory_bytes: 4464
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define llin(a) cin >> a
#define llpr(a) cout << a << " "
#define llout(a) cout << a << endl
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define M 1000000007
#define N 305  //check the limits, man
// read the constraint properly (ll vs int)
typedef long long int ll;
double dp[N][N][N];
int n;
double expected(int a,int b,int c)
{
    if(a<0 || b<0 || c<0)
        return 0;
    if(a==0 && b==0 && c==0)
        return 0;
    if(dp[a][b][c]>0)
        return dp[a][b][c];
    //pr(a),pr(b),out(c);
    dp[a][b][c]=n;
    dp[a][b][c]+=(expected(a-1,b,c)*a);
    dp[a][b][c]+=(expected(a+1,b-1,c)*b);
    dp[a][b][c]+=(expected(a,b+1,c-1)*c);
    dp[a][b][c]/=(a+b+c);
    return dp[a][b][c];
}
int main()
{
    int x,i,a,b,c;
    in(n);
    a=0,b=0,c=0;
    rep(i,n)
    {
        in(x);
        if(x==1)a++;
        if(x==2)b++;
        if(x==3)c++;
    }
    cout << setprecision(10) << fixed;
    llout(expected(a,b,c));
}


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

int main(){
  int n, i, j;
  char num[201], mes[201];
  char con[6][5] = {"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "};

  while(scanf("%s", num) != EOF){
    if(strlen(num) % 2 != 0){
      puts("NA");
    }else{
      for(i = 0;i < strlen(num);i += 2){
	if(num[i] - '1' < 0 || num[i] - '1' > 5 || num[i + 1] - '1' < 0 || num[i + 1] - '1' > 4){
	  i = 999;
	  puts("NA");
	}
	else
	  mes[i / 2] = con[num[i] - '1'][num[i + 1] - '1'];
      }
      if(i < 999){
	mes[i / 2] = '\0';
	puts(mes);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<algorithm>

using namespace std;

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

Measured memory_bytes: 256
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int e(int a[][10],int d[][10],int x,int y,int c){
  if(a[x][y]==c&&d[x][y]==0){
    d[x][y]=1;
    return 1+e(a,d,x-1,y,c)+e(a,d,x,y-1,c)+e(a,d,x+1,y,c)+e(a,d,x,y+1,c);
  }else
    return 0;
}
void g(int a[][10],int x,int y,int c,int d){
  if(a[x][y]==d){
    a[x][y]=c;
    g(a,x-1,y,c,d);
    g(a,x,y-1,c,d);
    g(a,x+1,y,c,d);
    g(a,x,y+1,c,d);
  }
  return;
}
int f(int a[][10],int c,int p){
  int i;
  int b[10][10],d[10][10];
  int mx=0;
  if(0){
  }else if(p<3){
    for(i=1;i<7;i++){
      if(i!=a[1][1]){
	memcpy(b,a,sizeof(b));
	g(b,1,1,i,a[1][1]);
	int t;
	t=f(b,c,p+1);
	if(mx<t)
	  mx=t;
      }
    }
  }else if(p==3){
    for(i=1;i<7;i++){
      if(i!=a[1][1]&&i!=c){
	memcpy(b,a,sizeof(b));
	g(b,1,1,i,a[1][1]);
	int t;
	t=f(b,c,p+1);
	if(mx<t)
	  mx=t;
      }
    }
  }else if(p==4){
    memcpy(b,a,sizeof(b));
    g(b,1,1,c,a[1][1]);
    memset(d,0,sizeof(d));
    mx=e(b,d,1,1,b[1][1]);
  }
  return mx;
}
int main(){
  int i,j;
  int a[10][10],w,h,c;
  while(cin>>h>>w>>c&&h+w+c){
    memset(a,0,sizeof(a));
    for(i=1;i<h+1;i++)
      for(j=1;j<w+1;j++)
	cin>>a[j][i];
    cout<<f(a,c,0)<<endl;
  }
  return 0;
}

Measured memory_bytes: 872