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

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000007

#define prime 1000000007

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";
using namespace std;

int n;

int main(){
	scanf("%d", &n);
	int a = (n+1)/2;

    printf("%lf\n", (double)a/n);

	return 0;
}

Measured memory_bytes: 256
n,k = (int(x) for x in input().split())
r,s,p = (int(x) for x in input().split())
t = input()
a = []
ans = 0

for i in range(0,n):
    a.append(t[i])

for j in range(0,n):
    if j - k >= 0 and a[j - k] == a[j]:
           a[j] = "o"
    p
    if a[j] == "r":
        ans = ans + p
    if a[j] == "s":
        ans = ans + r
    if a[j] == "p":
        ans = ans + s


print(ans)

Measured memory_bytes: 10056
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int A,B;cin >> A >> B;
  cout << (A+B)%24 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
#define pb push_back

typedef long long ll;
using namespace std;
int MOD = 1000000007;
ll DP[51][2501];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N, A, x, sum = 0;
  cin >> N >> A;

  DP[0][0] = 1ll;
  FOR(i, 0, N){
    cin >> x;
    FORR(j, i, -1){
      FOR(k, 0, sum + 1){
        DP[j + 1][k + x] += DP[j][k];
      }
    }
    sum += x;
  }
  ll count = 0;
  FOR(i, 1, 51){
    count += DP[i][i * A];
  }
  cout << count << endl;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back 
#define mod 1e9+7
ll find_attack(ll n){
       if(n<=1)
         return 0;
         
    return 2*(find_attack(n/2)+1);
}

int main(){
      ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);    
     ll n;
          cin>>n;
         cout<<find_attack(n)+1;
          
          
    }
//aaaaa

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	str s;
	cin >> s;
	vector<int> a, z;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'A')
			a.push_back(i);
		else if (s[i] == 'Z')
			z.push_back(i);
	}

	cout << z.back() - a.front() + 1 << endl;

	return 0;
}

Measured memory_bytes: 4508
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

const int maxn=1e5+5;
int n;
ll a[maxn],b[maxn],c[maxn],tt,ts;

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc=='-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

int main(){
	n=rd();
	go(i,n+1,1) a[i]=rd(),tt+=a[i];
	go(i,n+1,1) b[i]=rd(),ts+=b[i];
	go(i,n+1,1) c[i]=a[i]-b[i];
	if(tt < ts){
		puts("-1"); return 0;
	}
	int mss=0,tl=0; ll qs=0;
	sort(c+1,c+n+1); int j=0,i;
	while(c[j+1] < 0) j++,qs+=c[j],mss++;
	for(i=n;i>=1;i--){
		if(qs >= 0) break;
		mss++; 
		qs+=c[i];	
	}
	printf("%d",mss);
	return 0;
}//Faze


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define oo 666666666
#define ll long long
#define ld long double

ll DP[3001][3001];
ll A[3001];

ll solve(int l, int r)
{
    if(l > r)return 0;
    if(l==r)return A[r];
    if(DP[l][r]!=0)return DP[l][r];
    return DP[l][r]=max(A[l] + min(solve(l+1,r-1),solve(l+2,r)), A[r] + min(solve(l+1,r-1),solve(l,r-2)));
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>A[i];

    cout<<2*solve(1,n) - accumulate(A, A+n+1, 0LL);
}


Measured memory_bytes: 70144
import Control.Applicative
import Data.List

main :: IO ()
main = do
  n <- readLn :: IO Int
  ws <- lines <$> getContents

  putStrLn $ if func ws && (length . nub) ws == length ws then "Yes" else "No"

  where
    func xs = and $ zipWith (\x y -> last x == head y) xs (tail xs) 


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

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

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
     
    static char[] k = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
     
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String s = "";
        while(stdIn.hasNext()) {
        s += stdIn.nextLine();
        }
        s = s.toLowerCase();
        int[] ans = new int[k.length];
        for(int i = 0; i < s.length(); i++) {
            for(int j = 0; j < k.length; j++) {
                if(s.charAt(i) == k[j]) {
                    ans[j]++;
                }
            }
        }
         
        for(int i = 0; i < 26; i++) {
            System.out.println(k[i]+" : " + ans[i]);
        }
    }
}


Measured memory_bytes: 26244
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n,m =MAP()

a = LIST()

tot = sum(a)

temp = (0.25/m)*tot

a = sorted(a)[::-1]

abc = a[m-1]

if(abc>=temp):
    print("Yes")
else:
    print("No")

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


int main()
{
	int a,b,c,d,e,k;  cin>>a>>b>>c>>d>>e>>k;
	
	
		
	
	if((e-a)<=k){
		cout<<"Yay!"<<endl;
		return 0;
	}
	
	else{
		cout<<":("<<endl;   return 0;
	}


}



Measured memory_bytes: 3604
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut head: usize = 0;
    let mut tail: usize = 0;
    let mut head_tail: usize = 0;
    let mut count: usize = 0;
    for _ in 0..n {
        let s = sc.chars();
        for i in 1..s.len() {
            if s[i - 1] == 'A' && s[i] == 'B' {
                count += 1;
            }
        }
        let h = s[0] == 'B';
        let t = s[s.len() - 1] == 'A';
        if h && t {
            head_tail += 1;
        }

        if h {
            head += 1;
        }
        if t {
            tail += 1;
        }
    }

    let mut connection = cmp::min(head, tail);
    if connection > 0 && connection == head_tail && head == tail {
        connection -= 1;
    }
    println!("{}", count + connection);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-14;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    ll a, b, c; cin >> a >> b >> c;
    if(0<c-a-b&&4*a*b<(c-a-b)*(c-a-b))cout<<"Yes\n";
    else cout<<"No\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
using namespace std;
using ll =long long;

int main() {
	string S;
	ll N;
	ll sum=0;
	
	map<ll,ll> R,G,B;
	
	cin >>N>> S;
	for (int i = 0; i < N; i++) {
		for (int j = i; j < N; j++) {
			if (S[j] == 'R') {
				R[i] ++;
			}
			if (S[j] == 'G') {
				G[i]++;
			}
			if (S[j] == 'B') {
				B[i]++;
			}
		}
	}
	for (int i = 0; i < N-2; i++) {
		for (int j = i + 1; j < N-1; j++) {
			if (S[i] != S[j]) {
				if (S[i] != 'R' && S[j] != 'R') {
					if (j + j - i< N && S[j - i + j] == 'R') {
						if (R[j + 1] - 1 > 0) {
							sum += R[j + 1] - 1;
						}
					}
					else {
						
							sum += R[j + 1];
						
					}
				}
				if (S[i] != 'G' && S[j] != 'G') {
					if (j + j - i <N && S[j - i + j] == 'G') {
						if (G[j + 1] - 1 > 0) {
							sum += G[j + 1] - 1;
						}
					}
					else {

						sum += G[j+1];
					}
				}
				if (S[i] != 'B' && S[j] != 'B') {
					if (j+j-i<N&&S[j - i + j] == 'B') {
						if (B[j + 1] - 1 > 0) {
							sum += B[j + 1] - 1;
						}
					}
					else {

						sum += B[j+1];
					}
				}
			}
		}
	}
	cout << sum;
	
	
}

Measured memory_bytes: 4304
#include <stdio.h>

int main(){

  int i;
  int j;
  int W;
  int H;


  
  while (1)
    {
      scanf("%d %d",&H,&W);

      if(H == 0 && W == 0){
	break;}
	
      for( i = 0; i < H;  i++){

    for ( j = 0; j < W; j++)
      printf("#");
     

	 
    printf("\n");
    } printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2128
#![allow(non_snake_case, unused_mut)]
use std::collections::HashMap;
fn main() {
    proconio::input! {
        n:usize,
        A:[usize;n]
    }
    let mut B = HashMap::new();
    //B.reserve(n);
    for i in 0..n {
        *B.entry(A[i]).or_insert(0) += 1;
    }
    let mut sum = 0;
    for (_, &v) in B.iter() {
        sum += combination(v);
    }
    //println!("sum={}", sum);
    for i in 0..n {
        let val = B.get(&A[i]).unwrap();
        let ans = sum + 1 - val;
        println!("{}", ans);
    }
}

fn combination(v: usize) -> usize {
    if v <= 1 {
        0
    } else {
        v * (v - 1) / 2
    }
}


Measured memory_bytes: 11468
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=100010;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    ll ar[n];
    for(ll i=0;i<n;++i){cin>>ar[i];}

    ll dp[n][n];

    ll size[n][n];

    for(ll i=0;i<n;++i)
    {
        for(ll j=0;j<n-i;++j)
        {
            if(i==0){
                size[j][i+j]=ar[j];
                dp[j][i+j]=0;
            }
            else{
                dp[j][i+j]=LLONG_MAX;
                for(ll k=j;k<i+j;++k)
                {
                    ll newdp=dp[j][k]+dp[k+1][i+j]+size[j][k]+size[k+1][i+j];
                    ll newsize=size[j][k]+size[k+1][i+j];
                    if(dp[j][i+j]>newdp)
                    {
                        dp[j][i+j]=newdp;
                        size[j][i+j]=newsize;
                    }
                }
            }
        }
    }
    cout<<dp[0][n-1]<<endl;

    return (0);
}


Measured memory_bytes: 2816
#include <iostream>
using namespace std;
using lld = long long int ;

int main(){
    lld N;
    lld ans=0;
    cin >> N;
    for(int i=1;i<N+1;i++){
        lld r = N/i;
        ans+=i*r*(r+1)/2;
    }
    cout << ans ;
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<algorithm>
using namespace std;
int d[11];
int main(){
	
	for(int i=0;i<10;i++)scanf("%d",d+i);
	std::sort(d,d+10);
	printf("%d\n%d\n%d\n",d[9],d[8],d[7]);
}

Measured memory_bytes: 1044
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9 + 10;

int X, Y;

int main() {
    cin >> X >> Y;
    rep(t, X+1) {
        if (4*t + 2*(X - t) == Y) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

int M[101][101] = {};
int p[101];

int matrixChain(int n)
{
    for (int i = 1; i <= n; i++)
    {
        M[i][i] = 0;
    }

    for (int l = 2; l <= n; l++)
    {
        for (int i = 1; i <= n - l + 1; i++)
        {
            int j = i + l - 1;
            M[i][j] = std::numeric_limits<int>::max();

            for (int k = i; k <= j - 1; k++)
            {
                M[i][j] = min(M[i][j], M[i][k] + M[k + 1][j] + p[i - 1] * p[k] * p[j]);
                //cout << M[1][n] << endl;
            }
        }
    }

    return M[1][n];
}

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

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> p[i - 1];
        cin >> p[i];
    }

    cout << matrixChain(n) << endl;

    return 0;
}


Measured memory_bytes: 3212
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST
import Data.Char


main :: IO ()
main = do
  n <- readLn :: IO Int
  as <- map read . words <$> getLine :: IO [Integer]
  print $ solve n as

solve n as = minimum $ map (\x -> abs $ 2 * x - s) sums
  where
    s = sum as
    sums = scanl1 (+) as


Measured memory_bytes: 72316
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    vector<int> v(n);
    for(int i = 0;i < n;++i)
        cin >> v.at(i);  
    int sum = 0;
    sort(v.begin(),v.end());
    for(int i = n - 1;i >= n - k;--i)
        sum += v[i];
    cout << sum << '\n';
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
long i,j,n,a[10];
char c[10];
while(cin>>c[0]){
a[0]=c[0]-48;
for(i=1;i<10;i++){cin>>c[i];a[i]=c[i]-48;}
for(j=1;j<10;j++)
for(i=0;i<10-j;i++)a[i]=(a[i]+a[i+1])%10;
cout<<a[0]<<endl;
}
return 0;
}

Measured memory_bytes: 1140
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	string s;
	cin>>s;
	int ans=0;
	rep(i,s.size()){
		ans+=int(s[i]-'0');
	}
	if(ans%9){
		cout<<"No";
	}
	else{
		cout<<"Yes";
	}
	re 0;
}

Measured memory_bytes: 3692
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>

using namespace std;

int main(void)
{
    int N, i, j, W[101], sum=0, left=0, ans1, ans2;

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> W[i];

        sum += W[i];
    }

    for(i=1; i<=N; i++){
        left += W[i];

        if(left >= sum/2){
            j = i;
            break;
        }
    }

    ans1 = abs(left-(sum-left));

    ans2 = abs(left-W[j]-(sum-left+W[j]));

    if(ans1<ans2){
        cout << ans1 << endl;
    }

    else{
        cout << ans2 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
    //ll sieve[10000009];
int main()
{

    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    map<ll,ll>m;
    ll x,n;
    cin >> x >> n;
    ll p[n];
    for(ll i=0;i<n;i++)
        cin >> p[i];
    for(ll i=0;i<n;i++)
    {
        m[p[i]]++;
    }
    ll bans=x;
    ll fans=x;
    while(m[bans])
    {
        bans--;
    }

    while(m[fans])
    {
        fans++;
    }
    if(abs(x-fans)<abs(x-bans))
    {
        cout << fans << endl;
    }
    else
        cout << bans << endl;

    return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>
int main () {
unsigned long long int a,b,c,d,x,countc,countd,countw,count,tmp,r, w,ci,di;
count = 0;
scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
if(b>=c){
    countc=b/c-(a-1)/c;
}
if(b>=d){
    countd=b/d-(a-1)/d;
}
ci = c;
di = d;
if(ci>di){
    c = ci ;
    d = di ;
} else{
    c = di;
    d = ci;
}

x = c * d;
 
  /* 自然数 a > b を確認・入替 */
  if(c<d){
    tmp = c;
    c = d;
    d = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = c % d;
  while(r!=0){
    c = d;
    d = r;
    r = c % d;
  }

w=x/d;
if(b>=w){
    countw=b/w-(a-1)/w;
}
count = b-(a-1)-countc-countd+countw;
  printf("%lld", count);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

const string YES = "Yes";
const string NO  = "No";

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

    string s;
    bool flg = false;

    cin >> s;

    for (int i = 0; i < s.size() - 1; ++i) {
        if (s.substr(i, 2) == "AC") {
            flg = true;
            break;
        }
    }

    cout << (flg ? YES : NO) << endl;

    return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
#
# Author: Tetsuya Ishikawa <tiskw111@gmail.com>
# Date  : July 05, 2020
##################################################### SOURCE START #####################################################

N = int(input().strip())

M = N // 1000 + (0 if N % 1000 == 0 else 1)
R = 1000 * M - N

print(R)

##################################################### SOURCE FINISH ####################################################
# vim: expandtab tabstop=4 shiftwidth=4 fdm=marker


Measured memory_bytes: 9144
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = [int(input()) for _ in range(N)]

A.sort()

if N%2 == 0:
    lower = A[:N//2]
    upper = A[N//2:]
    x = 2 * sum(upper) - upper[0]
    y = 2 * sum(lower) - lower[-1]
    answer = x - y
else:
    lower = A[:N//2]
    upper = A[N//2+1:]
    mid = A[N//2]
    x = 2 * sum(upper) - 2 * sum(lower) - mid + lower[-1]
    y = 2 * sum(upper) - 2 * sum(lower) + mid - upper[0]
    answer = max(x,y)
print(answer)

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

int main() {

    int N;
    cin >> N;

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

    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());

    int A = 0;
    int B = 0;

    for(int i=0; i<N; i++){
        if(i % 2 != 0){
            B += vec.at(i);
        }

        else{
            A += vec.at(i);
        }
    }

    cout << A - B << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1000000007ll
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
vl fact(200006);
ll modelus(ll a, ll b) {
    ll ans = 1;
    while(b) {
        if(b & 1ll) {
            ans = ans * a % mod;
        }
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
ll modinv(ll num) {
    return modelus(num, num - 2);
}
ll build_modinv() {
    fact[0] = fact[1] = 1;
    for(int i = 2; i <= 200005; ++i) {
        fact[i] = fact[mod % i]*(mod - mod / i) % mod;
    }
}
int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ad = modelus(2, n);
    build_modinv();
    ll asub = 1, bsub = 1;
    ll num = n;
    for(int i = 1; i <= a; ++i, --num) {
        asub = ((asub % mod) * ((num * fact[i]) % mod))%mod;
    }
    num = n;
    for(int i = 1; i <= b; ++i, --num) {
        bsub = ((bsub % mod) * ((num * fact[i]) % mod))%mod;
    }
    ll ans = (ad % mod - (asub + bsub + 1)%mod + mod)%mod;
    cout << ans;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp64 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int N = st[0];
            int X = st[1];

            int[] m = new int[N];

            for (int i = 0; i < N; i++) {
                m[i] = int.Parse(Console.ReadLine());
            }

            Console.WriteLine(N + (X - m.Sum()) / m.Min());

        }
    }
}


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

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int X = sc.nextInt();
        int[] x = new int[n+1];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        x[n] = X;
        Arrays.sort(x);
        long gcd = x[1] - x[0];
        for (int i = 0; i < n; i++) {
            gcd = gcd(gcd, x[i+1] - x[i]);
        }

        System.out.println(gcd);

    }

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


Measured memory_bytes: 51960
N,M = map(int,input().split())
ans = int(M**0.5+10)*[N-1]
mod = 10**9+7
p = 2
O = M

while p<=O**0.5:
  if M%p == 0:
    M = M//p
    ans[p] += 1
  else:
    p+=1
    
if M!=1:
  ans[-1]+=1

out = 1
for r in ans:
  hoge = 1
  for i in range(min(N-1,r-N+1)):
    hoge*=r-i
    hoge//=i+1
  out*=hoge
  out%=mod

print(out)

Measured memory_bytes: 9472
import java.util.*;
import java.lang.*;

import static java.lang.StrictMath.abs;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long q = sc.nextInt();
        long h = sc.nextInt();
        long s = sc.nextInt();
        long d = sc.nextInt();
        long n = sc.nextInt();
        long t = Math.min(8*q, 4*h);
        long t2 = Math.min(t, 2*s);
        long t3 = Math.min(t2, d);
        long ans = 0;
        if(t3 == 8*q){
            ans = q*4*n;
        }else if(2*q != h &&t3 == 4*h){
            ans = h * 2 * n;
        }else if(4*q != s && 2*h != s && t3 == s*2){
            ans = s*n;
        }else if(8*q != d && 4*h != d && 2*s!= d && t3 == d){
            ans += d*(n/2);
            if(t2 == 2*s){
                ans += s*(n%2);
            }else if(s != 2*h && t2 == 4*h){
                ans += 2*h*(n%2);
            }else if(s != 2*h && h != 2*q && t2 == 8*q){
                ans += 4*q*(n%2);
            }
        }
        System.out.println(ans);




    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int f[N],size[N],ans[N],n,m,k;
int find(int x) {
    return x == f[x] ? x : f[x] = find(f[x]);
}
void merge(int x,int y) {
    int xx = find(x);
    int yy = find(y);
    if(xx != yy) {
        f[xx] = yy;
        size[yy] += size[xx];
    }
}
int main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin >> n >> m >> k;
    for(int i = 1;i <= n; ++i) f[i] = i,size[i] = 1;
    int x,y;
    while(m --) {
        cin >> x >> y;
        ans[x] ++,ans[y] ++;// 把自己给计算上
        merge(x,y);
    }
    while(k --) {
        cin >> x >> y;
        if(find(x) == find(y)) {// 在同一个朋友圈内，才算黑名单
            ans[x] ++;
            ans[y] ++;
        }
    }
    for(int i = 1;i <= n; ++i) {
        cout << size[find(i)] - ans[i] - 1 <<' ';
    }
    return 0;
}

Measured memory_bytes: 2688
//============================================================================
// Name        : 0521.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int x;
	int c[6]={
		500,100,50,10,5,1
	};
	while(1){
		int ans=0;
	cin>>x;
	x=1000-x;
	if(x==1000){
		break;
	}
	for(int i=0;i<6;i++){
		ans=x/c[i]+ans;
		x=x%c[i];

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

Measured memory_bytes: 1160
a = int(input())
count = 0
ar = []
for i in range(a):
    l = int(input())
    count += l
    if l % 10 != 0:
        ar.append(l)
if count % 10 != 0:
    print(count)
else:
    if len(ar) == 0:
        print(0)
    else:
        print(count - min(ar))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main()
{
    fast();
    ll x,n;
    cin>>x>>n;
    set <int>s;
    for(int i=0;i<n;i++)
    {
        int y;
        cin>>y;
        s.insert(y);
    }

    long long int ans=1000;
    ll ret=10000;
    for(ll i=-1;i<=101;i++)
    {
        if(s.find(i)==s.end())
        {
            if(abs(x-i)<ans)
            {
                ans=abs(x-i);
                ret=i;
            }
        }
    }
    cout<<ret<<nl;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
long long n, m;
long long w[105], v[105];
long long rec(long long  x, long long  y){
	if(y < 0) return 1000000000005;
	if(x == n){
		if(y > 0)return 1000000000005;
		return 0;
	}
	if(dp[x][y] != -1)return dp[x][y];
	return dp[x][y] = min(rec(x+1, y), w[x] + rec(x+1, y - v[x]));
}
int main(){
	cin >> n >> m;
	for(long long i = 0; i <= 100; i++)
		for(long long j = 0; j <= 100000; j++)
			dp[i][j] = -1;
	for(long long i = 0 ; i < n ; i++)
		cin >> w[i] >> v[i];
	for(long long i = 100000; i >= 0; i--){
		long long temp = rec(0, i);
//		cout << temp << endl;
		if(temp <= m){
			cout <<i;
			return 0;
		}
	}
}

Measured memory_bytes: 80128
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int in;
  while(cin>>in,in){
    int co=0;
    while(in!=1){
      co++;
      if(in%2)in=in*3+1;
      else in/=2;
    }
    cout<<co<<endl;
  }


}

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


int main() {

    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int x = x2 - x1;
    int y = y2 - y1;
    cout << x2 - y << " " << y2 + x << " ";
    cout << x2 - y - x << " " << y2 + x -y << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bytes"
	"fmt"
)

// bytesのhassuffixを使う

var texts = [][]byte{[]byte("dream"), []byte("dreamer"), []byte("erase"), []byte("eraser")}

func main() {
	var s []byte
	fmt.Scan(&s)
	ans := false
	for {
		// sがtextを末尾に持つかどうか
		have := false
		for _, t := range texts {
			// もっていたらそれを消す
			if bytes.HasSuffix(s, t) {
				s = s[:len(s)-len(t)]
				have = true
				break
			}
		}
		if have {
			continue
		} else if len(s) == 0 {
			ans = true
			break
		} else {
			break
		}
	}
	if ans {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

public class Main {

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

		int a[] = new int[3];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();

		Arrays.sort(a);

		int result = 1;
		if(a[0] != a[1]){
			result++;
		}
		if(a[1] != a[2]){
			result++;
		}

		System.out.println(result);
	}
}

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

int main(){
  int N, K, Q, i;
  cin >> N >> K >> Q;
  int score[N];
  rep(i, N){
    score[i] = 0;
  }
  int t;
  rep(i, Q){
    cin >> t;
    score[t - 1]++;
  }
  rep(i, N){
    if(Q - score[i] >= K){
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 1024
// Template
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
#include <complex>
#define rep(i, x) for (int i = 0; i < (x); ++i)
#define rng(i, x, y) for (int i = (x); i < (y); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}
void solve();
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}

// Main Code
void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    
    vector<map<int, int>> cnt(m);
    for (int x: a) ++cnt[x % m][x];
    vector<int> d(m), s(m);
    rep(i, m) {
        int dou = 0, sum = 0;
        for (auto p: cnt[i]) {
            dou += p.second / 2;
            sum += p.second;
        }
        d[i] = dou;
        s[i] = sum;
    }
    
    int ans = 0;
    rep(i, m / 2 + 1) {
        int j = (m - i) % m;
        if (i == j) {
            ans += s[i] / 2;
        } else {
            if (s[i] > s[j]) ans += s[j] + min((s[i] - s[j]) / 2, d[i]);
            else if (s[i] == s[j]) ans += s[i];
            else ans += s[i] + min((s[j] - s[i]) / 2, d[j]);
        }
    }
    
    cout << ans << "\n";
    return;
}


Measured memory_bytes: 13628
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll a, b;
    cin >> a >> b;
    if(a == b){
        cout << 2 * a << endl;
    }else if(a > b){
        cout << (2 * a - 1) << endl;
    }else{
        cout << (2 * b - 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;

int n;
char s[105];
int ans = 0, temp;

int main() {
	cin >> n >> s;
	for (int i = 0; i < n; i ++) {
		if (s[i] == 'I') {
			temp ++;
		} else {
			temp --;
		}
		ans = max(ans, temp);
	}
	cout << ans << endl;

	return 0;
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

typedef pair<int,int> P;

int main() {
    int n; cin >> n;
    vector<vector<int>> a(n, vector<int>(n-1));
    rep(i, n) {
        rep(j, n-1) {
            cin >> a[i][j];
            a[i][j]--;
        }
        // vectorのeraseの処理高速化のために、消化するのは末尾にする
        reverse(a[i].begin(), a[i].end());
    }


    vector<P> q;
    auto check = [&](int i) {
        if(a[i].size() == 0) return;
        int j = a[i].back();
        if(a[j].size() == 0) return;
        if(a[j].back() == i) {
            P p(i, j);
            if(p.second < p.first) swap(p.first, p.second);
            q.push_back(p);
        }
    };
    rep(i, n) {
        check(i);
    }
    int ans = 0;

    while(q.size() > 0) {
        ans++;
        sort(q.begin(), q.end());
        q.erase(unique(q.begin(), q.end()), q.end());
        vector<P> prevQ;
        // 今みたいキューと新しいキューをみたい。(空のキューと前のキューをswapする)
        // これはO(1)でできる
        swap(prevQ, q);

        // 今日実施できる試合を消化する
        for(P p : prevQ) {
            int i = p.first, j = p.second;
            a[i].pop_back();
            a[j].pop_back();
        }
        // 次の日に消化できる試合は、今日試合をした人たちだけ
        for(P p : prevQ) {
            int i = p.first, j = p.second;
            check(i);
            check(j);
        }
    }
    rep(i, n) {
        if(a[i].size() != 0) {
            puts("-1");
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define inv(n, a) for(int i = 0; i < n; i++) cin >> a[i]
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
    int l, r;
	cin >> l >> r;
	int m = 2019;

	int ans = INF;
	for(int i = l; i < r; i++){
		for(int j = l+1; j <= r; j++){
			ans = min(ans, ((i % m) * (j % m)) % m);
			if (ans == 0){
				cout << ans << endl;
				return 0;
			}
		}
	}
	cout << ans << endl;
}


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

int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;

  int div_min = (h2-h1)*60 + (m2-m1);

  cout << div_min - k << endl;
}

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

using namespace std;
typedef long long ll;

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

  int a = 10000, b = 10000;

  for (int i = 0; i < 3; ++i) {
    int x; cin >> x;

    if (x < a) {
      b = a, a = x;
    } else if (x < b) b = x;
  }

  cout << a + b << "\n";
}


Measured memory_bytes: 3608
package main

import (
	"fmt"
	"strings"
)

func main() {
	var str string
	fmt.Scan(&str)

	var strSlice []string = strings.Split(str, "")

	if strSlice[2] == strSlice[3] && strSlice[4] == strSlice[5] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#!/usr/bin/env python

def main():
    W, H, x, y = map(int, input().split())

    S = W * H / 2
    if x == W / 2 and y == H / 2:
        N = 1
    else:
        N = 0
    print("{} {}".format(S, N))

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define up(j,k,i) for(ll i=j;i<k;i++)
#define down(j,k,i) for(ll i=j;i>k;i--)
#define M 1000000007
#define pp(n) printf("%lld\n",ll(n))
#define ps(n) printf("%lld ",ll(n))
#define pd(x,y) printf("%lld %lld\n",ll(x),ll(y))
#define is(n) scanf("%lld",&n)
#define inf LLONG_MAX
#define id(n,m) scanf("%lld%lld",&n,&m)
#define it(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define pb push_back
#define F first
#define S second
#define pll pair<ll,ll> 
#define db cout<<"######\n"
#define null(a) memset(a,0,sizeof(a))
#define neg(a) memset(a,255,sizeof(a))
typedef long double ld;
typedef long long int ll;
using namespace std;
ll i,j,k,z,t,n,m,sum,ans,x,y,maxm=0,minm=inf; bool flag;
int main()
{
	id(x,y);
	
	x+=2*(y-x);
	
	pp(x);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef pair<int, int> pii;

int main(){
  int n, m;
  std::cin >> n >> m;
  vector<pii> robot(m);
  for (int i = 0; i < m; i++) {
    std::cin >> robot[i].first >> robot[i].second;
    robot[i].second--;
  }
  sort(robot.begin(), robot.end());
  reverse(robot.begin(), robot.end());
  vector<pii> range(n);
  for (int i = 0; i < n; i++) {
    range[i] = pii(i, i);
  }
  for (int i = 0; i < m; i++) {
    int lane = robot[i].second;
    range[lane].first = min(range[lane].first, range[lane + 1].first);
    range[lane].second = max(range[lane].second, range[lane + 1].second);
    range[lane + 1].first = min(range[lane].first, range[lane + 1].first);
    range[lane + 1].second = max(range[lane].second, range[lane + 1].second);
  }
  vector<int> ans(n + 1, 0);
  for (int i = 0; i < n; i++) {
    // std::cout << range[i].first << std::endl;
    // std::cout << range[i].second << std::endl;
    ans[range[i].first]++;
    ans[range[i].second + 1]--;
  }
  for (int i = 0; i < n - 1; i++) {
    ans[i + 1] += ans[i];
  }
  for (int i = 0; i < n; i++) {
    std::cout << ans[i];
    if(i != n - 1)std::cout << " ";
  }
  std::cout << std::endl;
  return 0;
}

Measured memory_bytes: 5996
import functools
import numpy as np


def get_bool(x, value, axis):
    return np.where(x == value, True, False).all(axis=axis)


H, W = map(int, input().split())
mat = np.array([list(input()) for _ in range(H)])

custom_get_bool = functools.partial(get_bool, mat, '.')
mat = mat[:, ~custom_get_bool(0)]
mat = mat[~custom_get_bool(1)]
print('\n'.join([''.join(row) for row in mat]))


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

int main() {
    int n;
    long long result = 0;
    cin >> n;
    map<long long, long long> count;
    count[0] = 1;
    for (long long a, sum = 0; cin >> a; ) {
        sum += a;
        result += count[sum]++;
    }
    cout << result;
    return 0;
}

Measured memory_bytes: 12800
var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', function (line) {
  var a = line.split(' ');
  var b = parseInt(a[0],10);
  var c = parseInt(a[2],10);
  if(a[1]=='+')
  	b = b + c;
  else if(a[1]=='+')
  	b = b + c;
  else if(a[1]=='-')
  	b = b - c;
  else if(a[1]=='*')
  	b = b * c;
  else if(a[1]=='/')
  	b = b / c;
   if(a[1]=='?')
  	process.exit();
  console.log(Math.floor(b));
});
process.stdin.on('end', function () {
});

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

int main() {
	string str;
	getline(cin, str);
	int even = 0, odd = 0;
	for(int i = 0; i < str.size(); i++) {
		if(i % 2 == 0) {
			if(str[i] == '0') {
				even++;
			} else odd++;
		}
		else {
			if(str[i] == '0') {
				odd++;
			} else even++;
		}
	} cout << min(odd, even);
	return 0;
}

Measured memory_bytes: 512
#include<iostream>

using namespace std;

int main()
{
    string s,t;
    string m,n;
    int i,c=0;
    cin>>s>>t;
    for(i=0;i<s.size();i++)
    {   m=s[i];
        n=t[i];
        if(m.compare(n)!=0)c+=1;
    }
    cout<<c<<endl;
    return 0;

}

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

// #include "../../Template.cpp"

void solve() {
    int n; cin >> n;
    vector<int> arr(n, 0);
    for(int i = 0; i < n; i ++) cin >> arr[i];
    vector<vector<int>> dp(n+1, vector<int>(n+1, 0.0));
    dp[0][0] = 1.0;
    for(int32_t i = 1; i <= n; i ++) {
        for(int32_t j = 0; j <= n; j ++) {
            if(j<=i) {
                if(j == 0)
                    dp[i][j] = dp[i-1][j]*(1.0-arr[i-1]);
                else 
                    dp[i][j] = (dp[i-1][j]*(1.0-arr[i-1])) + (dp[i-1][j-1]*arr[i-1]);
            }
        }
    }
    // for(auto i:dp) {for(auto j:i) cout << j << " "; cout << endl;}
    int ans = 0;
    int32_t l = (n/2);
    for(int32_t i = l+1; i <= n; i ++) {
        ans += dp[n][i];
    }
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}

Measured memory_bytes: 141056
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w",stdout);
    #endif
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> s(n + 1);
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    s[l - 1] += 1;
    s[r] += -1;
  }
  for (int i = 0; i < n; i++) s[i + 1] += s[i];
  cout << count_if(s.begin(), s.end(), [m](int e) { return e == m; }) << endl;
}


Measured memory_bytes: 640