akhauriyash/Code-Regression huggingface dataset:
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n, p; cin >> n >> p;
    vector<int> a(n);
    int sum = 0;
    bool check = 0;
    rep(i, n) {
        cin >> a[i];
        if(a[i] % 2 == 1) check = 1;
        sum += a[i];
    }
    int ans;
    if(check) {
        ans = 1LL;
        rep(i, n - 1) ans *= 2LL;
    } else {
        if(p == 1) {
            ans = 0;
        } else {
            ans = 1LL;
            rep(i, n) ans *= 2LL;
        }
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX =510000;
const int MOD = 1000000007;

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

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

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

int main(){
  COMinit();
  //約数が75個=3*5*5,15*5,25*3,75をそれぞれ。
  //2,4,14,24,74乗の数をカウントする？
  int N;
  cin>>N;
  vector<int> X2(101,0),X4(101,0),X14(101,0),X24(101,0),X74(101,0);
  unordered_map<int,int> mp;
  for(int i=2; i<=100; i++){
    int k=i;
    for(int j=2; j*j<=k; j++){
      if(k%j==0){
        int tmp=mp[j];
        k/=j;
        mp[j]=tmp+1;
        if(tmp+1==2)
          X2[i]++;
        else if(tmp+1==4)
          X4[i]++;
        else if(tmp+1==14)
          X14[i]++;
        else if(tmp+1==24)
          X24[i]++;
        else if(tmp+1==74)
          X74[i]++;
        j--;
      }
    }
    if(k>1){
      int tmp=mp[k];
      mp[k]=tmp+1;
      if(tmp+1==2)
        X2[i]++;
      else if(tmp+1==4)
        X4[i]++;
      else if(tmp+1==14)
        X14[i]++;
      else if(tmp+1==24)
        X24[i]++;
      else if(tmp+1==74)
        X74[i]++;
    }
  }
  for(int i=2; i<=100; i++){
    X2[i]=X2[i-1]+X2[i];
    X4[i]=X4[i-1]+X4[i];
    X14[i]=X14[i-1]+X14[i];
    X24[i]=X24[i-1]+X24[i];
    X74[i]=X74[i-1]+X74[i];
  }
  ll ans=0;
  ans+=COM(X2[N]-2,1)*COM(X4[N],2);
  ans+=COM(X14[N],1)*COM((X4[N]-1),1);
  ans+=COM(X24[N],1)*COM((X2[N]-1),1);
  ans+=COM(X74[N],1);
  cout<<ans<<endl;
}


Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll gcd(ll a,ll b){
  if(b==0)
    return a;
  
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

int main (){
  ll n,m;
  cin >> n >> m;
  
  ll lcm_pre;
  vector<ll> a(n);
  for(int i=0; i<n; i++){
    cin >> a.at(i);
    if(i==0) lcm_pre=a.at(i);
    else lcm_pre=lcm(lcm_pre,a.at(i));
  }
  bool ok=false;
  for(int i=0; i<n; i++){
    if((lcm_pre/2)%a.at(i)==(a.at(i)/2))
      continue;
    ok=true;
    break;
  }
  if(ok){
    cout << 0 << endl;
    return 0;
  }
  if(m%lcm_pre<(lcm_pre/2))
    cout << m/lcm_pre << endl;
  else
    cout << 1+m/lcm_pre << endl;
  return 0;
}

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

using namespace std;

long long n,m,p,y,nm[110000],z=1,hoge,memo[110000];
map<int,int> fmp,smp;

int main(void) {
    cin >> n >> m;
    for (int i=0 ; i<m ; i++) {
        cin >> p >> y;
        fmp[y] = p;
        memo[i] = y;
        nm[i] = p*10000000000+y;
    }
    sort(nm, nm+m);


    smp[nm[0]%10000000000] = z;
    hoge = nm[0]/10000000000;

    for (int i=1 ; i<m ; i++) {
        if (hoge == nm[i]/10000000000) z++;
        else z=1;

        smp[nm[i]%10000000000] = z;
        hoge = nm[i]/10000000000;
    }

    for (int i=0 ; i<m ; i++) {
        printf("%06d%06d\n", fmp[memo[i]], smp[memo[i]]);
    }
}

Measured memory_bytes: 12416
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=true;

/*---------------------------------------------------*/

bool check(int a){
  string s=to_string(a);
  rep(i,int(s.size())/2){
    if(s[i]!=s[s.size()-1-i])return false;
  }
  return true;
}

int main(){
  int a,b,ans=0;
  cin>>a>>b;
  REP(i,a,b+1){
    ans+=check(i);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int card[100]{};
    for(int i=0;i<n;i++){
        cin>>card[i];
    }
    int m;
    cin>>m;
    int card2[100]{};
    for(int i=0;i<m;i++){
        cin>>card2[i];
    }
    for(int i=0;i<m;i++){
        if(card[card2[i]]!=card[card2[i]-1]+1){
            if(card[card2[i]-1]!=2019){
                card[card2[i]-1]++;
            }
    }
    }
    for(int i=0;i<n;i++)cout<<card[i]<<endl;
}


Measured memory_bytes: 3116
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll a,b,c,d,n,maxi=0,f=0,mini=INF,sum=0;
    cin>>n;
    if(n==1)  cout<<1<<endl;
    else if(n==2) {
        cout<<2<<endl;
        return 0;
    }
    rep(i,n){
        sum+=i;
        b=i;
        if(sum>=n) break;
    }
    a=sum-n;
    rep(i,b+1){
        if(i!=a&&i!=0) cout<<i<<endl;
    }
    return 0;
}


Measured memory_bytes: 3504
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s; cin >> s;
  while(true){
    s.pop_back();
  	if(s.size()&1);
    else {
    	string a = s.substr(0, s.size() / 2);
      	string b = s.substr(s.size() / 2);
      if(a == b){
      	cout << s.size() << endl;
        return 0;
      }
    }
  }
  assert(0);
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Stream;

public class Main {

  public static int gcd(int a, int b) {
    if (b > a) return gcd(b, a);
    if (b == 0) return a;

    return gcd(b, a % b);
  }

  public static long gcd(long a, long b) {
    if (b > a) return gcd(b, a);
    if (b == 0L) return a;

    return gcd(b, a % b);
  }

  static int n;
  static int[] a, minp;

  public static void main(String[] args) throws Exception {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(System.out);

    String[] in = br.readLine().split(" ");
    n = Integer.parseInt(in[0]);
    in = br.readLine().split(" ");
    a = Stream.of(in).mapToInt(Integer::parseInt).toArray();

    int m = 1_000_000;
    minp = new int[m + 1];

    for (int i = 2; i <= m; i++) {
      if(minp[i] != 0) continue;
      for (int j = i; j <= m; j+=i) {
        minp[j] = i;
      }
    }

    Set<Integer> facs = new HashSet<>();

    boolean ng = false;

    for (int i = 0; i < n; i++) {

      int tmp = a[i];

      while (tmp > 1){
        int p = minp[tmp];
        if(facs.contains(p)) {
          ng = true;
          break;
        }
        tmp /= p;
      }

      if(ng) break;

      tmp = a[i];

      while (tmp > 1){
        int p = minp[tmp];
        facs.add(p);
        tmp /= p;
      }
    }

    if(!ng){
      System.out.println("pairwise coprime");
      return;
    }

    int allGcd = a[0];

    for (int i = 1; i < n; i++) {
      allGcd = gcd(allGcd, a[i]);
      if (allGcd == 1) {
        System.out.println("setwise coprime");
        return;
      }
    }

    out.println("not coprime");
    out.flush();
  }
}


Measured memory_bytes: 129336
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
  int minAns = 0, maxAns = 0;
  vector<int> ans(9, 0);
  for (int i = 0; i < N; i++)
  {
    if (a[i] >= 1 and a[i] <= 399)
      ans[0]++;
    else if (a[i] >= 400 and a[i] <= 799)
      ans[1]++;
    else if (a[i] >= 800 and a[i] <= 1199)
      ans[2]++;
    else if (a[i] >= 1200 and a[i] <= 1599)
      ans[3]++;
    else if (a[i] >= 1600 and a[i] <= 1999)
      ans[4]++;
    else if (a[i] >= 2000 and a[i] <= 2399)
      ans[5]++;
    else if (a[i] >= 2400 and a[i] <= 2799)
      ans[6]++;
    else if (a[i] >= 2800 and a[i] <= 3199)
      ans[7]++;
    else
      ans[8]++;
  }
  for (int i = 0; i < 8; i++)
  {
    if (ans[i] > 0)
      minAns++;
  }
  maxAns = minAns + ans[8];
  if (minAns == 0)
    minAns++;
  cout << minAns << " " << maxAns << endl;
}


Measured memory_bytes: 256
using System;

class sample
  {
  static void Main()
    {
    string[] input = Console.ReadLine().Split(' ');
    int[] num = new int[input.Length];
    int cnt = 0;
    
    for(int i=0;i<num.Length;i++)
      {
       num[i] = Convert.ToInt32(input[i]);
       cnt += num[i];
      }
    
    if(cnt<=21)
      {
      Console.WriteLine("win");
      }
    else
      {
      Console.WriteLine("bust");
      }
    }
  }

    
    


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

int main() {
  string S;
  
  cin >> S;
  
  if (S == "a" || S == "e" || S == "i" || S == "u" || S == "o")
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}


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

#define N 5050
typedef pair <int, int> pii;
typedef long long ll;
const ll inf = 1e18;
int n, m, p, head[N], nxt[N], to[N], w[N];
ll d[N];
void add_edge(int x, int y, int z, int id) {
    to[id] = y, w[id] = z;
    nxt[id] = head[x], head[x] = id;
}
queue <int> Q;
bool inq[N];
bool spfa(int x) {
    for (int i = 1; i <= n; i ++) d[i] = inf, inq[i] = 0;
    while (!Q.empty()) Q.pop();
    Q.push(x);
    d[x] = 0, inq[x] = 1;
    for (int runs = 0; runs <= 2 * n; runs ++) {
        int sz = Q.size();
        if (!sz) return 1;
        while (sz --) {
            x = Q.front(), Q.pop();
            inq[x] = 0;
            for (int i = head[x]; i; i = nxt[i]) {
                int y = to[i], z = w[i];
                if (d[y] <= d[x] + z) continue;
                if (runs >= n && y == n) return 0;
                d[y] = d[x] + z;
                if (!inq[y]) Q.push(y), inq[y] = 1;
            }
        }
    }
    return 1;
}


int main() {
    cin >> n >> m >> p; int tot = 0;
    while (m --) {
        int a, b, c;
        cin >> a >> b >> c;
        add_edge(a, b, p - c, ++tot);
    }
    if (!spfa(1)) puts("-1");
    else printf("%lld\n", max(0ll, -d[n]));
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void pr(A a){cout << a << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {}

int main(void) {
  int a,b;cin>>a>>b;
  int c = a+b;
  int d = a-b;
  int e = a*b;
  int r = max(c,d);
  pr(max(r,e));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int h, w;
    cin >> h >> w;

    int m;
    cin >> m;
    vector<P> ps(m);
    rep(i, m) cin >> ps[i].first >> ps[i].second, ps[i].first--, ps[i].second--;
    vector<ll> hs(h), ws(w);
    for (P p : ps) {
        hs[p.first]++;
        ws[p.second]++;
    }

    map<ll, ll> hc, wc;

    for (ll y : hs) hc[y]++;
    for (ll x : ws) wc[x]++;

    map<ll, ll> count_count;

    for (auto he : hc) {
        for (auto xe : wc) {
            ll yc = he.first;
            ll xc = xe.first;
            ll key = yc + xc;
            ll value = he.second * xe.second;
            count_count[key] += value;
        }
    }


//    for (auto e : count_count) {
//        printf("%lld %lld\n", e.first, e.second);
//    }
//    cout << endl;

    for (P p : ps) {
        ll y = hs[p.first];
        ll x = ws[p.second];

        count_count[y + x]--;
        count_count[y + x - 1]++;

    }
    ll ans = 0;
    for (auto e : count_count) {
//        printf("%lld %lld\n", e.first, e.second);
        if (e.second == 0) continue;
        cmax(ans, e.first);
    }
    cout << ans << endl;
}


Measured memory_bytes: 12768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		int a = sc.nextInt();
		int b = sc.nextInt();
		String u = sc.next();

		if (s.equals(u)) {
			System.out.println((a - 1) + " " + b);
		} else {
			System.out.println(a + " " + (b - 1));
		}

		sc.close();
	}
}


Measured memory_bytes: 27092
#include<bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define CS
using namespace std;
int main(){
    speed;
    int a,b;
    cin >> a >> b;
    cout << max(a+b,max(a-b,a*b));
}






Measured memory_bytes: 256
fn main() {
  let (h, w): (isize, isize) = read_tuple();
  let mat: Vec<Vec<char>> = read_mat(h as usize);
  
  let mut ans = vec![vec![String::new(); w as usize]; h as usize];
  
  for i in 0isize .. h {
    for j in 0isize .. w {
      let neighbor = [(i-1,j-1),(i-1,j),(i-1,j+1),(i,j-1),(i,j+1),(i+1,j-1),(i+1,j),(i+1,j+1)];
      ans[i as usize][j as usize] = 
        if mat[i as usize][j as usize] == '#' {
          "#".to_owned()
        } else {
          neighbor.iter().filter(|&&(x,y)| 0<=x && x<h && 0<=y && y<w && mat[x as usize][y as usize]=='#').count().to_string()
        }
    }
  }
  
  print_mat(&ans, "");
}

fn read_tuple<T1: std::str::FromStr, T2: std::str::FromStr>() -> (T1, T2) {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  let mut it = buf.trim().split_whitespace();
  let x = it.next().unwrap().parse::<T1>().ok().unwrap();
  let y = it.next().unwrap().parse::<T2>().ok().unwrap();
  (x, y)
}

fn read_vec() -> Vec<char> {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().chars().collect()
}

fn read_mat(h: usize) -> Vec<Vec<char>> {
  let mut mat: Vec<Vec<char>> = vec![];
  for _ in 0 .. h {
    mat.push(read_vec());
  }
  mat
}

fn print_vec<T: std::string::ToString>(vec: &Vec<T>, sep: &str) {
  let out = vec.iter().map(|e| e.to_string()).collect::<Vec<_>>().as_slice().join(sep);
  println!("{}", out);
}

fn print_mat<T: std::string::ToString>(mat: &Vec<Vec<T>>, sep: &str) {
  for v in mat {
    print_vec(v, sep);
  }
}

Measured memory_bytes: 4352
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(long long int i=0;i<p;i++)
#define reep(i,p) for(long long int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){

int x;
cin >> x;

if(x==0){
	cout << 1;
}

else{
	cout << 0;
}









	return 0;

}



Measured memory_bytes: 3628
n=int(input())
lst=[]
AC=0
WA=0
TLE=0
RE=0
for _ in range(n):
  i=input()
  if i=="AC":
    AC+=1
  elif i=="WA":
    WA+=1
  elif i=="TLE":
    TLE+=1
  elif i=="RE":
    RE+=1
print("AC x",AC)
print("WA x",WA)
print("TLE x",TLE)
print("RE x",RE)

Measured memory_bytes: 9140
N = int(input())
k = 1
n = 0
while n < N:
    n += k
    k += 1
if n!=N:
    print('No')
    exit()
print('Yes')
print(k)
ans = [[] for _ in range(k)]
v = 1
for i in range(k-1):
    for j in range(i+1,k):
        ans[i].append(v)
        ans[j].append(v)
        v += 1
for row in ans:
    print(len(row),*row)


Measured memory_bytes: 70904
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>

#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define abs(a) (((a) < 0) ? -(a) : (a))

#define FOR(var, to)          for (register int var = 0; var < to; var++)
#define FROMTO(var, from, to) for (register int var = from; var <= to; var++)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static inline int ri() {
	int a;
	scanf("%d", &a);
	return a;
}

static inline s64 rs64() {
	s64 a;
	scanf("%" SCNd64, &a);
	return a;
}

static inline void wi(int a) {
	printf("%d", a);
}

static inline void wu64(u64 a) {
	printf("%" PRIu64, a);
}

int main() {
	int n = ri();
	int m = ri();
	int d = ri();
	
	u64 tmp = (((u64) m)-1)*(n-d)*((d==0) ? 1 : 2);
	double res = ((u64)m-1)*((d==0) ? 1 : 2);
	res /= n;
	res *= (n-d);
	res /= n;
	
	// double res = tmp / (double)((u64)n*n);
	// res /= n;
	
	printf("%.7f", res);
	return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    vll A(N);
    REP(i, N) cin >> A[i];

    vll s(N + 1);
    s[0] = 0;
    REP(i, N) s[i + 1] = s[i] + A[i];

    ll ans = INF;
    int l = 0, r = 2;
    FOR(i, 2, N - 1) {
        while(l < i && abs(s[i] - 2 * s[l]) > abs(s[i] - 2 * s[l + 1])) {
            ++l;
        }

        while(r < N && abs(s[N] - 2 * s[r] + s[i]) > abs(s[N] - 2 * s[r + 1] + s[i])) {
            ++r;
        }

        vll tmp = {s[l], s[i] - s[l], s[r] - s[i], s[N] - s[r]};
        ans = min(ans, *max_element(ALL(tmp)) - *min_element(ALL(tmp)));
    }

    print(ans);
    
}


Measured memory_bytes: 6356
#include <iostream>

using namespace std;

int main(){
    long long a, b, k;
    cin >> a >> b >> k;
    long long lasta = a - k > 0 ? a - k : 0;
    long long lastb = a - k < 0 ? b - (k - a) : b;
    if(lastb < 0) lastb = 0;

    cout << lasta << " " << lastb << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		double s = a * b * Math.sin(Math.PI / 180 * c) / 2;
		System.out.println(s);
		System.out.println(a + b + Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(Math.PI / 180 * c)));
		System.out.println(2 * s / a);
	}
}

Measured memory_bytes: 17184
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String ans = "";
		for (char c : S.toCharArray()) {
			if (c == '0') {
				ans += "0";
			} else if (c == '1') {
				ans += "1";
			} else if (c == 'B' && ans.length() == 0) {
				continue;
			} else {
				ans = ans.substring(0, ans.length()-1);
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 38472
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) FOR(i,0,n)
 
int main(){
	
	string s;cin >> s;
	rep(i,s.size()-8) cout << s[i];
	cout << endl;
}

//cout << ans << endl;

Measured memory_bytes: 256
/**
*    author:  souzai32
*    created: 02.08.2020 15:09:11
**/

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

long int gcd(long  a, long int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

int main() {

    long int n,m;
    cin >> n >> m;
    string s,t;
    cin >> s >> t;
    bool ans=true;

    rep(i,gcd(n,m)){
        if(s.at(n*i/gcd(n,m))!=t.at(m*i/gcd(n,m))){
            ans=false;
            break;
        }
    }

    if(ans) cout << lcm(n,m) << endl;
    else cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,y;
  cin>>x>>y;
  if(((x==1||x==3||x==5||x==7||x==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12))||((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11))||((x==2)&&(y==2)))
  cout<<"Yes"<<endl;
  else 
  cout<<"No"<<endl;
}

Measured memory_bytes: 3560
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<cstdio>
using namespace std;

static const int INF=100000;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int k;
    int x;
    cin >> k >> x;
    int max=1000000;
    if(x-k<-max){
        for(int i=-max;i<x+k;i++){
            cout << i;
            if(i<x+k-1) cout << " ";
        }
        cout << endl;
    }else if(x+k>max){
        vector<int> ans;
        for(int i=max;i>x-k;i--){
            ans.push_back(i);
        }
        reverse(ans.begin(),ans.end());
        for(int i=0;i<ans.size();i++){
            cout << ans[i];
            if(i<ans.size()-1){
                cout << " ";
            }
        }
        cout << endl;
    }else{
        for(int i=x-k+1;i<x+k;i++){
            cout << i;
            if(i<x+k-1){
                cout << " ";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int> 
#define vll vector<ll> 
#define vpll vector<pair<ll ,ll>>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define map map<ll ,ll>
#define umap unordered_map<ll , ll>
#define endl "\n"
#define set set<ll> 
#define setC set<char>
#define all(x) x.begin() , x.end()
#define fast ios::sync_with_stdio(0); cin.tie(0);
#define fastcout ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define testcases int tt = 1 ; cin >> tt ; for(int i = 1 ; i <= tt ; ++i)
#define codejam cout << "Case #"<<i <<": "; 
#define FOR(i,a,n) for(int i = a ; i <= n ; ++i)
#define FORback(i,a,n) for(int i = n ; i >= a ; --i)
#define ll long long int
const ll INF = 1e13+7;
const ll mod = 1e9+7;

// double dp[3001][3001] ;
vector<vector<double>> dp;
double doSome(vector<double>&arr , int i , int curr ){
    
    if( curr ==  0){
        return 1;
    }
    if(i < 0){
        return 0;
    }

    if(dp[i][curr] > -.9) return dp[i][curr];


    double x = arr[i] * doSome(arr , i-1 , curr-1);
    double y = (1 - arr[i]) * doSome(arr , i-1 , curr);

    return dp[i][curr] = x+y;
}

void solv(){
    ll n;
    cin >> n ;
    vector<double> arr(n);

    FOR(i , 0 , n-1){
        cin >> arr[i];
        arr[i] = arr[i] * 1.000000000;
    }
  dp.assign(n+1 , vector<double>(n+1 , -1));

    ll target = (n+1)/2 ;
    // FOR(i , 0 , n){
    //     FOR(j , 0 , n){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    double ans = doSome(arr , n , target);

    cout   << setprecision(10) << ans <<  endl;
}

int main(){
    fast ;    
    // testcases{
        // codejam ;
        solv();
    // } 
}




Measured memory_bytes: 74004
#include "bits/stdc++.h"
using namespace std;
#define l_ength size
typedef long long ll;

vector<ll> v;

ll gcd(ll a, ll b){
if(a<b){
return gcd(b,a);
}else if(a%b){
return gcd(b, a%b);
}else{
return b;
}}

int main(void){
int n,i;
ll x,d;
cin >> n >> x;
v.push_back(x);
for(i=0; i<n; ++i){
cin >> x;
v.push_back(x);
}
sort(v.begin(),v.end());
d=v[n]-v[0];
for(i=0;i<n;++i){
d=gcd(v[i+1]-v[i],d);
}
cout << d << endl;
return 0;
}


Measured memory_bytes: 1400
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int main(){
    char s[101];
    scanf("%s",s);
    int i,l;
    l = strlen(s);
    for(i=0;i<l;i++){
        printf("x");
    }
    printf("\n");
    return 0;
}




Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define con continue
#define bk break
#define LL long long
#define db double
#define pt cout<<'\n'
#define ms(a, b) memset((a), (b), sizeof(a))
#define mp make_pair
#define endl '\n'
LL inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps = 1e-6; const long long nll =1000000000000000000;
#define sz size()
#define len(X) strlen(X)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ULL unsigned long long
#define de cout<<"test"<<endl;
#define st system("pause");
#define F first
#define S second
class MagicNumberThree
{

    public:
int countSubsequences(string s)
{

}

};
int vis[100005]={};
int val[100005]={};
int find(int x){
if(x==vis[x]){
    return x;
}
else{
    int tmp=vis[x];
    vis[x]=find(vis[x] );
     val[x]+=val[tmp];
     return vis[x];
}
}
int main()
{
    int a,b;
    while(cin>>a>>b){
            for(int i=0;i<100005;i++)
            vis[i]=i;

            int no=0;
        for(int i=0;i<b;i++){
          int x,y,z;
          cin>>x>>y>>z;
      int l=find(x),r=find(y);
      
      if(l==r){
        if(val[x]-val[y]!=z)
            no=1;
      }
      else{
        vis[l]=r;
        val[l]=z+val[y]-val[x];
      }

        }
        if(no){
            cout<<"No"<<endl;
        }
        else{
            cout<<"Yes"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

using ll = long long;

template <class T>
using grid = vector<vector<T>>;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int main() {
  ll input(a, b, c, x, y);

  set<ll> cost;
  for(ll ab = 0; ab <= max(x, y) * 2; ab += 2) {
    cost.insert(max(0ll, (x - ab / 2)) * a + max(0ll, (y - ab / 2)) * b + ab * c);
  }

  print(*cost.begin());
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    ll N;
    cin >> N;
    string S1, S2;
    cin >> S1 >> S2;
    vector<ll> a(N),b;
    rep(i,N){
        if(S1[i] == S2[i]){
            a[i] = 1;
        }else{
            a[i] = 2;
        }
    }
    rep(i,N){
        if(a[i] == 1){
            b.push_back(1);
        }else{
            b.push_back(2);
            i++;
        }
    }
    ll M = b.size();
    vector<ll> memo(M+1, 0);
    if(b[0] == 1){
        memo[0] = 3;
    }else{
        memo[0] = 6;
    }
    for(ll i = 0;i<M-1;i++){
        if(b[i] == 1){
            if(b[i+1] == 1){
                memo[i+1] = 2*memo[i];
                memo[i+1] %= mo;
            }else{
                memo[i+1] = 2*memo[i];
                memo[i+1] %= mo;
            }
        }else{
            if(b[i+1] == 1){
                memo[i+1] = memo[i];
                memo[i+1] %= mo;
            }else{
                memo[i+1] = 3*memo[i];
                memo[i+1] %= mo;
            }
        }
    }
    cout << memo[M-1] <<endl;
}
/*
1 2
2 1

1 3
2 1

1 2
2 3
*/

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

int main(void)
{
    char in[3];
    scanf("%s", in);
    int i1, i2, i3, i4;
    i1 = in[0] - 48;
    i2 = in[1] - 48;
    i3 = in[2] - 48;
    i4 = in[3] - 48;
    int m1 = 10 * i1 + i2;
    int m2 = 10 * i3 + i4;
    if(m1 == 0 || m1 > 12)
    {
        if(m2 == 0 || m2 > 12)
        {
            printf("NA");
        }else{
            printf("YYMM");
        }
    }else{
        if(m2 == 0 || m2 > 12)
        {
            printf("MMYY");
        }else{
            printf("AMBIGUOUS");
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){

	int a;
	char str1[20];
	int str2[20] = {0};
	scanf("%d", &a);
	
	for (int i=0; i<a; i++){
		scanf("%s", &str1);
		
		if(str1[0]== 'A'){
			str2[0]++;
		}
		else if(str1[0]=='W'){
			str2[1]++;
		}
		else if(str1[0]=='T'){
			str2[2]++;
		}
		else if(str1[0]=='R'){
			str2[3]++;
		}
	}
	printf("AC x %d\n",str2[0]);
	printf("WA x %d\n",str2[1]);
	printf("TLE x %d\n",str2[2]);
	printf("RE x %d\n",str2[3]);
	
	return 0;
}

Measured memory_bytes: 1736
#include<algorithm>
#include<cstring>
#include<cstdio>
#define LL long long
#define Re register int
using namespace std;
const int N=103,M=13;
int n,m,d[13][13],f[103][103];
inline void in(Re &x){
    int f=0;x=0;char c=getchar();
    while(c<'0'||c>'9')f|=c=='-',c=getchar();
    while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
    x=f?-x:x;
}
int main(){
//	freopen("123.txt","r",stdin);
	in(n),in(m);
	for(Re i=1;i<=n;++i)
		for(Re j=1;j<=m;++j)
			in(d[i][j]);
	for(Re i=0;i<=100;++i)
		for(Re j=0;j<=100;++j)
			for(Re x=1;x<=n;++x)
				for(Re y=1;y<=m;++y)
					f[i][j]=max(f[i][j],d[x][y]-i*x-j*y);
	for(Re x=1;x<=n;++x)
		for(Re y=1;y<=m;++y){
			Re dis=2e9;
			for(Re i=0;i<=100;++i)
				for(Re j=0;j<=100;++j)
					dis=min(dis,f[i][j]+i*x+j*y);
			if(dis!=d[x][y]){puts("Impossible");return 0;}
		}
	puts("Possible\n202 10401");
    for(Re i=1;i<=100;i++)printf("%d %d X\n",i,i+1);
    for(Re i=102;i<202;i++)printf("%d %d Y\n",i,i+1);
    for(Re i=0;i<=100;i++)
        for(Re j=0;j<=100;j++)
            printf("%d %d %d\n",i+1,202-j,f[i][j]);
    puts("1 202");
}

Measured memory_bytes: 256
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        long n = in.nextInt();
        long[] a = in.nextLongArray((int) n);
        BigInteger mod = new BigDecimal(MOD).toBigInteger();

        BigInteger ans = BigInteger.ZERO;
        for (int d = 0; d <= 60; d++) {
            long m = 0;
            for (long l : a) {
                if (((l >> d) & 1L) == 1L) {
                    m++;
                }
            }
            BigInteger toAdd = new BigDecimal(m * (n - m)).multiply(new BigDecimal(2).pow(d)).toBigInteger().mod(mod);
            ans = ans.add(toAdd).mod(mod);
            // out.println("digit " + d + ",  adding " + toAdd.toString() + ", total " + ans.toString());
        }
        out.println(ans.toString());
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

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

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

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


Measured memory_bytes: 80484
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
main()
{
    ll i,r,mn=10,ans=0;ll a[6]={0};
    for(i=0;i<5;i++){
        cin >> a[i];
        r = a[i]%10;
        if(r<mn&&r>0)mn=r;
        ans += a[i]+10-r;
        if(r==0)ans -=10;
    }
    ans -= 10-mn;
    cout << ans << endl;
}


Measured memory_bytes: 256
import kotlin.math.ceil
import kotlin.math.sqrt

fun main() {
    val N = nextInt()
    val MAX = ceil(sqrt(N.toDouble().div(3))).toInt()
    (1..N).forEach { n ->
        var count = 0
        (1..MAX).forEach { x ->
            (x..MAX).forEach TEST@{ y ->
                (y..N.minus(x).minus(y)).forEach { z ->
                    val value = f(x, y, z)
                    when {
                        value == n -> {
                            count += when (setOf(x, y, z).size) {
                                1 -> 1
                                2 -> 3
                                else -> 6
                            }
                        }
                        value > n -> return@TEST
                    }
                }
            }
        }
        println(count)
    }
}

private fun f(x: Int, y: Int, z: Int): Int {
    return x.times(x).plus(y.times(y)).plus(z.times(z)).plus(x.times(y)).plus(y.times(z)).plus(z.times(x))
}

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

Measured memory_bytes: 56284
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

void solve(int n){
	vector<P> vec;
	for(int i = 0;i < n;i++){
		char c;
		int x,y;
		cin >> c >> x;
		if(c == 'W'){
			cin >> y;
			int pos = -1,l;
			for(int j = 0;j < vec.size();j++){
				if(vec[j].first == -1){
					vec[j].first = x;
					if(y >= vec[j].second) y -= vec[j].second;
					else{
						pos = j;
						l = vec[j].second - y;
						vec[j].second = y;
						y = 0;
					}
				}
				if(!y) break;
			}
			if(pos != -1) vec.emplace(vec.begin() + pos + 1,-1,l);
			if(y) vec.emplace_back(x,y);
		}else if(c == 'D'){
			for(auto &p : vec){
				if(p.first == x) p.first = -1;
			}
		}else{
			int ans = -1;
			for(auto p : vec){
				x -= p.second;
				if(x < 0){
					ans = p.first;
					break;
				}
			}
			cout << ans << endl;
		}
	}
	cout << endl;
}

signed main(){
	int n;
	while(cin >> n,n){
		solve(n);
	}
}


Measured memory_bytes: 3188
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b) {
	if (a % b == 0) {
		return(b);
	}
	else {
		return(gcd(b, a % b));
	}
}

template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}




int main(void) {
	int a, b, c, d,n;
	cin >> a >> b >> c >> d >> n;
	b += a * 60;
	d += c * 60;
	cout << d - b - n;
}

/*

*/


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;
const ll mod=1000000007;

int main(){
  int n; cin>>n;
  ll ans=0;

  vector<ll> a(n);
  vector<ll> b(n);
  vector<ll> c(n);

  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  rep(i,n) cin>>c[i];
  sort(ALL(a));sort(ALL(c));
  rep(i,n){
    auto itra=lower_bound(ALL(a),b[i]);
    auto itrc=upper_bound(ALL(c),b[i]);
    ans+=(itra-a.begin())*(c.end()-itrc);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
from collections import deque
h,w=map(int,input().split())
field=[list(input()) for _ in range(h)]
cost=[[float('inf')]*w for _ in range(h)]
cost[0][0]=1
queue=deque([[0,0]])
count=0
for i in range(h):
    for j in range(w):
        if field[i][j]=='.':
            count+=1
def bfs():
    while queue:
        x,y=queue.popleft()
        for dx,dy in [[1,0],[-1,0],[0,1],[0,-1]]:
            if 0<=x+dx<h and 0<=y+dy<w:
                if field[x+dx][y+dy]=='.' and cost[x+dx][y+dy]==float('inf'):
                    cost[x+dx][y+dy]=cost[x][y]+1
                    queue.append([x+dx,y+dy])
bfs()
#print(cost)
if cost[-1][-1]<float('inf'):
    print(count-cost[-1][-1])
else:
    print(-1)


Measured memory_bytes: 3316
#include <iostream>
using namespace std;
 
int main() {
    int n,m;
    double p;
    int a[1001];
    while(1){
        double num = 0;
        double result;
        cin >> n >> m >>p;
        if(n+m+p == 0)break;
        for(int i = 0;i < n;i++){
            cin >> a[i];
            num += a[i];
        }
        if(a[m-1] == 0){
            cout << 0 <<endl;
            continue;
        }
        result = num*(100-p)/a[m-1];
        cout << (int)result <<endl;
    }
    return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define all(X) X.begin(),X.end()

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   str.substr (x) : returns a substring str[x],... end of string
   str.find(qtr) : returns the first occurenece of qtr in str */

const int M = (1<<20)+5;
const int md = 1e9+7;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}


vector<int> adj[2005];
int cnt[2005],mrk[2005],dist[2055];
queue<pi> pq;

void dijkstra(int u,int n)
{
	for(int i=1;i<=n;++i)
	{
		dist[i] = 1e9;
		mrk[i] = 0;
	}
	pq.push(pi(0,u));
	dist[u] = 0;
	while(!pq.empty())
	{
		pi ed = pq.front();
		pq.pop();
		u = ed.ss;
		if(mrk[u]) continue;

		mrk[u] = 1;
		for(auto v:adj[u])
		{
			if(dist[v]>dist[u]+1)
			{
				dist[v] = dist[u]+1;
				pq.push(pi(dist[v],v));
			}
		}
	}
}

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

	int x,y,i,j,n;

	cin >> n >> x >> y;
	adj[x].pb(y);
	adj[y].pb(x);

	for(i=1;i<n;++i)
	{
		adj[i].pb(i+1);
		adj[i+1].pb(i);
	}

	for(i=1;i<=n;++i)
	{
		dijkstra(i,n);
		for(j=1;j<=n;++j)
			cnt[dist[j]]++;
	}

	for(i=1;i<n;++i)
		cout << cnt[i]/2 << "\n";

	return 0;
}

	

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    lli n;
    cin1(n);
    lli x[n];
    lli y[n];
    ncin2(n,x,y);

    vlli a;
    REP(i,0,n) {
        a.push_back(i);
    }
    sort(a.begin(), a.end());

    double ans = 0;
    lli count = 0;
    do {
        //cout << "[" << a[0] << ", " << a[1] << ", " << a[2] << "]" << endl;;
        REP(i,0,n-1) {
            //cout2(a[i], a[i+1]);
            // a[i] と a[i+1] の距離を出す
            ans += sqrt((x[a[i]] - x[a[i+1]])*(x[a[i]] - x[a[i+1]]) +
                (y[a[i]] - y[a[i+1]])*(y[a[i]] - y[a[i+1]]));
            //cout << sqrt((x[a[i]] - x[a[i+1]])*(x[a[i]] - x[a[i+1]]) + (y[a[i]] - y[a[i+1]])*(y[a[i]] - y[a[i+1]]))<<endl;
        }
            count++;

    } while (next_permutation(a.begin(), a.end()));
    cout <<setprecision(14)<< ans/count << endl;
}


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

using namespace std;
using Graph = vector<vector<int>>;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)


void Main() {

    int a, b, c, k, ans;
    cin >> a >> b >> c >> k;

    if (a < k) {
        ans = ans + a;
        k = k - a;
    }
    else {
        ans = ans + k;
        cout << ans << endl;
        return;
    }

    if (b < k) {
        k = k - b; 
    }
    else {
        cout << ans << endl;
        return;
    }


    ans = ans - k;
    cout << ans << endl;


}
 
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}



Measured memory_bytes: 3620