akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
struct Obe{
	int h;
	int max;
}obe[100005];
void store(int a,int b){
	obe[a].max=obe[b].h>obe[a].max?obe[b].h:obe[a].max;
	obe[b].max=obe[a].h>obe[b].max?obe[a].h:obe[b].max;
}
bool good(int index){
	if(obe[index].h>obe[index].max)
		return 1;
	else
		return 0;
}
int main()
{
	long long n,m,h,a,b,ans=0;
	cin >> n >> m;
	for(int i=1;i<=n;i++){
		cin >> h;
		obe[i].h=h;
	}
	for(int i=1;i<=m;i++){
		cin >> a >> b;
		store(a,b);
	}
	for(int i=1;i<=n;i++){
		if(good(i)==1)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  
  double a, b, c, C, S, L, h; cin >> a >> b >> C;
  
  double PI = acos(-1);
  
  double radC = C * PI / 180;
  
  S = a * b * sin(radC) / 2;
  
  c = pow((a * a) + (b * b) - (2 * a * b * cos(radC)), 0.5);
  
  L = a + b + c;
  
  h = S * 2 / a;
  
  cout << fixed << setprecision(10);
  
  cout << S << endl;
  
  cout << L << endl;
  
  cout << h << endl;
  
}


Measured memory_bytes: 3552
a,b,c,k = map(int,input().split())
ans = 0
if a == k:
    ans += k
elif a < k:
    ans += a
    k -= a
else:
    ans += k
    k = 0

if b < k:
    k -= b
else:
    k = 0
if c == k:
    ans += -k
elif c < k:
    ans += -c
else:
    ans += -k
print(ans)


Measured memory_bytes: 9192
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	FastScanner sc;

	void run() {
		sc = new FastScanner();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		long allblock = A * B * C;
		long ans = 0;
		if (allblock % 2 == 0) {
			ans = 0;
		} else {
			long[] nums = new long[3];
			nums[0] = A;
			nums[1] = B;
			nums[2] = C;

			Arrays.sort(nums);
			ans = nums[0] * nums[1];
		}

		System.out.println(ans);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

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

  cout << 1000 * (N / 1000 + min(1, N % 1000)) - N << endl;
  return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<stdlib.h>

int main(void){
  int n;
  int a[100];
  int i, j, k;
  int v;


  scanf("%d\n", &n);
  if(n < 0 && n > 1000){
    exit(1);
  }
  for(i = 0; i < n ; i++){
    scanf("%d", &a[i]);
  }

  for(i = 0; i < n - 1; i++){
    printf("%d ", a[i]);
  }
  printf("%d", a[i]);
  printf("\n");

  for(i = 1; i <= n - 1; i++){
    v = a[i];
    j = i - 1;

    while(j >= 0 && a[j] > v){
      a[j + 1] = a[j];
      j--;
    }

    a[j + 1] = v;

    for(k = 0; k < n - 1; k++){
      printf("%d ", a[k]);
    }
    printf("%d", a[k]);
      printf("\n");
  }

  return 0;
}


Measured memory_bytes: 2036
// copied from https://atcoder.jp/contests/abc110/submissions/8089381

#include<bits/stdc++.h>

using namespace std;

#define MAX_COMB_F 100100 

long long MOD = pow(10,9)+7;
long long comb[MAX_COMB_F][50];

main(){
  long long n, m, temp;
  //n=100000;
  //m=536870912;
  cin>>n>>m;
  vector<long long> p;
  temp=m;

  for(int i=2;i<MAX_COMB_F;i++){
    long long count=0;
    while (temp%i==0){
      temp /= i;
      count++;
    }
    p.push_back(count);
  }

  // for(int i=0;i<MAX_COMB_F;i++){
  //   cout<<p[i]<<' ';
  // }
  // cout<<endl;
  // cout<<endl;
  // cout<<endl;

  if(temp!=1){p.push_back(1);}

  for(int i=0;i<MAX_COMB_F;i++){
    comb[i][0]=1;
    if(i<50) comb[i][i]=1;
  }

  for(int i=2;i<MAX_COMB_F;i++){
    for(int j=1;j<50;j++){
      comb[i][j] = comb[i-1][j-1]+comb[i-1][j];
      comb[i][j] %= MOD;
    }
  }

  long long ans = 1;
  for(int i=0;i<p.size();i++){
    long long m;
    m=p[i];
    if(n-1+m>MAX_COMB_F){

      cout<<n<<endl;
      cout<<m<<endl;
      cout<<(n-1+m)<<endl;
    }
    ans *= comb[n-1+m][m];
    ans %= MOD;
  }

  cout << ans << endl;

}


Measured memory_bytes: 40308
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  set<int> s1,s2,s3;
  for(auto c:S){
    for(auto e:s2){
      s3.insert(e*10+(c-'0'));
    }
    for(auto e:s1){
      s2.insert(e*10+(c-'0'));
    }
    s1.insert((c-'0'));
  }
  // for(auto e:s3){
  //   cerr<<e<<endl;
  // }
  cout<<s3.size()<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;

struct edge {
    int to, cost;
};

int V;
vector<edge> G[1000000];
ll d[1000000];
bool negative;

void bellmanFord(int s) {
    fill(d, d + V + 10, inf);
    d[s] = 0;
    negative = false;
    for (int i = 0; i < V; i++) {
        bool update = false;
        for (int j = 0; j < V; j++) {
            if (d[j] != inf) {
                for (int k = 0; k < G[j].size(); k++) {
                    edge e = G[j][k];
                    if (d[j] + e.cost < d[e.to]) {
                        d[e.to] = d[j] + e.cost;
                        update = true;
                    }
                }
            }
        }
        if (!update) {
            break;
        } else if (i == V - 1) {
            negative = true;
        }
    }
}

int main() {
    int E, r;
    cin >> V >> E >> r;
    for (int i = 0; i < E; i++) {
        int s, t, d;
        cin >> s >> t >> d;
        edge e;
        e.to = t;
        e.cost = d;
        G[s].push_back(e);
    }
    bellmanFord(r);
    if (!negative) {
        for (int i = 0; i < V; i++) {
            if (d[i] == inf) {
                cout << "INF" << endl;
            } else {
                cout << d[i] << endl;
            }
        }
    } else {
        cout << "NEGATIVE CYCLE" << endl;
    }
}



Measured memory_bytes: 26588
n, k = map(int, input().split())
S = input()

boundaries = list()
for i in range(n - 1):
    c1, c2 = S[i], S[i + 1]
    if c1 != c2:
        boundaries.append(i)

ans = n - 1 - len(boundaries)
if len(boundaries) % 2 == 0:
    ans += (2 * min(k, len(boundaries) // 2))

else:
    if len(boundaries) // 2 + 1 <= k:
        ans += len(boundaries)
    elif len(boundaries) // 2 <= k:
        ans += (len(boundaries) - 1)
    else:
        ans += (2 * k)

print(ans)


Measured memory_bytes: 7108
N = int(input())
dia = [0]*(N-1)
for i in range(N-1):
    c,s,f = map(int,input().split())
    dia[i] = (c,s,f)
for i in range(N-1):
    time = 0
    for j in range(i,N-1):
        c,s,f = dia[j]
        if time > s:
            x = (time - s)/f
            if x.is_integer():
                s += int(x)*f
            else:
                s += int(x+1)*f
        time =  s + c

        # while time > s:
        #     s += f
        # time = s + c

    print(time)
print(0)










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

void func(long long int n){
    if(n == 0) return;
    n--;
    func(n/26);
    printf("%c", n%26 + 'a');
}

int main(){
    long long int n;
    cin >> n;
    func(n);
    cout << endl;
    return 0;
}


Measured memory_bytes: 3760
#include <iostream>
using namespace std;
int odd_digit(int n) {
    int ans = 0;
    while (n > 0) {
        ans ++;
        n /= 10;
    }
    return ans % 2;
}
int main() {
    int n;
    cin >> n;
    int res = 0;
    for (int i = 1; i <= n; i++) {
        res += odd_digit(i);
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 0;
		for(int i = 1; i <= N; i++) {
			if(String.valueOf(i).length() % 2 == 1) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 28372
#include<stdio.h>
int main(void){
    int k,a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    scanf("%d",&k);
    printf("%d",a[k-1]);
    return 0;
}

Measured memory_bytes: 128
h,w,a,b=map(int,input().split())

p=10**9+7
#p=127

def modp_factorial(n):
    s=1
    for x in range(1,h+1):
        s=(s*x) % p
    return s
def modp_prod(lst):
    s=1
    for x in lst:
        s=(s*x)%p
    return s
def inv(n):
    s=1
    q=p-2
    while q>0:
        if q&1:
            s=(s*n) % p
        n=(n*n) % p
        q>>=1
    return s

l=[1]
f=1
for x in range(1,h+w):
    f=(f*x) % p
    l.append(f)
invl=[inv(l[-1])]
for n in range(h+w-1,1,-1):
    invl.append((invl[-1]*n) % p)

invl.append(1)
invl.reverse()


s=0
for x in range(1,h-a+1):
    s=(s+modp_prod([l[x+b-2],invl[x-1],invl[b-1]\
        ,l[w-b+h-x-1],invl[h-x],invl[w-b-1]])) % p
print(s)


Measured memory_bytes: 24744
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
    int n,k;
    cin >> n >> k;
    double p=1.0/n;
    //cout << p << endl;
    int c[n];
    for(int i=1;i<=n;i++){
        int q=0,j=i;
        while(j<k){
            j*=2;
            q++;
        }
        c[i-1]=q;
        
    }

    double sum=0;
    for(int i=0;i<n;i++){
        sum+=pow(0.5,c[i]);
    }

    cout << fixed << setprecision(10) << sum*p << endl;
}

Measured memory_bytes: 4548
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <algorithm>
#include <cstring>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100005
#define MOD 20190823
#define eps 1e-8
#define bl bool
#define INF 1e+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
template<class T> inline void read(T &f){
	f=0;
    T x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
int main(){
	string s;
	cin>>s;
	ll k;
	read(k);
	ll coun=0;
	ll ans=0;
	bool flag=1;
	for(ll i=1;i<s.size();i++){
		if(s[i]!=s[i-1]){
			flag=0;
		}
	}
	if(flag){
		ll p=(ll)s.size();
		p*=k;
		cout<<p/2<<endl;
		return 0;
	}
	string t=s;
	for(ll i=1;i<s.size();i++){
		if(t[i]==t[i-1]){
			coun++;
			t[i]='2';
		}
	}
	for(ll i=0;i<s.size();i++){
		if(s[0]==s[s.size()-1]){
			char ch=s[s.size()-1];
			char trp=s[0],cht;
			for(ll i=1;i<s.size();i++){
				cht=s[i];
				s[i]=trp;
				trp=cht;
			}
			s[0]=ch;
		}
//		cout<<s<<endl;
	}
	for(ll i=1;i<s.size();i++){
		if(s[i]==s[i-1]){
			ans++;
			s[i]='1';
		}
	}
	coun+=(ans*(k-1));
	cout<<coun<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

long Combination(long n, long r) {
  long answer = 1;
  if (n-r < r) {
    r = n-r;
  }
  for (long i = 1; i <= r; i++) {
    answer *= n+1-i;
    answer /= i;
  }
  return answer;
}

int main(void) {

  int n,p;
  scanf("%d %d", &n, &p);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int odd = 0;
  for (int i = 0; i < n; i++) {
    if (a[i]%2 != 0) {
      odd++;
    }
  }
  int even = n-odd;
  long answer = 0;
  for (int i = 1; i <= odd; i += 2) {
    answer += Combination(odd,i);
  }
  answer *= pow(2,even);
  if (p == 0) {
    answer = pow(2,n)-answer;
  }
  printf("%ld\n", answer);

  return 0;
}

Measured memory_bytes: 128
N=int(input())
s=input()
count=[]
for i in range (N):
    count.append(0)
    for k in range (i):
        if(s[k] in s[i:]):
            count[i]=count[i]+1
            if(s[k] in s[:k]):
                count[i]=count[i]-1
print(max(count))

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<bool> dec(10,1);
  int x;
  int mx = 0;
  for (int i = 0 ; i < k; i++) {
    cin >> x;
    dec[x] = 0;
  }
  for (int i = 0; i < 10; i++) {
    if(dec[i]) {
      mx = i;
    }
  }
  int res = mx;
  int cnt = 1;
  while(res < n) {
    res *= 10;
    res += mx;
    cnt *= 10;
  }
  int ans = 0;
  int i = 0;
  while(i < 10 && res > 0) {
    if(dec[i]) {
      if(ans + (i*cnt) + (res/10) >= n) {
        ans += i*cnt;
        res /= 10;
        cnt /= 10;
        i = -1;
      }
    }
    i++;
  }
  cout << ans;
  return 0;
}


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

LL n,m,x;
LL pen = 0,pls = 0;
LL vis[500005] = {0},pe[500005] = {0};
string s;

int main(){
	cin >> n >> m;
	for(LL i = 1;i <= m;i ++){
		cin >> x >> s;
		if(vis[x]) continue;
		if(s == "AC"){
			pls ++;
			pen += pe[x];
			vis[x] = 1;
		}
		else pe[x] ++;
	}
	cout << pls << ' ' << pen << endl;
	return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

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

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

    bool ans = false;
    if (abs(a - c) <= d)
    {
        ans = true;
    }
    else if (abs(a - b) <= d && abs(b - c) <= d)
    {
        ans = true;
    }

    cout << (ans ? "Yes\n" : "No\n");
    return 0;
}



Measured memory_bytes: 256
N=int(input())
S=int(input())
T=int(input())

if N>S:
    if T%N==0:
        ans=T//N
    else:
        ans=int(T/N)+1
else:
    if T%S==0:
        ans=T//S
    else:
        ans=int(T/S)+1

print(ans)

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

using namespace std;


const int maxn = 2e5 + 5;

int a[maxn];
int n;
int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    if(n % 2) {
        for(int i = n; i >= 1; i -= 2) printf("%d ", a[i]);
        for(int i = 2; i <= n; i += 2) printf("%d ", a[i]);
    } else {
        for(int i = n; i >= 1; i -= 2) printf("%d ", a[i]);
        for(int i = 1; i <= n; i += 2) printf("%d ", a[i]);
    }
    printf("\n");
    return 0;
}

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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000000000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<int>>;

int main(){
  ll N;cin >> N;
  vector<ll> A(N);
  for(int i = 0;i < N;i++){
    cin >> A[i];
  }
  ll dp[100010];
  fill(dp,dp+100010,INF);
  for(int i = 0;i < N;i++){
    *upper_bound(dp,dp+N,-A[i]) = -A[i];
  }
  cout << lower_bound(dp,dp+N,INF) - dp << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1LL<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1LL<<(i))))
#define setbit1(n,i) ((n)|(1LL<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define DBG(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define EN cout<<"\n"
#define fi first
#define se second
#define PI (acos(-1))
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 200005
template<class T> ostream& operator<<(ostream &s,pair<T,ll> a)
{
    s<<a.fi<<' '<<a.se;
    return s;
}
int main()
{
    fastread;
    ll T=1;
    for(ll qq=1;qq<=T; qq++)
    {
        ll n;
        cin>>n;
        vi ans;
        ll x=log2(n);
        ll ind=1;
        for(int i=0;i<x;i++)ans.push_back(ind++);
        for(int i=0;i<x;i++)ans.push_back(ans[i]);
        for(ll i=x-1;i>=0;i--)
        {
            if(getbit(n,i))
            {
                ans.insert(ans.begin(),ind++);
                ans.insert(ans.end()-i,ind-1);
            }
        }
        ans.push_back(ind++);
        ans.push_back(ind-1);
        cout<<ans.size()<<endl;
        for(auto x:ans)cout<<x<<' ';
        cout<<endl;
    }
}



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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(Args&&... args) const { print(std::forward<Args>(args)...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(T&& head, Tail&&... tail) const { std::cout << head, print_rest(std::forward<Tail>(tail)...); }
        template <class T, class... Tail>
        void print_rest(T&& head, Tail&&... tail) const { std::cout << sep << head, print_rest(std::forward<Tail>(tail)...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
    template <class T>
    void print_vec(const std::vector<T>& vec, const char* sep = " ", const char* term = "\n") const {
        const size_t sz = vec.size();
        for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
    }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll H, W, N;
    cin >> H >> W >> N;
    ll a = max(H, W);
    prints()((N + a - 1) / a);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3612
//O-MATCHING
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fr(a,b) for(ll i=a;i<=b;i++)
#define mod 1000000007
#define inf (1LL<<60)
#define all(x) (x).begin(),(x).end()
#define prDouble(x) cout<<fixed <<setprecision(10)<<x
#define triplet pair<ll,pair<ll,ll>>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
 
 
//this is  topdown dp+ BITMASK PROBLEM
 
ll dp[22][(1<<22)];
int solve(vector<vector<int>>& compat,int i,int womenSubset,int n)
{  //base case
    if(i==n+1)
    {
        if(womenSubset==0)
        {
            return 1;
        }
        return 0;
    }
    //look up
    if(dp[i][womenSubset]!=-1)
    return dp[i][womenSubset]%mod;
 
ll ans=0;
for(int w=0;w<n;w++)
{
    bool available=(((1<<w)&(womenSubset))==0)?0:1;
    if(available && compat[i][w+1])
    {
        ans=(ans+solve(compat,i+1,womenSubset ^ (1<<w),n))%mod;
    }
 
}
return dp[i][womenSubset] =ans%mod;
 
}
 
 
 
int main()
{
int n;
cin>>n;
vector<vector<int>>compat(n+1,vector<int>(n+1));
memset(dp,-1, sizeof dp);
for(int i=1;i<=n;i++)
{
    for(int j=1;j<=n;j++)
    {
        cin>>compat[i][j];
    }
}
cout<<solve(compat,1,((1<<(n))-1),n);
return 0;
 
}

Measured memory_bytes: 721152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mset(x,y) memset(x,y,sizeof(x))
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#ifdef LOCAL
#define dmp(...) _dmp(#__VA_ARGS__, __VA_ARGS__)
#else
#define dmp(...) (__VA_ARGS__)
#endif
template<class T> using vt=vector<T>;
template<class T> using vvt=vt<vt<T>>;
template<class TA,class TB> void chmax(TA&a,TB b){if(a<b)a=b;}
template<class TA,class TB> void chmin(TA&a,TB b){if(b<a)a=b;}
template<class TA,class TB>
ostream& operator<<(ostream& os,const pair<TA,TB>& p){
	return os<<"{"<<p.fi<<","<<p.se<<"}";
}
template<class T> ostream& operator<<(ostream& os,const vt<T>& v){
	os<<"{";for(auto& e:v)os<<e<<",";return os<<"}";
}
template<class TH> void _dmp(const char *sdbg, TH h){cout<<sdbg<<"="<<h<<endl;}
template<class TH, class... TA> void _dmp(const char *sdbg, TH h, TA...a){
while(*sdbg!=',')cout<<*sdbg++;cout<<"="<<h<<","; _dmp(sdbg+1, a...);
}
template<class T> void make_unique(vt<T>& v) {
	sort(all(v));v.erase(unique(all(v)),v.end());
}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
int ri(){int x;cin>>x;return x;}
ll rll(){ll x;cin>>x;return x;}
vi rvi(int n){vi v;rep(i,n)v.pb(ri());return v;}
ll x;
void MAIN() {
	cin>>x;
	cout<<x/500*1000+x%500/5*5;
}
int main() {
	ios::sync_with_stdio(false);cin.tie(0);
	int T=1;
	//cin>>T;
	for(int tt=1;tt<=T;tt++) {
		MAIN();
	}
	return 0;
}

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

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	
	int k, n;
	cin >> k >> n;

	vector< int> in(n);
	for (int &e : in) cin >> e;

	int d = 0;
	for (int i = 0; i + 1 < n; i++) d = max(d, in[i + 1] - in[i]);
	d = max(d, in[0] + k - in[n - 1]);

	cout << k - d << endl;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<set>
#include<fstream>
#include<map>
#include<string>
#include <stdio.h>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<stack>
#include<climits>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll>vl;
typedef vector<int>vi;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef vector<char>vc;
typedef vector<string>vs;
#define MP make_pair
#define all(v) v.begin(),v.end()
const ll mod = 1000000007;
const ll OO = (ll)1e18;
const int dx[] = { 0, 1, -1, 0 };
const int dy[] = { 1, 0, 0, -1 };
ll gcd(ll a, ll b){ if (b == 0){ return a; }return gcd(b, a % b); }
ll fast_power(ll base, ll power){
	if (power == 1) return base;
	if (power % 2 == 0) return fast_power((base*base), power / 2);
	else return(base*fast_power((base*base), power / 2));
}
//#pragma warning (disable : 4996)
void Qalbaz()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	
}

int main(){
	//Qalbaz();
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll x = 0, y = 0, z = 0, ans;
	ll n, m;
	cin >> n >> m;
	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= n; j++)
		{
			ans = i * 10000 + j * 5000 + (n - (i + j)) * 1000;
			if (ans == m && (n - (i + j) >= 0))
			{
				cout << i << " " << j << " " << (n - (i + j));
				return 0;
			}
			else if (ans > m)
				break;
		}
	}
	cout << "-1 -1 -1";
	return 0;
}

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

int main() {
    int n;
    scanf("%d", &n);
    double k1;
    if (n&1) {
        k1 = 1.0*((n>>1)+1)/n;
    } else {
        k1 = 0.5;
    }
    printf("%.12lf\n", k1);
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

const int M = 1000000007;

int main() {
  int n, l;
  int x[5000], a[5000];
  int count[5000][2];
  int total = 0;
  scanf("%d%d", &n, &l);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < l; ++i) {
    count[i][1] = 0;
  }
  count[x[0]][1] = 1;
  if (a[0] > 0) {
    for (int pos = x[0] + a[0]; pos < l; pos += a[0]) {
      count[pos][1] = 1;
    }
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < l; ++j) {
      count[j][0] = count[j][1];
      count[j][1] = 0;
    }
    for (int j = 0; j < x[i]; ++j) {
      count[x[i]][1] = (count[x[i]][1] + count[j][0]) % M;
    }
    if (a[i] > 0) {
      for (int pos = x[i] + a[i]; pos < l; pos += a[i]) {
        count[pos][1] = count[pos - a[i]][1];
        for (int j = pos - a[i]; j < pos; ++j) {
          count[pos][1] = (count[pos][1] + count[j][0]) % M;
        }
      }
    }
  }
  for (int i = 0; i < l; ++i) {
    total = (total + count[i][1]) % M;
  }
  printf("%d\n", total);
  return 0;
}

Measured memory_bytes: 1108
#include <stdio.h>
#define MAX_INPUT 100000
typedef struct point{
    int x, y;
    bool operator<(const struct point &X) const{
        if (y != X.y) return y < X.y;
        return x < X.x;
    };
} Point;
Point P[MAX_INPUT], T[MAX_INPUT], L[MAX_INPUT], R[MAX_INPUT];
int N;
void input(void);
void msort(int s, int e);
int ccw(Point O, Point A, Point B){ return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x);};
void MC(void);
int main(void){
    //freopen("in.txt", "r", stdin);
    input();
    msort(0, N - 1);
    MC();
    return 0;
}
void MC(void){
    R[0] = P[0]; R[1] = P[1];
    int i, cntR = 2, cntL = 2;
    for (i = 2; i < N; i++){
        while (cntR >= 2 && ccw(P[i], R[cntR - 1], R[cntR - 2]) > 0) cntR--;
        R[cntR++] = P[i];
    }
    L[0] = P[N - 1]; L[1] = P[N - 2];
    for(i = N - 3; i >= 0; i--){
        while (cntL >= 2 && ccw(P[i], L[cntL - 1], L[cntL - 2]) > 0) cntL--;
        L[cntL++] = P[i];
    }
    printf("%d\n", cntR + cntL - 2);
    for(i = 0; i < cntR; i++) printf("%d %d\n", R[i].x, R[i].y);
    for(i = 1; i < cntL - 1; i++) printf("%d %d\n", L[i].x, L[i].y);
}
void msort(int s, int e){
    if(s >= e) return;
    int m = s + (e - s) /2;
    msort(s, m);
    msort(m + 1 , e);
    int i = s, j = m + 1, k = s;
    while (i <= m || j <= e){
        if (j > e || (i <= m && P[i] < P[j]))
            T[k++] = P[i++];
        else
            T[k++] = P[j++];
    }
    for(i = s; i <= e; i++) P[i] = T[i];
}
void input(void){
    scanf("%d", &N);
    for (int i = 0; i < N; i++) scanf("%d%d", &P[i].x, &P[i].y);
}

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

int n,h[1000];

int main(){
  cin >> n;
  for(int i=0;i<n;i++)cin >> h[i];

  sort(h,h+n,greater<int>());

  long long ans = 0;
  for(int i=0;i<n;i++){
    ans += max(0,h[i]-i/4);
  }
  cout << ans+1 << endl;
}

Measured memory_bytes: 1180
#include <stdio.h>

int main( ) {
  int S, h, m, s;

  scanf("%d", &S);

  h = S / 3600;
  m = (S % 3600)/60;
  s = (S % 3600)%60;

  printf("%d:%d:%d\n", h, m, s);

  return 0;
}

Measured memory_bytes: 592
#include <iostream>
using namespace std;
int main(void){
    long long N,K,k,i;
    cin>>N>>K;
    if(K*2>N+1){
        cout<<-1<<endl;
        return 0;
    }
    long long a[N],b[N],c[N];
    if(N%2==1){
        k=(N+1)/2;
        for(i=0;i<N;i++){
            c[i]=k*5-2+i;
            if(i<k){
                a[i]=k*2-1-i;
            }else{
                a[i]=k*4-2-i;
            }
            b[i]=c[i]-a[i];
        }
        k=k-K;
        for(i=0;i<N;i++){
            a[i]-=k;b[i]-=k;c[i]-=k;
        }
    }else{
        k=N/2;
        for(i=0;i<N;i++){
            c[i]=k*5+i;
            if(i<k){
                a[i]=2*k-1-i;
                b[i]=c[i]-a[i];
            }else{
                a[i]=k*4-1-i;
                b[i]=c[i]-a[i]-1;
            }
        }
        k=k-K;
        for(i=0;i<N;i++){
            a[i]-=k;b[i]-=k;c[i]-=k;
        }
    }
    for(i=0;i<N;i++){
        cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;
    }
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 152, task c, 2020/06/23
//ms,
/*
*/


int main(void){
  int N;
  int counter=0;
  int minimum=2*100000;
  int tmp;

  cin >>N;
  for(int i=0;i<N;i++){
    cin >>tmp;
    if(tmp<=minimum){
      minimum = tmp;
      counter++;
    }
  }

  cout <<counter<<endl;
  return 0;
}
/*
*/


Measured memory_bytes: 3644
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string s;
    int word[200]={0};
    while(getline(cin,s)){
        for(int i=0;i<s.size();i++){
            int n;
            if(s[i]>='A' && s[i]<='Z'){
                s[i]+=32;
            }
            n=s[i];
            word[n]+=1;
        }
    }
    
    for(char c='a';c<='z';c++){
        int n=c;
        cout << c << " " << ":" << " " << word[n] << endl;
    }
}



Measured memory_bytes: 3216
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#define MN 40002
#define MM 5000001
#define ll long long
#define ld long double
#define inf 0x7fffffff
#define clz 1000000007
#define ers(arr,val) memset(arr,val,sizeof(arr));
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define repd(i,b,a) for(int i=(b);i>=(a);i--)
#define repe(i,u) for(int i=h[u];i;i=e[i].nx)
using namespace std;
int a[4];
int main(){
	scanf("%d%d%d",&a[1],&a[2],&a[3]);
	sort(a+1,a+3+1);
	printf("%d",a[3]*10+a[2]+a[1]);
	return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
const int maxn = 123456;
int x[maxn];
long long p[maxn];
int main(){
	int n, s; cin >> n >> s;
	for(int i = 0; i < n; i++) cin >> x[i] >> p[i];
	long long ans = 0;
	int l = 0, r = n - 1;
	while(true){
		if(s < x[l]){
			ans += x[r] - s;
			break;
		} else if(s > x[r]){
			ans += s - x[l];
			break;
		} else {
			ans += x[r] - x[l];
			bool go_left = p[l] >= p[r];
			while(l < r){
				if(go_left && p[l] >= p[r]){
					p[l] += p[r--];
				} else if(!go_left && p[l] < p[r]){
					p[r] += p[l++];
				} else {
					break;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<P> job;
    int a, b;
    rep (i, n) {
        cin >> a >> b;
        job.pb({b, a});
    }
    sort(all(job));
    int now = 0;
    repall (e, job) {
        int limit = e.first, time = e.second;
        if (now + time > limit) {
            print("No");
            return 0;
        }
        now += time;
    }
    print("Yes");

    return 0;
}


Measured memory_bytes: 6384
A, B, C, D = map(int, input().split())
import fractions
g = fractions.gcd(C, D)
ac = (A-1)//C
bc = B//C
c = bc-ac
ad = (A-1)//D
bd = B//D
d = bd-ad
cdg = (C*D)//g
acd = (A-1)//cdg
bcd = B//cdg
cd = bcd-acd
ans = B-A+1-c-d+cd
print(ans)

Measured memory_bytes: 5076
#include <stdio.h>

int main(void){
  int N;
  char A[101];
  char B[101];
  char C[101];

  scanf("%d", &N);
  scanf("%s", A);
  scanf("%s", B);
  scanf("%s", C);

  int change = 0;
  for(int i = 0; i < N; i++) {
    if(A[i] == B[i]) {
      if(B[i] == C[i]) {// A==B==C
	;
      } else {// A==B , C
	change++;
      }
    } else {// A!=B
      if(B[i] == C[i]) {// A!=B, B==C
	change++;
      } else {// A!=B , B!=C
	if(A[i] == C[i]) {// A==C, B
	  change++;
	} else {
	  change+=2;
	}
      }
    }
  }

  printf("%d\n", change);
  return 0;
}


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

int main() {
  int A, B, N, c;
  cin >> A >> B;
  N = A;
  c = 0;
  for(int i = 0; i < B - A + 1; i++) {
    if(N / 10000 == N % 10) {
      if ((N - N / 10000 * 10000) / 1000 == (N - N / 100 * 100) / 10) {
        c++;
      }
    }
    N++;
  }
  cout << c << endl;
}

Measured memory_bytes: 3508
#include <iostream>
#include <string>
#include <stdlib.h>

#define INC(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define DEC(i, a, b) for(int (i) = (a); (i) > (b); --(i))
#define REP(i, n)    INC(i, 0, n)
#define comp(a, b) int comp(const void *(a), const void *(b))

typedef unsigned int uint;
typedef unsigned long ul;
typedef long long  ll;
typedef unsigned long long ull;

const int MOD = 1e9 + 7;

using namespace std;

void TFprint(bool b, std::string T, std::string F){
    if(b){
        cout << T << endl;
    }else{
        cout << F << endl;
    }
}

int abs(int x){
    return x > 0? x : -x;
}

int max(int a, int b){
    return a > b? a : b;
}

int min(int a, int b){
    return a < b? a : b;
}


int main(){
    char order[5];
    int topping = 0;
    cin >> order;
    REP(i, 3){
        if(order[i] == 'o'){
            topping++;
        }
    }
    cout << 700 + 100 * topping << endl;
    return 0;
}

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

int main() {

	//ifstream cin("INPUT.txt");
	//ofstream cout("OUTPUT.txt");

	int day, koku, suu, kokud, suud;
	cin >> day >> koku >> suu >> kokud >> suud;
	cout << day - max(koku % kokud == 0 ? koku / kokud : koku / kokud + 1, koku % kokud == 0 ? suu / suud : suu / suud + 1) << endl;

	return 0;

}

Measured memory_bytes: 1160
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

int main() {

  int N;
  cin >> N;

  vector<int64_t> array(3*N);
  for(int64_t i=0;i<3*N;i++)
    cin >> array[i];

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

  int64_t ans = 0;
  for(int64_t i=N;i<3*N;i+=2)
    ans += array[i];

  cout << ans << endl;

  return 0;
}


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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

A, B, H, M = map(int, input().split())

short_rate = (H * 60 + M) / 720
long_rate = M / 60

def to_arg(rate):
    return - 2 * math.pi * rate

short = (0 + A * 1j)
short *= (math.cos(to_arg(short_rate)) + 1j * math.sin(to_arg(short_rate)))

long = (0 + B * 1j)
long *= (math.cos(to_arg(long_rate)) + 1j * math.sin(to_arg(long_rate)))

print("{:.20f}".format(abs(long - short)))




Measured memory_bytes: 10892
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

  private static PrintWriter out;

  public static void main(String[] args) {
    Main main = new Main();
    Runtime.getRuntime().addShutdownHook(new Thread(() -> out.close()));
    try {
      main.run(args);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void run(String[] arguments) throws Exception {
    MyScanner sc = new MyScanner();
    out = new PrintWriter(new BufferedOutputStream(System.out));

    int n = sc.nextInt();
    //ArrayList<Integer> list = new ArrayList<>();

    HashMap<Integer, Integer> map = new HashMap<>();

    for (int i = 0; i < n; i++) {
      int a = sc.nextInt();
      if (map.containsKey(a)) {
        int counter = map.get(a) + 1;
        map.put(a, counter);
      } else {
        map.put(a, 1);
      }
    }

    List<Integer> list = new ArrayList<>(map.keySet());

    int MAX_A = (int) Math.pow(10, 6);
    int[] checks = new int[MAX_A + 1];
    int ans = 0;

    for (Integer num : list) {
      for (int i = num; i <= MAX_A; i += num) {
        checks[i]++;
      }
    }

    for (Integer number : list) {
      if (checks[number] == 1 && map.get(number) == 1) {
        ans++;
      }
    }

    out.println(ans);
    out.close();

  }

  /*
   * Form: http://codeforces.com/blog/entry/7018
   */
  private class MyScanner {

    BufferedReader br;
    StringTokenizer st;

    MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}


Measured memory_bytes: 68608
#include <stdio.h>
int main(void) {
    int n;
    scanf("%d", &n);
    double x, xc;
    int a, xcc;
    x = n / 1.08;
    xc =x;
    xcc = (int)x;
    a = (int)x * 1.08;
    if (a == n) {
        printf("%d", xcc);
        return 0;
    } else {
        a = ((int)xc + 1 ) * 1.08;
        if (a == n) {
            printf("%d", xc+1);
            return 0;
        } else {
            printf(":(");
            return 0;
        }
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h> 
using namespace std; 
  
// Function to calculate distance 
double distance(double x1, double y1) 
{ 
    // Calculating distance 
    return sqrt(pow(x1 - 0, 2) +  
                pow(y1 -0, 2) * 1.0); 
} 
  
// Drivers Code 
int main() 
{ 
    //cout << distance(3, 4, 4, 3); 
    int n;int d;
    cin>>n;
    cin>>d;
    double x,y;
    int count=0;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        cin>>y;
        double t=distance(x,y);
        if(t<=d)
        count++;
        
    }
    cout<<count;
    return 0; 
}

Measured memory_bytes: 3752
import java.util.Scanner;
public class Main {
	public static void main (String [] args) {
		boolean out;
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int h = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();
		int r = scan.nextInt();

		out = (x - r < 0 ||  x + r > w || y - r < 0 || y +r > h);
		if (out == true) {
			System.out.println("No");
		}else if (out == false) {
			System.out.println("Yes");
		}
		scan.close();



	}

}


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

int main() {
    int t;
    int count5 = 0, count7 = 0;
    for (int i = 0; i < 3; i++) {
        cin >> t;
        if (t == 5) count5++;
        else if (t == 7) count7++;
    }
    if (count5 == 2 && count7 == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

typedef long long i64;

const i64 MOD = 1000000007LL;

i64 powMod(i64 m, i64 n) {
    i64 res = 1;
    while(n > 0) {
        if(n & 1) (res *= m) %= MOD;
        n >>= 1;
        (m *= m) %= MOD;
    }
    return res;
}

int main() {
    i64 M, N; cin >> M >> N;
    cout << powMod(M, N) << endl;
}

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

struct edge{
    int to,cost;
};

vector<edge> G[100010];
int dist[100010];

void dfs(int v, int p,int d) {
    dist[v] = dist[p] + d;
    for(auto e : G[v]) {
        if(e.to == p) continue;
         dfs(e.to, v, e.cost);
    }
}


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

int N;
cin >> N;
rep(i,N-1){
    int u,v,w;
    cin >> u >> v >> w;
    u--;v--;
    G[u].push_back({v,w});
    G[v].push_back({u,w});
}

dist[100005] = 0;
dfs(0, 100005,0);

rep(i,N){
    if(dist[i] & 1) cout << 1 << endl;
    else cout << 0 << endl;
}

return 0;
}

Measured memory_bytes: 8448
#include <stdio.h>
#include<stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node * Node;
Node root;

void insert(int);
void inorder(Node);
void preorder(Node);
Node treeSearch(Node, int);

int main(){

  int m,i,a,x;
  char str[20];

  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%s",str);
    if ( str[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if(t!=NIL){
	printf("yes\n");
      }
      else {
	printf("no\n");
      }
    }
    if(str[0]=='i'){
      scanf("%d",&a);
      insert(a);
    }
    else if(str[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  
  return 0;
  
}

void inorder(Node x){
  if(x!=NIL){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
  }
}

void preorder(Node x){
  if(x!=NIL){
    printf(" %d",x->key);
    preorder(x->left);
    preorder(x->right);
  }
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else if(z->key<y->key){
    y->left=z;
      }
  else{
    y->right=z;
  }
}

Node treeSearch(Node u, int k){
  while(u != NIL && u->key != k){
    if( u->key > k){
      u = u->left;
    }
    else{
      u = u->right;
    }
  }
  return u;
}

Measured memory_bytes: 19364
from itertools import combinations

n = int(input())
L = [int(x) for x in input().split()]

count = 0
for logs in combinations(L, 3):
    logs = sorted(list(logs))
    if logs[0] + logs[1] > logs[2] and logs[0] != logs[1] and logs[1] != logs[2] and logs[2] != logs[0]:
        count += 1
print(count)


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

using namespace std;

const long long INF = 1000000000000000000LL;

void Main() {
    int N;
    long long K;
    cin >> N >> K;
    vector<long long> a(N, 0);
    for (long long i = 0; i < N; ++i) {
        cin >> a[i];
    }

    long long ans = INF;
    for (int b = 0; b < (1 << N); ++b) {
        if (__builtin_popcount(b) < K) {
            continue;
        }
        long long maxSoFar = 0;
        long long tempAns = 0;
        for (int i = 0; i < N; ++i) {
            if (b >> i & 1) {
                if (a[i] <= maxSoFar) {
                    tempAns += maxSoFar - a[i] + 1;
                    ++maxSoFar;
                }
                else {
                    maxSoFar = a[i];
                }
            }
            else {
                maxSoFar = max(maxSoFar, a[i]);
            }
        }
        ans = min(ans, tempAns);
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    string s[N], X;
    map<string, int> mp;
    int t[N];
    rep(i, N){
        cin >> s[i] >> t[i];
        mp[s[i]] = i;
    }
    cin >> X;
    int j = mp[X];
    int ans = 0;
    rep2(i, j+1, N-1) ans += t[i];
    cout << ans << endl;
}

Measured memory_bytes: 256