akhauriyash/Code-Regression huggingface dataset:
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <fstream>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	vector<int> a(n); rep(i, n)cin >> a[i], --a[i];
	int res = 0;
	rep(i, n)
	{
		if (i < a[i] && a[a[i]] == i)++res;
	}
	cout << res << endl;
}


Measured memory_bytes: 3760
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline
    ans=99999
    ansd=99999
    x,n=map(int, readline().rstrip().split())

    if n==0:
        print(x)
        return

    p=list(map(int, readline().rstrip().split()))
    for i in range(103):
        if i in p:
            continue
        d=abs(x-i)
        if d < ansd:
            ans=i
            ansd=d

    print(ans)
    #n=int(readline())
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------


Measured memory_bytes: 16220
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int arr[MAXN];
int main()
{
    int n,m;cin>>n>>m;
    int cnt=0;
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];sum+=arr[i];
    }
    sort(arr+1,arr+1+n);
    double k=sum*1.0/(4*m);
    for(int i=n;i>=1;i--)
    {
        if(arr[i]>=k)cnt++;
    }
    if(cnt>=m)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    int lim = (N-1)*(N-2)/2;
    if (lim < K) {
        cout << -1 << endl;
        return 0;
    }

    vector<pair<int, int>> edge, V;
    REP(i, 1, N) {
        edge.push_back(make_pair(1, i+1));
    }

    for (int i = 2, j = i+1; lim > K; --lim) {
        edge.push_back(make_pair(i, j));
        if (j == N) i++, j = i+1;
        else j++;
    }

    cout << edge.size() << endl;
    rep(i, edge.size()) {
        printf("%d %d\n", edge[i].first, edge[i].second);
    }

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define P pair<int,int>
#define mk make_pair
using namespace std;

int main()
{
    string s;
    cin >> s;
    if(s == "ABC")
        cout << "ARC";
    else
        cout << "ABC";
    return 0;
}


Measured memory_bytes: 3624
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var nab = Console.ReadLine().SplittedStringToInt32List();
        var n = nab[0];
        var a = nab[1];
        var b = nab[2];
        var nu = 0;

        if (a + b <= n)
        {
            nu = 0;
        }
        else
        {
            nu = n - a - b;
        }
        Console.WriteLine(Math.Min(a,b) + " " + -nu);

        Console.ReadLine();
    }

    

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;
    
  
  

    public static void PrintArray(int[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < array.GetLength(1); j++)
            {
                sb.Append(array[i, j]).Append(" ");
            }
            Console.WriteLine(sb.ToString());
        }
    }

    #endregion
}



Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
string lcs(string text1, string text2) {
        vector<vector<int>> dp(text1.size()+1,vector<int>(text2.size()+1,0));
        for(int i=1;i<dp.size();i++){
            for(int j=1;j<dp[1].size();j++){
                if(text1[i-1]==text2[j-1]){
                    dp[i][j]= 1+ dp[i-1][j-1];//just before consderng t1[i] & t2[j] lcs length was dp[i-1][j-1;]
                }
                else
                    dp[i][j]= max(dp[i-1][j],dp[i][j-1]);
            }
        }
        //printing lcs;
        int i=dp.size()-1, j=dp[0].size()-1;
        string ans="";
        while(1){
            if(dp[i][j]==0)
                break;
            if(dp[i][j-1]==dp[i][j]){
                --j;
                continue;
            } 
            else if(dp[i-1][j]==dp[i][j] ){ 
                --i;
                continue;
            }
            else if( text1[i-1]==text2[j-1] && dp[i][j]==dp[i-1][j-1]+1){
                ans=text1[i-1]+ans;
                --i;--j;
            }           
        }
        // reverse(ans.begin(),ans.end());
        return ans;
    }
    
    int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s,t;
    cin>>s>>t;
    cout<<lcs(s,t);
}

Measured memory_bytes: 35584
/*
	DSL: domain-specific language
	http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_D
	12/5/2017
	TLE: 17/22 10^10 must change the data structure
*/

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define N 131072 //100000
void find(int i);
void add(int s,int t, int x);
int array[2*N+100];      //the size of array
//BEGIN FROM 1;
int main(){
	int n = 0, q = 0;
	int a,b,c;
	scanf("%d %d",&n,&q);
	//how to calculate the beginning index
	int count = 0;
	int temp = n;
	while(n!=1){
		n = n/2;
		count++;  
	}
	if(pow(2,count)!=temp) count++;
	//printf("count:%d",count);
	int B = pow(2,count)-1;
	for(int i = 1; i<=B;i++){
		array[i] = 0;
	}
	for(int i = 1; i<=n; i++){
		array[i+B] = 0 ;//pow(2,31) - 1;	//e.g.begin from 8
	}
	for(int i = 0; i < q; i++){
		int temp = 0;
		scanf("%d",&temp);
		if(temp==0){
			scanf("%d %d %d",&a,&b,&c);
			add(a+B,b+B,c);
		}
		else if(temp==1){
			scanf("%d",&a);
			find(a+B);
		}
	}
	return 0;
}
//add elements
//s means: left pointer
//t means : right pointer
void add(int s,int t, int x){
	/*for(int i = 1; i<20; i++){
		printf("%2d ", i);
	}printf("\n");
	for(int i = 1; i<20; i++){
		printf("%2d ", array[i]);
	}
	printf("s%d,t%d\n",s,t);*/
	//signle node
	if(s==t) {
		array[s] += x;
		return;
	}
	//range update
	//check the left pointer
	while(s<t){
		//printf("inside loop:s%d,t%d,s%d\n",s,t,x);
		if(s%2==0){ //left child, level up
			s = s/2;
		}else{ //right child: mark and level up + 1
			array[s] += x;
			s = s/2;
			s++;
		}
		
		if(t%2==0){//left child: 
			array[t] += x;
			t = t/2;
			t--;
		} else { //right child
			t/= 2; 	
		}
		if(s==t) array[s] +=x;// works for 1-4,1-3, 1-5
		//printf("inside loop:s%d,t%d,s%d\n",s,t,x);
	}
	
	//test for 
	/*for(int i = 1; i<20; i++){
		printf("%2d ", i);
	}printf("\n");
	for(int i = 1; i<20; i++){
		printf("%2d ", array[i]);
	}*/
	
}

void find(int i) {
	int res = 0;
	while(i>=1){
		res+=array[i];
		i = i/2;
	}
	printf("%d\n", res);
}

Measured memory_bytes: 3716
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

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


	int N = getint();

	int A[1000001] = {};
	rep(i, N) A[getint()]++;

	int kotae = 0;
	rep1(i, 1000000) {
		if (A[i]) {
			if (A[i] == 1) kotae++;
			for (int j = i + i; j <= 1000000; j += i) {
				A[j] = 0;
			}
		}
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 7684
from collections import deque
S = input()
Q = int(input())
t = []
f = []
c = []
for i in range(Q):
    in_ = list(input().split())
    if in_[0] == "1":
        t.append(1)
        f.append(0)
        c.append(0)
    else:
        t.append(2)
        f.append(int(in_[1]))
        c.append(in_[2])
acc = [0 for _ in range(Q)]
if t[-1] == 1:  acc[-1] = 1
for i in reversed(range(Q - 1)):
    if t[i] == 1:
        acc[i] = acc[i + 1] + 1
    else:
        acc[i] = acc[i + 1]
        
if acc[0] % 2 == 0:
    ans = deque(S)
else:
    ans = deque(S[::-1])
    
for i in range(Q):
    if t[i] == 2:
        if (f[i] + acc[i]) % 2 == 1:
            ans.appendleft(c[i])
        else:
            ans.append(c[i])
print("".join(ans))

Measured memory_bytes: 143548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;

int n;
int main(){
  cin >> n;
  int ans=0;
  int h = -1;
  rep(i, n){
    int k;
    cin >> k;
    if(k >= h) ans++;
    h = max(h, k);
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
c = input()
if 'a' in c:
    print('vowel')
elif 'e' in c:
    print('vowel')
elif 'i' in c:
    print('vowel')
elif 'o' in c:
    print('vowel')
elif 'u' in c:
    print('vowel')
else:
    print('consonant')


Measured memory_bytes: 9080
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var XY = ReadSplitInt();
            Println(XY[1] / 2 + XY[0]);
        }


        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 11220
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) { stderr.writeln(arg); }
int size(T)(in T s) { return cast(int)s.length; }

void main() {
    int N; readf("%d\n", &N);
    int ans = 0;
    foreach (i; 0 .. N) {
        int a, b;
        readf("%d %d\n", &a, &b);
        ans += b - a + 1;
    }
    writeln(ans);
}


Measured memory_bytes: 256
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
A=n1()

A.sort(reverse=True)
ans=A[0]
m=n-2
i=1
while m>0:
    a=A[i]
    ans+=a
    m-=1
    if m>0:
        ans+=a
        m-=1
    i+=1
print(ans)

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

int main() {
	// your code goes here
	char c;
	cin>>c;
	if(c>='a' && c<='z')
        cout<<'a'<<endl;
    else if(c>='A' && c<='Z')
        cout<<'A'<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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 int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<int, LL>> p(n);
    rep(i, n) cin >> p[i].first >> p[i].second;
    sort(all(p));

    LL ans = 0;
    int now = 0;
    priority_queue<LL> pq;

    rep1(i, m+1){
        while(now < n && p[now].first <= i){
            pq.push(p[now].second);
            now++;
        }
        if(pq.empty()) continue;
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;





}

Measured memory_bytes: 2936
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

const ll INF = 2e12;

int main() {
    ll A, B; cin >> A >> B;
    int Q; cin >> Q;
    vector<ll> s(A), t(B);
    rep(i, A) cin >> s[i];
    rep(i, B) cin >> t[i];
    ll x;

    rep(_, Q) {
        cin >> x;

        ll leftS, leftT, rightS, rightT;

        int sx = lower_bound(ALL(s), x) - s.begin();
        int tx = lower_bound(ALL(t), x) - t.begin();

        if (sx > 0) leftS = x-s[sx-1];
        else leftS = INF;
        if (tx > 0) leftT = x-t[tx-1];
        else leftT = INF;

        if (sx < s.size()) rightS = s[sx]-x;
        else rightS = INF;
        if (tx < t.size()) rightT = t[tx]-x;
        else rightT = INF;

        ll ans = min({max(leftS, leftT), max(rightS, rightT),
                2*leftS+rightT, 2*rightT+leftS, 2*leftT+rightS, 2*rightS+leftT});

        cout << ans << endl;
    }
}


Measured memory_bytes: 4796
#include<cstdio>
#include<iostream>
using namespace std;
char a[5][5];
int main()
{
	int n;
	scanf("%d",&n);
	if(n%10==9||n/10==9)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
} 

Measured memory_bytes: 256
import java.util.*;
public class Main {
	static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		for (;;) {
			int M = in.nextInt();
			int D = in.nextInt();
			if ((M|D)==0) break;
			Calendar c = Calendar.getInstance();
			c.clear();
			c.set(2004, M-1, D);
			String ans = "";
			switch (c.get(Calendar.DAY_OF_WEEK)) {
				case Calendar.SUNDAY:
					ans = "Sunday";
					break;
				case Calendar.MONDAY:
					ans = "Monday";
					break;
				case Calendar.TUESDAY:
					ans = "Tuesday";
					break;
				case Calendar.WEDNESDAY:
					ans = "Wednesday";
					break;
				case Calendar.THURSDAY:
					ans = "Thursday";
					break;
				case Calendar.FRIDAY:
					ans = "Friday";
					break;
				case Calendar.SATURDAY:
					ans = "Saturday";
					break;
				default:
					ans = "";
					break;
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 17288
#include "bits/stdc++.h"
using namespace std;

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < 4; i++) {
        cout << s[i];
    }
    cout << " ";
    for (int i = 4; i < 12; i++) {
        cout << s[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll n, arr[100005], res = 1;

int main() {
	fastio; cin >> n;
	FOR(i, 1, n) cin >> arr[i];
	sort(arr+1, arr+n+1);
	FOR(i, 1, n) {
		ll a = arr[i];
		if ((ld) res > (ld) LLINF/a) {
			cout << -1;
			return 0;
		}
		res *= a; 
	}
	cout << res;
}


Measured memory_bytes: 4436
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>
#include<bitset>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++) //0から
#define REP(i,n) for(int j=i;j<n;j++) //iから

typedef long long ll;



//英字ならture、数字ならfalse
bool isalpha(char s){
    if(('A'<=s&&s<='Z')||('a'<=s&&s<='z')){
        return 1;
    }else{
        return 0;
    }
}
//全ての文字が英字ならture、数字ならfalse
bool Isalpha(string s){
    ll n;
    bool tmp = true;
    rep(i,n){
        if(isalpha(s[i])){
            tmp = false;
        }
    }
    return tmp;
}




using Graph = vector<vector<ll>>;



//cout<<fixed<<setprecision(10);

ll binary_search(vector<ll> a, ll n, ll key){
    ll right = n, left = -1;
    ll md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}



int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll m = 0;
    rep(i,n){
        cin>>a[i];
        m = max(m,a[i]);
    }

    vector<bool> p(m+1,true);

    sort(a.begin(),a.end());
    rep(i,n-1){
        if(a[i]==a[i+1]){
            p[a[i]] = false;
        }
    }

    rep(i,n){
        ll num = 2*a[i];
        while(num<=m){
            p[num] = false;
            num+=a[i];
        }
    }

    ll ans = 0;
    rep(i,n){
        if(p[a[i]]){
            ans++;
        }
    }

    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 4824
inp = input().split()

N = int(inp[0])
x = int(inp[1])
y = int(inp[2])

ans = []
ans.append(min(x,y))

if x+y > N:
  ans.append(x+y-N)
else:
  ans.append(0)

print("{} {}".format(ans[0], ans[1]))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, i;
    cin >> n;
    vll a(n), b(n);
    for(i = 0; i < n; i++)
    {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(all(b));
    for(i = 0; i < n; i++)
    {
        ll index = lower_bound(all(b), a[i]) - b.begin();
        if(index == n - 1)
            cout << b[n - 2] << endl;
        else
            cout << b[n - 1] << endl;
    }
    return 0;
}

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

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;

///////////////////////////////////
///// for any code taken from cheatsheet

/////


int main()
{
	// freopen("input.in", "r", stdin);
	
	int h, w, n; scanf("%d %d %d", &h, &w, &n);
	printf("%d\n", (n+max(h,w)-1)/max(h,w));
}

Measured memory_bytes: 256
N = int(input())
H = [int(h) for h in input().split()]

for i in reversed(range(1, N)):
    if H[i] >= H[i-1]: continue
    elif H[i] == H[i-1] - 1: H[i-1] -= 1
    else:
        print("No")
        break
else: print("Yes")


Measured memory_bytes: 14396
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	// your code goes here
	int n,m;
	cin>>n;
	while(n!=0){
		vector<pair<int,int> > ve;
		int h,r;
		for(int i=0;i<n;i++){
		cin>>h>>r;
		ve.push_back(make_pair(h,r));
		}
		cin>>m;
		for(int i=0;i<m;i++){
		cin>>h>>r;
		ve.push_back(make_pair(h,r));
		}
		sort(ve.begin(), ve.end());
		int dp[1010][1010]={0};
		
		for(int y=0;y<n+m;y++){
			h=ve[y].first;
			r=ve[y].second;
			dp[h][r]=max(dp[h-1][r-1]+1,dp[h][r]);
			for(int e=r+1;e<1010;e++) dp[h][e]=max(dp[h][e],dp[h][r]);
			if(y!=n+m-1){
				int hr=ve[y+1].first;
				for(int u=h+1;u<=hr;u++){
					for(int uu=0;uu<1010;uu++){
					dp[u][uu]=dp[h][uu];
					}
				}
				
			}
			
			
			
		}
		
		
		
		cout<<dp[h][1001]<<endl;
		
		cin>>n;
	}
	return 0;
}

Measured memory_bytes: 5196
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> arr = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            arr.add(sc.nextInt());
        }
        System.out.println(cut(arr));
    }

    private static int cut(List<Integer> list) {
        if (list.size() == 0) return 0;

        int retV = 0;

        int min = list.stream().min(Integer::compareTo).get();

        List<ArrayList<Integer>> lists = new ArrayList<>();
        ArrayList<Integer> pushed = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i) == min) {
                lists.add(pushed);
                pushed = new ArrayList<>();
            } else {
                pushed.add(list.get(i) - min);
            }
        }
        lists.add(pushed);
        retV += min;
        for (ArrayList<Integer> list2 : lists) {
            retV += cut(list2);
        }
        return retV;
    }
}

Measured memory_bytes: 28628
#include <iostream>

using namespace std;

int main()
{
   long N,A,B,i=2,ans;
   cin >> N >> A >> B;
   if(N < A) cout << N;
   if(N > A && N <= A+B) cout << A;
   if(N > A+B){
   ans = ((N/(A+B))*A) + min(A , (N%(A+B))) ;
   cout << ans;
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull A, B;

int main() {
  cin >> A >> B;
  if (A % 2 == 0) {
    ull C = (B-A) % 4;
    switch(C){
      case 0: cout << B << endl; break;
      case 1: cout << 1 << endl; break;
      case 2: cout << B+1 << endl; break;
      case 3: cout << 0 << endl; break;
    }
  } else {
    A += 1;
    ull C = (B-A) % 4;
    switch(C){
      case 0: cout << (B^(A-1)) << endl; break;
      case 1: cout << (1^(A-1)) << endl; break;
      case 2: cout << ((B+1)^(A-1)) << endl; break;
      case 3: cout << (0^(A-1)) << endl; break;
    }
  }
}


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

int main() {
   int n;
  
   cin >> n;
  
   if(n==1||n==2||n==3||n==5||n==6||n==9||n==10||n==13||n==17){
     cout << "No" << endl;
   }else{
     cout << "Yes" << endl;
   }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long LL;

int are_remainder_and_quotient_equal(LL n, LL m)
{
    return (m > 0 && n/m == n%m);
}

int main()
{
    LL n;
    cin >> n;

    LL special_number_sum = 0;

    for(LL i = 1; i*i <= n; i++)
    {
        LL factor_1 = i, factor_2 = n/i;

        if(are_remainder_and_quotient_equal(n, factor_1 - 1))
        {
            special_number_sum += factor_1 - 1;
        }

        if(factor_1 == factor_2)
        {
            continue;
        }

        if(are_remainder_and_quotient_equal(n, factor_2 - 1))
        {
            special_number_sum += factor_2 - 1;
        }
    }

    cout << special_number_sum;
    return 0;
}


Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
n,k=map(int,input().split())
h=list(map(int,input().split()))
cost=[float("inf")]*n
cost[0]=0

for i in range(n-1):
    now=h[i]
    for j in range(k):
        if i+j+1>=n:
            break
        cost[i+j+1]=min(abs(now-h[i+j+1])+cost[i],cost[i+j+1])
    # print(cost)
    
print(cost[-1])

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

using namespace std;

int cal(int M, priority_queue<pair<int, int>>& pq) {
	int res = 0;
	while(!pq.empty()) {
		int P = pq.top().first;
		int D = pq.top().second;
		pq.pop();

		if(M  > 0) {
			if(M >= D) {
				M = M - D;
			}else{
				res += (D - M) * P;
				M = 0;
			}
		}else{
			res += D * P;
		}
	}
	return res;
}

int main(void) {
	int N, M;
	while(1) {
		cin >> N >> M;
		if(N == 0 and M == 0) {
			break;
		}

		priority_queue<pair<int, int>> pq;
		int D, P;
		for(int i = 0; i < N; i++) {
			cin >> D >> P;
			pq.push(make_pair(P, D));
		}

		int res = cal(M, pq);
		cout << res << endl;
	}
	return 0;
}
			

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

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

S_list = list(S)
s = S_list[K-1]
new_s = s.lower()
S_list[K-1] = new_s

new_S = "".join(S_list)

print(new_S)

Measured memory_bytes: 3060
import math
a,b,c,d=map(int,input().split())

d_kaku=6*d
c_kaku=30*(c+(d/60))
c_d=abs(d_kaku-c_kaku)
#print(c_d)
if c_d==180:
    e=a+b
    print(e)
elif c_d==0 or c_d==360:
    print(abs(a-b))
elif c_d<180:
#    print(c_d)
    e=math.cos(math.radians(c_d))
    f2=a*a+b*b-2*a*b*e
    print(math.sqrt(f2))

else:
    e=math.cos(math.radians(360-c_d))
#    print(e)
    f2=a*a+b*b-2*a*b*e
    print(float(math.sqrt(f2)))


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

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
	int cnt1=0,cnt2=0;
	string a;
	cin>>a;
	for(int i=0;i<3;i++){
		if(a[i]=='A')cnt1++;
		else cnt2++;
	}
	if((!cnt1)||(!cnt2))cout<<"No";
	else cout<<"Yes";
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

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

    int H, W;
    cin >> H >> W;

    char a[110][110];
    int check[110][110] = {{}};
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> a[i][j];
            if (a[i][j] == '.') check[i][j] = 1;
        }
    }

    char ans[110][110];
    int h = 0;
    int w = 0;
    for (int i = 0; i < H; i++) {

        int x = 0;
        for (int j = 0; j < W; j++) {
            x += check[i][j];
        }
        if (x != W) {
            for (int k = 0; k < W; k++) {
                ans[h][k] = a[i][k];
            }
            h++;
        }
    }



    char ans2[110][110];

    for (int i = 0; i < W; i++) {
        int y = 0;
        for (int j = 0; j < H; j++) {
            y += check[j][i];
        }
        if (y != H) {
            for (int k = 0; k < H; k++) {
                ans2[k][w] = ans[k][i];
            }
            w++;
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (ans2[i][j] == '#' || ans2[i][j] == '.') printf("%c", ans2[i][j]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 384
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];
ll a[N];

int main() {
    FAST;
    ll t, i, j, k, p, q, r, x, y, u, v, n, m;
    cin>>k>>n;

    Ff(i,1,n+1) cin>>a[i];
    a[0]=a[n];
    a[n+1]=a[1];
    // Ff(i,0,n+2)
    // cout<<a[i]<<" ";
    // cout<<endl;
    ll ans=INT_MAX;
    Ff(i,1,n+1)
    {
        if(i==1)
        ans=min({ans,a[i-1]-a[i],k-(a[i+1]-a[i])});
        else if(i==n)
        ans=min({ans,a[i]-a[i+1],k-(a[i]-a[i-1])});
        else
        ans=min({ans,k-(a[i]-a[i-1]),k-(a[i+1]-a[i])});
    }
    cout<<ans;
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define rep(i,n)  for(int i=0;i<n;i++)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
typedef long long ll;
int main() {
    int x; cin >> x;
    int happines = 0;
    while(x > 5){
        if(x >= 500){
            x -=500;
            happines += 1000;
        }
        else if (x > 5){
            x -= 5;
            happines += 5;
        }
        else break;
    }
    cout << happines;
    return 0;
}


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

using namespace std;

int h[100005];

long long memo[100005];

void debug(int n){
    for(int i=1;i<=n;i++){
        cerr << memo[i] << " ";
    }
    cerr << endl;
}

int main(){
    int n, k;
    cin >> n >> k;
    for(int i=0;i<100005;i++){
        memo[i] = INT_MAX;
    }

    memo[1] = 0;

    for(int i=1;i<n+1;i++){
        cin >> h[i];
    }
    for(int i=1;i<n;i++){
        int aux = min(n-i, k);
        for(int j=1; j<=aux; j++){
            memo[i+j] = min(memo[i+j], memo[i]+abs(h[i]-h[i+j]));
        }
        //debug(n);
    }
    cout << memo[n] << endl;

    return 0;
}



Measured memory_bytes: 1408
#include <cstdio>
using namespace std;
int N,P,cur,t=1,cnt[10010],i;char S[200010];long long ans;
int main()
{
    scanf("%d%d%s",&N,&P,S);
    if(P==2||P==5)
	{
        for(i=0;i<N;i++)if((S[i]-'0')%P==0)ans+=i+1;
    }
	else
	{
        cnt[0]=1;
        for(i=N-1;i>=0;i--)
		{
            (cur+=(S[i]-'0')*t)%=P;
            ans+=cnt[cur]++;
            t=t*10%P;
        }
    }
    printf("%lld",ans);
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

llong get_hash(string s)
{
	llong id = 0;
	llong p = 1;
	for (int i = 0; i < s.length(); i++)
	{
		int add = 0;
		if (s.substr(i, 1) == "A")
		{
			add = 1;
		}
		else if (s.substr(i, 1) == "C")
		{
			add = 2;
		}
		else if (s.substr(i, 1) == "G")
		{
			add = 3;
		}
		else if (s.substr(i, 1) == "T")
		{
			add = 4;
		}
		id += add * p;
		p *= 4;
	}
	return id;
}

int main()
{
	llong size = get_hash("TTTTTTTTTTTT");
	vector<bool> h(size);

	int n;
	for (cin >> n; n--;)
	{
		char q[20], s[20];
		scanf("%s %s", &q, &s);

		if (strcmp(q, "insert") == 0)
		{
			h.at(get_hash(s)) = true;
		}
		else if (strcmp(q, "find") == 0)
		{
			if (h.at(get_hash(s)))
			{
				cout << "yes" << endl;
			}
			else
			{
				cout << "no" << endl;
			}
		}
	}

}


Measured memory_bytes: 5412
using System;

namespace aizu
{
    class OnlineJudge
    {
        const int Max = 39;
        static void Main()
        {
            string input;
            while((input = Console.ReadLine()) != null) {
                int count = int.Parse(input) % Max;
                if(count == 0) {
                    count = Max;
                }
                Console.WriteLine("3C{0:00}", count);
            }
        }
    }
}

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

int main() {
        ios_base:: sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        int n;
        cin >> n;
        int mn = 1e9, x, ans = 0;
        for(int i = 0; i < n; i++) {
                cin >> x;
                if(x < mn) {
                        mn = x;
                        ans++;
                }
        }
        cout << ans;
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N,K;
  cin >> N >> K;
  vi h(N);
  rep(i,N) {
    cin >> h[i];
  }
  vi dp(N,INF);
  dp[0] = 0;
  srep(i,1,N) {
    srep(j,1,K+1) {
      if(i-j >=0) {
        dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
      }
    }
  }
  cout << dp[N-1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#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 SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,x,y,z;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  IN2(d,e);
  OUT(d/e);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << (a * b & 1 ? "Odd" : "Even");
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#ifdef ONLINE_JUDGE
#define freopen(a, b, c)
#endif

typedef long long int ll;

namespace IPT {
  const int L = 1000000;
  char buf[L], *front=buf, *end=buf;
  char GetChar() {
    if (front == end) {
      end = buf + fread(front = buf, 1, L, stdin);
      if (front == end) return -1;
    }
    return *(front++);
  }
}

template <typename T>
inline void qr(T &x) {
  char ch = IPT::GetChar(), lst = ' ';
  while ((ch > '9') || (ch < '0')) lst = ch, ch=IPT::GetChar();
  while ((ch >= '0') && (ch <= '9')) x = (x << 1) + (x << 3) + (ch ^ 48), ch = IPT::GetChar();
  if (lst == '-') x = -x;
}

namespace OPT {
  char buf[120];
}

template <typename T>
inline void qw(T x, const char aft, const bool pt) {
  if (x < 0) {x = -x, putchar('-');}
  int top=0;
  do {OPT::buf[++top] = static_cast<char>(x % 10 + '0');} while (x /= 10);
  while (top) putchar(OPT::buf[top--]);
  if (pt) putchar(aft);
}

const int maxn = 2000005;

int n, x, y;
int MU[maxn], CU[maxn];

int main() {
  qr(n);
  for (int i = 1; i <= n; ++i) {
    qr(MU[i]);
  }
  memcpy(CU + 1, MU + 1, n * sizeof(int));
  std::sort(MU + 1, MU + 1 + n);
  x = MU[n >> 1]; y = MU[(n >> 1) + 1];
  for (int i = 1; i <= n; ++i) {
    qw((CU[i] <= x) ? y : x, '\n', true);
  }
  return 0;
}


Measured memory_bytes: 9344
import numpy as np

N = int(input())
t = np.array(['0'] + input().split(), np.int64)
v = list(map(int, input().split()))

# 発車してからn秒後の速度を求める

T = np.cumsum(t).reshape(-1, 1)
arrival = T[-1]
times = np.arange(0, arrival + 0.5, 0.5)
speed_limit = np.minimum(times, times[::-1])

V = np.array(v).reshape(-1, 1)
answer = np.minimum(times, times[::-1])
tmp = np.maximum(T[:-1, :] - times, times - T[1:, :]) + V
tmp = np.maximum(tmp, V)
tmp = tmp.min(axis=0)
answer = np.minimum(tmp, answer)
answer = np.abs(answer[1:] + answer[:-1]) * 0.5 / 2

print(answer.sum())


Measured memory_bytes: 107256
from collections import deque
import sys
sys.setrecursionlimit(100000)

n, m = list(map(int, input().split(' ')))
adj_list = [[] for i in range(n)]
for i in range(m):
    u, v = list(map(int, input().split(' ')))
    adj_list[u].append(v)
    adj_list[v].append(u)

# 深さ優先
# 全ての点をたどって連結しているもの同士を同じ色に設定する
colors = []

def adj_dfs(r, c):
    global colors
    stack = deque([])
    stack.append(r)
    colors[r] = c
    while len(stack) != 0:
        u = stack.pop()
        for v in adj_list[u]:
            if colors[v] == None:
                colors[v] = c
                stack.append(v)

def assign_color():
    global colors
    id = 1
    colors = [None for i in range(n)]
    for u in range(n):
        if colors[u] == None:
            id += 1
            adj_dfs(u, id)

assign_color()

q = int(input())
for i in range(q):
    s, e = list(map(int, input().split(' ')))
    if colors[s] == colors[e]:
        print('yes')
    else:
        print('no')



Measured memory_bytes: 23564
# import sys
# input = sys.stdin.readline

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

n = int(input())
mod = int(1e9+7)
def combination(n, r, mod):
    np1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (np1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
ans = 0
s = n//3
m = n%3
for i in range(s, 0, -1):
    ans += combination(i-1+m, i-1, mod)
    ans %= mod
    m+=3
print(ans)





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

using namespace std;

typedef long long ll;

const int INF = 1e9;

void insertion_sort(vector<int>& A, int n, int g, int& cnt)
{
  for (int i = g; i < n; ++i) {
    int key = A[i];
    int j = i - g;
    while (j >= 0 && A[j] > key) {
      A[j + g] = A[j];
      j -= g;
      ++cnt;
    }
    A[j + g] = key;
  }
}

void shell_sort(vector<int>& A, int n, int& cnt)
{
  vector<int> G;
  int h = 1;
  G.push_back(h);
  int upper = n / 2;
  // if (n >= 1000) { upper = n / 9; }
  // else if (n >= 100) { upper = n / 7; }
  for (int i = 3 * h + 1; i < upper; i = 3 * i + 1) {
    G.push_back(i);
  }
  reverse(G.begin(), G.end());
  int m = G.size();
  fprintf(stdout, "%d\n", m);
  for (int i = 0; i < m; ++i) {
    if (i) { fprintf(stdout, " "); }
    fprintf(stdout, "%d", G[i]);
  }
  fprintf(stdout, "\n");
  for (int i = 0; i < m; ++i) {
    insertion_sort(A, n, G[i], cnt);
  }
}

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  vector<int> A(n);
  for (int i = 0; i < n; ++i) {
    fscanf(stdin, "%d", &A[i]);
  }
  int cnt = 0;
  shell_sort(A, n, cnt);
  fprintf(stdout, "%d\n", cnt);
  for (int i = 0; i < n; ++i) {
    fprintf(stdout, "%d\n", A[i]);
  }
  return 0;
}

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

long long gcd(long long a, long long b){
	long long c;
	while(b!=0){
		c=a%b;
		a=b;
		b=c;
	}
	return a;
}

long long lcm(long long a, long long b){
	return a * b / gcd(a, b);
}

int main() {
	
	long long a, b, c, d, nlcm, count;
	cin>>a>>b>>c>>d;
	
	count=b-a+1;
	nlcm=lcm(max(c,d),min(c,d));
	
	count=count-b/c-b/d+b/nlcm+(a-1)/c+(a-1)/d-(a-1)/nlcm;
	cout<<count;
	
	return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
inf=float("inf")
d=((-1,0),(1,0),(0,-1),(0,1))
S=[["#"]*(w+2)]
S.extend([["#"]+[s for s in input()]+["#"] for _ in range(h)])
S.append(["#"]*(w+2))

def dist(a,b):
  if S[a][b]=="#":
    return 0
  else:
    D=[[inf]*(w+2) for _ in range(h+2)]
    D[a][b]=0
    Visit=[100*a+b]
    while Visit:
      v=Visit.pop()
      va,vb=v//100,v%100
      for dx,dy in d:
        if S[va+dx][vb+dy]=="#":
          continue
        elif D[va+dx][vb+dy]>D[va][vb]+1:
          Visit.append((va+dx)*100+(vb+dy))
          D[va+dx][vb+dy]=D[va][vb]+1
    ret=0
    for i in range(h):
      for j in range(w):
        if D[i+1][j+1]<inf:
          ret=max(ret,D[i+1][j+1])
    return ret
ans=0
for i in range(h):
  for j in range(w):
    ans=max(dist(i+1,j+1),ans)
print(ans)





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

int main () {
  int A, B, C, D, R, L;
  
  cin >> A >> B >> C >> D;
  
  L = A + B;
  R = C + D;
  
  if (L > R) 
    cout << "Left" << endl;
  else if (L == R)
    cout << "Balanced" << endl;
  else
    cout << "Right" << endl;
 
}

Measured memory_bytes: 256