akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<sstream>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define strep(it,v) for(it=v.begin();it!=v.end();++it)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define s second
#define ll long long int
#define vi vector<int>
#define rs resize
int main()
{  ios::sync_with_stdio(false);
   ll a,b,c;
   cin>>a>>b>>c;
   if(c%__gcd(a,b)==0)
    cout<<"YES";
   else
    cout<<"NO";
   return 0;
}


Measured memory_bytes: 256
def B_121():
    a, b = input().split()
    c = int(a+b)
    d = 0
    for i in range(400):
        if c/(i+1) == (i+1):
            d=1
            break
    if d == 1: 
        print('Yes')
    else:
        print('No')        
    
B_121()

Measured memory_bytes: 2940
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#define T int t = 0; cin >> t; while(t--)
#define b_e(a) a.begin(), a.end()
typedef long long ll;
typedef  long double lld;
const ll mod = 1e9 + 7;
const ll mx = 1e5 + 1;
double find_sum(double x){
    return (x * (x + 1)) / 2.0;
}
void input(){
    cout << fixed << showpoint << setprecision(10);
    double n, k; cin >> n >>k;
    vector<double>a(n);
    f(i, n)cin >> a[i];
    double ans = 0.0;
    f(i, k)ans += find_sum(a[i]) /  a[i];
    double sum = ans;
    for(int i = k; i < n; ++i){
        sum = sum + (find_sum(a[i]) / a[i]) - (find_sum(a[i - k]) / a[i - k]);
        ans = max(ans, sum);
        

    }
    cout << ans << endl;
    
}
int main(){
    input();
    return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
typedef pair<ll,ll> ipair;
#define F first
#define S second
 


int main() {
    // ios_base::sync_with_stdio(false);
    // std::cin.tie(NULL);
    // std::cout.tie(NULL);
    
    
    ll n,i,j,p,k,m,t,ans=0;
    cin>>n>>t;
    long long int dp[3009][3009];
    // memset(dp, 0, sizeof(dp)); 
    for(i=0;i<3009;i++)
    {
        for(j=0;j<3009;j++)
        dp[i][j]=0;
    }
    vector<ll> a(n),b(n);
    vector<pair<ll,ll> > val(n);
    for(i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
        val[i].F=a[i];
        val[i].S=b[i];
    }
    sort(val.begin(),val.end());
    for(i=0;i<n;i++)
    {
        a[i]=val[i].F;
        b[i]=val[i].S;
    }
    for(i=0;i<t;i++)
    {
        for(j=0;j<n;j++)
        {
            if(i+a[j]<t)
            {
                dp[j+1][i+a[j]] = max(dp[j][i]+b[j],dp[j+1][i+a[j]]);
            }
            
            dp[j+1][i] = max(dp[j][i],dp[j+1][i]);
            
        }
    }
    
    for(i=0;i<n;i++)
    {
        ans = max(ans , dp[i][t-1] + b[i]);
    }
    cout<<ans<<endl;
    
    // for(i=0;i<n;i++)
    // {
    //     cout<<a[i]<<" ";
    // }
    // cout<<endl;
    
    return 0;
}

Measured memory_bytes: 74408
#include<stdio.h>
#include<string.h>
#define Max(x,y) ((x>y)?x:y)
int dx[2][7]={{0,1,1,1,0,-1},
			  {-1,0,1,0,-1,-1}};
int dy[6]={-1,-1,0,1,1,0,};
int map[105][105];
typedef struct p{
	int x,y;
}P;
P q[500],sq[500],c;
int qn,sqn;
int main(){
	int i,j,w,h,ans=0;
	scanf("%d%d",&w,&h);
	memset(map,0,sizeof(map));
	for(i=0;i<=h+3;i++)map[i][0]=map[i][w+3]=-1;
	for(i=1;i<=w+2;i++)map[0][i]=map[h+3][i]=-1;
	for(i=2;i<=h+1;i++){
		for(j=2;j<=w+1;j++){
			scanf("%d",&map[i][j]);
		}
	}
	q[0]=(P){1,1};qn=1;
	map[1][1]=2;
	while(qn!=0){
		sqn=0;
		for(i=0;i<qn;i++){
			for(j=0;j<6;j++){
				c=(P){q[i].x+dx[q[i].y%2][j],q[i].y+dy[j]};
				if(map[c.y][c.x]==1)ans++;
				else if(map[c.y][c.x]==0){
					sq[sqn]=c;
					sqn++;
					map[c.y][c.x]=2;
				}
			}
		}
		memcpy(q,sq,sizeof(P)*sqn);
		qn=sqn;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 0
use proconio::input;

fn main() {
    input! {
        n: u16,
    }

    let ans = match n % 10 {
        2 | 4 | 5 | 7 | 9 => "hon",
        0 | 1 | 6 | 8 => "pon",
        3 => "bon",
        _ => "",
    };

    println!("{}", ans);
}


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

namespace Guidebook
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var count = int.Parse(Console.ReadLine());
            var list = new List<RestaurantInfo>();
            for (int i = 1; i <= count; i++)
            {
                var inputs = Console.ReadLine().Split(' ');
                list.Add(new RestaurantInfo
                {
                    ID = i,
                    City = inputs[0],
                    Rating = int.Parse(inputs[1])
                });
            }

            var sortList = list.OrderBy(info => info.City).ThenByDescending(info => info.Rating);

            foreach (var item in sortList)
            {
                Console.WriteLine(item.ID);
            }
        }

        class RestaurantInfo
        {
            public int ID { get; set; }
            public string City { get; set; }
            public int Rating { get; set; }
        }
    }
}


Measured memory_bytes: 13536
from sys import stdin
from collections import defaultdict

N, M = [int(x) for x in stdin.readline().rstrip().split()]

if N == 1:
    print(1)
    exit()

S = defaultdict(int)

i = 2
while i ** 2 <= M:
    while M % i == 0:
        M //= i
        S[i] += 1
    i += 1
if M > 1:
    S[M] += 1

fact = [1]
for k in range(1, 31):
    fact.append(fact[-1] * k)

ans = 1
inf = 10 ** 9 + 7
for x in S:
    tmp = 1
    v = S[x] + N - 1
    for w in range(N, v + 1):
        tmp *= w
    tmp //= fact[S[x]]
    tmp %= inf
    ans *= tmp
    ans %= inf

print(ans)

Measured memory_bytes: 38576
#define _CRT_SECURE_NO_WARNINGS
using namespace std;
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <functional>
#include <set>
#include <queue>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <cassert>


using namespace std;

int mt[100][100], mt2[100][100];
vector<pair<int, int>> ans;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int M, D;
	int cnt = 0;
	cin >> M >> D;
	for (int i = 1; i <= M; i++)
	{
		for (int j = 10; j <= D; j++)
		{
			stringstream ss;
			ss << j;
			string s;
			ss >> s;
			if (s[0] >= '2' && s[1] >= '2' && i == (s[0] - '0') * (s[1] - '0'))
			{
				cnt++;
			}
		}
	}
	cout << cnt;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()
#define P pair<int,int>
#define pb(v) push_back(v)
#define V vector<int>
#define S set<int>
int main(){
    CIN(N);
    CIN(K);
    V vec;
    REP(a,N){
        CIN(b);vec.pb(b);
    }
    int ans = 0;
    REP(a,N){
        ans += 2*min(abs(vec.at(a)-K),vec.at(a));
    }
    COUT(ans);
    return 0;
}


Measured memory_bytes: 256
from math import sqrt

def main():
  n = int(input())
  if n < 5:
    for n in range(n):
      print(0)
    return

  n2 = int(sqrt(n)) + 1

  ans = [0] * (n + 1)

  for x in range(1, n2):
    for y in range(1, n2):
      if x**2 + y**2 + x*y > n:
        continue

      for z in range(1, n2):
        v = x**2 + y**2 + z**2 + x*y + y*z + z*x
        if v <= n:
          ans[v] += 1

  for i in range(1, n+1):
    print(ans[i])


main()


Measured memory_bytes: 9316
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define INF (ll)1000000007
// chmax chmin
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; }

int main(void){
    int N, M;
    cin >> N >> M;
    string A[N], B[M];
    REP(i,N) cin >> A[i];
    REP(i,M) cin >> B[i];

    bool flag = true;
    REP(i,N-M+1)REP(j,N-M+1){
        flag = true;
        REP(p,M)REP(q,M){
            if(B[p][q] != A[i+p][j+q]){flag = false; break;}
        }
        if(flag){cout << "Yes" << endl; return 0;}
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <list>
#include <math.h>
#include <map>
using namespace std;

int dx[4] = {0,-1,1,0};
int dy[4] = {-1,0,0,1};
int N = 55555;
int arr[55555];
void Eratosthenes(){
	for(int i = 0; i < N; i++){
		arr[i] = 1;
	}
	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}
}
int main(void){
  Eratosthenes();
  vector<int> sosu;
  for(int i = 2; i < N; i++){
    if(arr[i]){
      if(i%10 == 1){
        sosu.push_back(i);
      }
    }
  }
  cin >> N;
  for(int i = 0; i < N; i++){
    if(i!=0)cout << " ";
    cout << sosu[i];
  }cout << endl;
  return 0;

}


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

#define ll 				long long
#define ull 			unsigned long long int
#define ld 				long double
#define mod 			1000000007
#define setbits(x)		__builtin_popcount(x)
#define setbits_ll(x)	__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctz(x)
#define zrobits_ll(x)	__builtin_ctzll(x)
#define inf 			1e18
#define ps(x,y)			fixed<<setprecision(y)<<x  //set precision of double x to y decimal places 
												   //ps(1.254754, 4) -> 1.2547 


using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
   
   	int x; cin>>x;
   	if(x >= 30) cout<<"Yes"<<'\n';
   	else cout<<"No"<<'\n';
}
//functions

int getpow(int a, int b){
    if(b==0) return 1;

    int x=getpow(a, b/2);
    if(b&1) return x*x*a;
    else return x*x;
}


Measured memory_bytes: 3644
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<queue>
#include<unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull; 
const ll maxn = 100000 + 5;
int num[maxn];
bool cmp(int a, int b){
	return a > b;
}
int main(){
//	ios::sync_with_stdio(false);
//	ifstream cin("data.txt");
//	freopen("data.txt", "r", stdin);
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> num[i];
	}
	sort(num, num + n, cmp);
	while(n != 1){
		int temp = n;
		for(int i = 0; i < n - 1; i++){
			num[i] %= num[n - 1];
			if(!num[i])temp--;
		}
		sort(num, num + n, cmp);
		n = temp;
//		cout << "n = " << n << endl;
//		for(int i = 0; i < n; i++){
//			cout << num[i] << " ";
//		}
//		cout << endl;
//		cin >> temp;
	}
	cout << num[0];
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <ctime>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1000000000;
const int maxN = 100010;
int a[maxN*2];
ll abs_(ll x,ll y)
{
	ll z = x - y;
	if(z < 0)
		z = -z;
	return z;
}
int main()
{
	int n;
	scanf("%d",&n);
	ll ans = 0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		ans += a[i];
	}
	ll left=0,right=ans;
	ll minn = (ll)1<<50;
	ll cnt;
	for(int i=1;i<n;i++)
	{
		left+= a[i];
		right -= a[i];
		cnt = abs_(left,right);
		if(cnt < minn)
			minn = cnt; 
	}
	printf("%lld\n",minn);
	return 0;
}

Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: u32 = read();
    let b: u32 = read();
    let ans = if (a * b) % 2 == 0 { "Even" } else { "Odd" };
    println!("{}", ans);
}


Measured memory_bytes: 4352
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	n := scInt()
	dp := make([][]int, n+1)

	for i := 0; i < n+1; i++ {
		dp[i] = make([]int, 3)
	}

	for i := 0; i < n; i++ {
		a, b, c := scInt3()
		dp[i+1][0] = max(dp[i][1], dp[i][2]) + a
		dp[i+1][1] = max(dp[i][0], dp[i][2]) + b
		dp[i+1][2] = max(dp[i][0], dp[i][1]) + c
	}
	fmt.Println(maxInts(dp[n]))
}

func scStr() string {
	var s string
	fmt.Scan(&s)
	return s
}

func scInt() int {
	var x int
	fmt.Scan(&x)
	return x
}

func scInt2() (int, int) {
	var x, y int
	fmt.Scan(&x, &y)
	return x, y
}

func scInt3() (int, int, int) {
	var x, y, z int
	fmt.Scan(&x, &y, &z)
	return x, y, z
}

func scInts(n int) (slice []int) {
	slice = make([]int, n)
	for i := range slice {
		fmt.Scan(&slice[i])
	}
	return slice
}

func sum(slice []int) (sum int) {
	sum = 0
	for i := range slice {
		sum += slice[i]
	}
	return
}

func unique(strs []string) (unique []string) {
	m := map[string]bool{}
	for _, v := range strs {
		if !m[v] {
			m[v] = true
			unique = append(unique, v)
		}
	}
	return unique
}

func min(x, y int) int {
	if x > y {
		return y
	}
	return x
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func minInts(ints []int) int {
	sort.Ints(ints)
	return ints[0]
}

func maxInts(ints []int) int {
	sort.Ints(ints)
	n := len(ints)
	return ints[n-1]
}

func powi(x, pow int) int {
	return int(math.Pow(float64(x), float64(pow)))
}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; long long l, t; cin >> n >> l >> t;
    vector<long long> x(n), w(n), px(n);
    vector<pair<long long, int>> place;
    vector<int> anti;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> w[i];
        if (w[0] != w[i]) anti.emplace_back(i);
        long long p = x[i];
        if (w[i] == 1) p = (p + t) % l;
        else p = ((p - t) % l + l) % l;
        px[i] = p;
        place.emplace_back(p, i);
    }
    if (n == 1) {
        cout << px[0] << "\n";
        return 0;
    }
    sort(place.begin(), place.end());
    long long cnt = 0;
    auto calc = [&](int c) {
        long long cnt = c;
        for (int i = 0; i < n; i++) {
            if (w[i] == w[c]) continue;
            if (w[c] == 1) {
                long long d = (x[i] - x[c] + l) % l;
                if (t * 2 < d) continue;
                long long remain = t * 2 - d; cnt++;
                cnt += remain / l;
            } else {
                long long d = (l + x[c] - x[i]) % l;
                if (t * 2 < d) continue;
                long long remain = t * 2 - d; cnt--;
                cnt -= remain / l;
            }
        }
        return (cnt % n + n) % n;
    };
    int idx0 = calc(0), idx1 = calc(1);
    vector<long long> ans(n, -1);
    int prev = -n;
    for (int i = 0; i < n; i++) {
        int t = calc(place[i].second);
        ans[t] = place[i].first;
        if (prev + 1 == t) {
            for (int j = i+1; j < n; j++) {
                ans[(t-i+j) % n] = place[j].first;
            }
            break;
        }
        prev = t;
    }
    for (auto &c: ans) {
        assert(c != -1);
        cout << c << "\n";
    }
    return 0;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
char s[77], t[77];

int main() {
	scanf("%s %s", s, t);
	int ls = strlen(s);
	int lt = strlen(t);
	if(ls == lt) {
		for(int i = 0; i < ls; i++) printf("%c%c", s[i], t[i]);
		putchar('\n');
	}
	else {
		for(int i = 0; i < lt; i++) printf("%c%c", s[i], t[i]);
		printf("%c\n", s[ls - 1]);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
//桁
int kt(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
signed main(){
  string a,b;
  cin>>a>>b;
  int c=0;
  if(a.at(0)==b.at(0))
    c++;
  if(a.at(1)==b.at(1))
    c++;
  if(a.at(2)==b.at(2))
    c++;
  cout<<c;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
hf=[[0 for i in range(w)]for i in range(h)]
vf=[[0 for i in range(w)]for i in range(h)]
field=[]
for i in range(h):
    field.append(list(input()))
for i in range(h):
    tmp=0
    for j in range(w):
        if field[i][j]=='.':
            tmp+=1
            hf[i][j]=tmp
        else:
            tmp=0
    tmp=0
    for j in range(w):
        j=w-j-1
        if field[i][j]=='.':
            if tmp == 0:
                tmp=hf[i][j]
            else:
                hf[i][j]=tmp
        else:
            tmp=0
for j in range(w):
    tmp=0
    for i in range(h):
        if field[i][j]=='.':
            tmp+=1
            vf[i][j]=tmp
        else:
            tmp=0
    tmp=0
    for i in range(h):
        i=h-i-1
        if field[i][j]=='.':
            if tmp == 0:
                tmp=vf[i][j]
            else:
                vf[i][j]=tmp
        else:
            tmp=0
mx=0
for i in range(h):
    for j in range(w):
        if hf[i][j]+vf[i][j]>mx:
            mx=hf[i][j]+vf[i][j]
print(mx-1)


Measured memory_bytes: 247176
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
  int N = inputValue();
  int K = inputValue();
  int Q = inputValue();
  int A[100000];
  int C[100000];
  REP(i, N){
    C[i] = 0;
  }
  REP(i, Q){
    int v = inputValue();
    C[v-1] += 1;
  }
  REP(i, N){
    int val = K - (Q - C[i]);
    string ans = val > 0 ? "Yes" : "No";
    cout << ans << endl;
  }
}


Measured memory_bytes: 1024
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=1000+10,V=5000+10;
const int inf=0x3f3f3f3f;

int n,X[N];

struct edge { int v,nxt; } e[N];
int head[N];
inline void addEdge(int u,int v) {
    static int cnt=0;
    e[++cnt]=(edge){v,head[u]},head[u]=cnt;
}

int f[N],dp[V],tmp[V];

inline void dfs(int u) { f[u]=inf;
    for (re int i=head[u];i;i=e[i].nxt) dfs(e[i].v);
    memset(dp,inf,sizeof(dp)); dp[0]=0;
    for (re int i=head[u];i;i=e[i].nxt) { int v=e[i].v;
        for (re int j=0;j<=X[u];++j) tmp[j]=inf;
        for (re int j=0;j<=X[u];++j) {
            if (j>=X[v]) tmp[j]=min(tmp[j],dp[j-X[v]]+f[v]);
            if (j>=f[v]) tmp[j]=min(tmp[j],dp[j-f[v]]+X[v]);
        }
        for (re int j=0;j<=X[u];++j) dp[j]=tmp[j];
    }
    for (re int i=X[u];~i;--i) f[u]=min(f[u],dp[i]);
}

int main() {
    n=read();
    for (re int i=2;i<=n;++i) addEdge(read(),i);
    for (re int i=1;i<=n;++i) X[i]=read();
    dfs(1); puts(f[1]<inf?"POSSIBLE":"IMPOSSIBLE");
    return 0;
}


Measured memory_bytes: 256
//BISMILLAH
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int k,x,y,flag=0,sum;
   cin>>k>>x>>y;
   for(int i=x;i<=y;i++)
   {
       if(i%k==0)
       {
           flag=1;
           break;
       }
   }
   if(flag==1)
    cout<< "OK"<<endl;
   else
    cout<< "NG"<<endl;

   return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

int main(int argc, char* argv[])
{
    long a,b,c;
    scanf("%ld%ld%ld", &a,&b,&c);
    if(a==b) {
        printf("%ld\n", c);
    }
    else if(b==c) {
        printf("%ld\n", a);
    }
    else {
        printf("%ld\n", b);
    }

    return 0;
}


Measured memory_bytes: 128
import sys

n = int(input())
A = list(map(int,sys.stdin))
cnt = 0

G = [int((2.25**i-1)/1.25)for i in range(17,0,-1)]
G = [v for v in G if v <= n]

def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
for g in G:
    insertionSort(A, n, g)
    
print(len(G))
print(*G)
print(cnt)
print('\n'.join(map(str,A)))


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

int main(){
    int N,mn1=10000,mn2=10000;
    for(int i=0;i<3;i++){
        cin>>N;
        mn1=min(mn1,N);
    }
    for(int i=0;i<2;i++){
        cin>>N;
        mn2=min(mn2,N);
    }
    printf("%d\n",mn1+mn2-50);
    return 0;
}

Measured memory_bytes: 1148
l, r = [int(x) for x in input().split()]

l_mod = l % 2019
if r - l >= 2019:
    r_mod = l_mod + (r - l - 2019) % 2019 + 2019
else:
    r_mod = l_mod + (r - l) % 2019

ans = 2019
for i in range(l_mod, r_mod):
    for j in range(i + 1, r_mod + 1):
        tmp = (i * j) % 2019
        if tmp < ans:
            ans = tmp

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>c;
	cin>>b>>d;
	cin>>e;
	a=abs(a-b);
	c=c-d;
	if(e*c>=a){
		cout<<"YES";
	}else{
		cout<<"NO";
	}
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    string a;
    cin >> a;
    if (a[0]*1000+a[1]*100+a[2]*10+a[3]-53328<=2019){
        if (a[0]*1000+a[1]*100+a[2]*10+a[3]-53328<2019){
            cout << "Heisei" << endl;
            return 0;
        }
        if (a[0]*1000+a[1]*100+a[2]*10+a[3]-53328==2019){
            if (a[5]==48 && a[6]-48<5){
                cout << "Heisei" << endl;
                return 0;
            }
        }
    }
    cout << "TBD" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

int n,m;
std::pair<int,bool> t[400040];

int main(void)
{
    int i;
    int k;
    int answer = 0;

    //freopen("x.in","r",stdin);

    scanf("%d %d",&n,&m);
    for(i = 0;i < n;++i)
        scanf("%d",&t[i << 1].first),t[(i << 1) | 1].first = t[i << 1].first + m,
            t[i << 1].second = true,t[(i << 1) | 1].second = false;
    std::sort(t,t + (n << 1));

    k = 0;
    for(i = 0;i < (n << 1);++i)
    {
        if(k)
            answer += t[i].first - t[i - 1].first;
        k += t[i].second ? 1 : -1;
    }
    printf("%d\n",answer);

    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
int main(){
    int n;
    int a[3][3];
    rep(i,3){
      rep(j,3)cin >>a[i][j];
    }
  cin>>n;
  int b;
  rep(i,n){
    cin>>b;
    rep(i,3){
      rep(j,3){
        if(a[i][j] ==b)a[i][j]=0;
      }
    }
  }
  bool bingo =false;
      rep(i,3){
        if(a[i][0]==0 && a[i][1]==0 &&a[i][2]==0) bingo =true;
      }
      rep(i,3){
        if(a[0][i]==0 && a[1][i]==0 &&a[2][i]==0) bingo =true;
      }
      if (a[0][0]==0&&a[1][1]==0&&a[2][2]==0)bingo =true;
      if (a[2][0]==0&&a[1][1]==0&&a[0][2]==0)bingo =true;
      if (bingo)cout <<"Yes";
      else cout << "No";
      
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val N = sc.nextInt()
    val K = sc.nextInt()
    val X = sc.nextInt()
    val Y = sc.nextInt()
    println(Math.min(K, N) * X + Math.max(0, N - K) * Y)
}

Measured memory_bytes: 31388
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define F first
#define S second

const ll P = 1000000007;

using namespace std;

int n;
bool a[21][21];
ll dp[22][(1<<21)];

int main(){

	cin >> n;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			cin >> a[i][j];
		}
	}

	dp[0][0] = 1;

	for(int i=0; i<n; i++){
		for(int b=0; b<(1<<n); b++){
			if(dp[i][b] == 0) continue; 
			for(int j=0; j<n; j++){
				if(~(b>>j)&1 && a[i][j]){
					dp[i+1][b+(1<<j)] = (dp[i+1][b+(1<<j)]+dp[i][b])%P;
				}
			}
		}
	}

	ll ans = 0;
	for(int i=0; i<(1<<n); i++) ans = (ans+dp[n][i])%P;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 309504
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int max = 0,count=0,len=s.length();
    for(int i = 0;i < len;i++){
      switch(s.charAt(i)){
        case 'A':
          count++;
          break;
        case 'T':
          count++;
          break;
        case 'G':
          count++;
          break;
        case 'C':
          count++;
          break;
        default:
          count=0;
      }
      if(max < count)max=count;
    }
    System.out.println(max);
  }
}

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

using namespace std;

const int maxn = 30;

int n, m;

int cnt[maxn];

string s;

int four, two, one;

bool f()
{
	for(int i=0;i<26;i++)
		while(four>0&&cnt[i]>=4)
		{
			cnt[i]-=4;
			four--;
		}
	if(four)
		return 0;
	for(int i=0;i<26;i++)
		while(two>0&&cnt[i]>=2)
		{
			cnt[i]-=2;
			two--;
		}
	if(two)
		return 0;
	for(int i=0;i<26;i++)
		while(one>0&&cnt[i]>=1)
		{
			cnt[i]-=1;
			one--;
		}
	if(one)
		return 0;
	return 1;
}
int main()
{
	cin >> n >> m;
	for(int i=0;i<n;i++)
	{
		cin >> s;
		for(int j=0;j<m;j++)
			cnt[s[j]-'a']++;
	}
	four = two = one = 0;
	if(n&1)
	{
		if(m&1)
		{
			four = (n-1)/ 2 * (m-1)/2;
			two = (n-1)/2 + (m-1)/2;
			one = 1;
		}
		else
		{
			four = (n-1)/2 * m /2;
			two = m / 2;
		}
	}
	else
	{
		if(m&1)
		{
			four = n/2 * (m-1)/2;
			two = n/2;
		}
		else
		{
			four = n/2 * m/2;
		}
	}
	if(f())
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


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

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for(int i=1;i<=n;i++){
        int tmp = 0;
        for(int j=1;j<=i;j++){
            if(i%2 == 0)break;

            if((i%j) == 0){
                tmp++;
            }
        }
        if(tmp == 8){ans++;}
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());
  cout << (s < t ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    for(int i=0;i<20000;i++){
        if(i%2==0){
            c-=b;
            if(c<1){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
        else{
            a-=d;
            if(a<1){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
int main()
{
    ll A,B,N;
    cin>>A>>B>>N;
    ll x=min(B-1,N);
    cout<<floor(A*x/B)-A*floor(x/B)<<endl;
}

Measured memory_bytes: 3788
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  long long dp[s.size() + 1][t.size() + 1];
  for (int i = 0; i <= s.size(); i++)
    dp[i][0] = 0;
  for (int j = 0; j <= t.size(); j++)
    dp[0][j] = 0;
  for (int i = 0; i < s.size(); i++)
    for (int j = 0; j < t.size(); j++) {
      dp[i + 1][j + 1] = 0;
      if (s[i] == t[j]) {
        dp[i + 1][j + 1] = dp[i][j] + 1;
      }
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], max(dp[i][j + 1], dp[i + 1][j]));
    }
  string ans;
  int i = s.size(), j = t.size();
  while (i > 0 && j > 0 && dp[i][j] > 0) {
    if (dp[i][j] == dp[i - 1][j - 1] + 1 && dp[i][j] == dp[i - 1][j] + 1 &&
        dp[i][j] == dp[i][j - 1] + 1) {
      ans.push_back(s[i - 1]);
      i--;
      j--;
      continue;
    }
    if (dp[i][j] == dp[i - 1][j]) {
      i--;
      continue;
    } else {
      j--;
      continue;
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 70656
//36
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  for(string s,ss;cin>>s>>ss;){
    int dp[2][4001]={};
    int ans=0;
    for(int y=1;y<=ss.size();y++){
      for(int x=1;x<=s.size();x++){
	dp[y&1][x]=((ss[y]==s[x-1])?dp[(y-1)&1][x-1]+1:0);
	ans=max(ans,dp[y&1][x]);
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    string s;
    cin>>s;
    bool atoMM, maeMM;
    atoMM=false;
    maeMM=false;
    if((s[0]=='0' && s[1]!='0') || (s[0]=='1' && (s[1]=='0' || s[1]=='1' || s[1]=='2')))
    {
        maeMM=true;
    } 
    if((s[2]=='0' && s[3]!='0') || (s[2]=='1' && (s[3]=='0' || s[3]=='1' || s[3]=='2')))
    {
        atoMM=true;
    }
    if(atoMM==true && maeMM==false)
    {
        cout<<"YYMM"<<endl;
    }
    else if(atoMM==false && maeMM==true)
    {
        cout<<"MMYY"<<endl;
    }
    else if(atoMM==true && maeMM==true)
    {
        cout<<"AMBIGUOUS"<<endl;
    }
    else if(atoMM==false && maeMM==false)
    {
        cout<<"NA"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

AB = []
for _ in range(N):
    ai, bi = map(int, input().split())
    AB.append((ai,bi))

AB.sort()

memo = {}
len_arr = 0

for ai, bi in AB:
    len_arr += bi
    memo[len_arr] = ai

len_arr_list = sorted(memo.keys())

for boundary in len_arr_list:
    if K <= boundary:
        print(memo[boundary])
        break


Measured memory_bytes: 29376
W,H,N=map(int,input().split())

ans=[0,W,0,H]

for i in range(N):
    x,y,a=map(int,input().split())
    if a==1:
        if ans[0]<x:
            ans[0]=x
    elif a==2:
        if ans[1]>x:
            ans[1]=x
    elif a==3:
        if ans[2]<y:
            ans[2]=y
    else:
        if ans[3]>y:
            ans[3]=y

S=(ans[1]-ans[0])*(ans[3]-ans[2])  

if (ans[1]-ans[0])<0:
    print(0)
elif (ans[3]-ans[2])<0:
    print(0)
else:
    print(S)


Measured memory_bytes: 9228
#include<bits/stdc++.h>
#define taskname "test1"
#define int long long
#define sz(a) static_cast<int>(a.size())
using namespace std;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);   cout.tie(nullptr);
    if (ifstream("test.inp"))
    {
        freopen("test.inp", "r", stdin);
        #ifdef CHECKING
            freopen(taskname".out", "w", stdout);
        #else
            freopen("test.out", "w", stdout);
        #endif //CHECKING
    }
    else if (ifstream(taskname".inp"))
    {
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }

    int n;  cin >> n;
    int vmin = LLONG_MAX, vmax = LLONG_MIN;
    while (n--)
    {
        int x;  cin >> x;
        vmin = min(vmin, x);
        vmax = max(vmax, x);
    }
    cout << vmax - vmin;
}


Measured memory_bytes: 256
#include<stdio.h>
int s[101],n,k,v,o,i;int main(){for(;scanf("%d%d",&n,&k)&&n&&k;puts(o?"No":"Yes")){for(i=k;i--;scanf("%d",s+i))o=0;for(;n--;)for(i=k;i--;o|=(s[i]-=v)<0)scanf("%d",&v);}}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int N;
vi adj[MX];
ll dp[2][MX];

void solve_dp(int u, int p) {
    dp[0][u] = dp[1][u] = 1;

    trav(v,adj[u]) if (v != p) {
        solve_dp(v,u);
        dp[0][u] = (dp[0][u]*(dp[0][v]+dp[1][v])%MOD)%MOD;
        dp[1][u] = (dp[1][u]*dp[0][v])%MOD;
    }
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> N;

    F0R(i,N-1) {
        int u,v; cin >> u >> v;
        --u,--v;
        adj[u].pb(v); adj[v].pb(u);
    }

    solve_dp(0,-1);

    cout << (dp[0][0]+dp[1][0])%MOD << "\n";
}


Measured memory_bytes: 16000
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#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 fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " << a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("/home/kushagra/Desktop/Kushagra/input.txt", "r", stdin);
	freopen("/home/kushagra/Desktop/Kushagra/output.txt", "w", stdout);
#endif
	ll b, h, hp;
	cin >> b >> h >> hp;
	cout << (b * h) / 2 << endl;
	return 0;
}

Measured memory_bytes: 3632
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def lcm(a,b):
    return int(a*b//gcd(a,b))

def div(x,c,d):
    return x - x//c - x//d + x//lcm(c,d)


a,b,c,d = map(int,input().split())

a = div(a-1,c,d)
b = div(b,c,d)
num = b-a

print(num)


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

int main() {
  ll v,e,r;
  cin >> v >> e >> r;
  vector<map<ll,ll>> E(v);
  for(ll i=0;i<e;i++) {
    ll s,t,d;
    cin >> s >> t >> d;
    E[s][t]=d;
  }
  priority_queue<pll,vector<pll>,greater<pll>> q;
  vector<ll> d(v,-1);
  d[r]=0;
  for(auto p:E[r]) {
    q.push(pll(p.second,p.first));
  }
  while(q.size()) {
    auto p=q.top();
    q.pop();
    ll f=p.second;
    if(d[f]>-1) continue;
    d[f]=p.first;
    for(auto t:E[f]) {
      q.push(pll(d[f]+t.second,t.first));
    }
  }
  for(ll i=0;i<v;i++) {
    if(d[i]<0) {
      cout << "INF" << endl;
    }
    else {
      cout << d[i] << endl;
    }
  }
}


Measured memory_bytes: 42872
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	string S,T,ans;
	cin>>S>>T;
	for(int i=0;i<S.length();i++){
		if(S[i]!=T[i]){cout<<"No";return 0;}
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 3624
n,k,q = map(int,input().split())
a = [int(input()) for _ in range(q)]
point = [0 for _ in range(n)]
for i in range(q):
	point[a[i]-1] += 1
for i in range(n):
	target = k+point[i]-q
	if target <= 0:
		print("No")
	else:
		print("Yes")

Measured memory_bytes: 8628
#include <iostream>
using namespace std;
int main(void){
    double N =1;
    double ans = 0;
    cin >> N;
    if( int (N) % 2 == 0)
   ans = 0.5;
    else
     ans = double (int(N/2.0) + 1)/ N;
     
     cout << ans << endl;
}


Measured memory_bytes: 256
/*C - Attack Survival*/

#include <bits/stdc++.h>

using namespace std;

int main(){
	
	int players;
	int points;
	int less;
	int pos;
	int aux;

	cin >> players >> points >> less;

	vector <int> game(players);

	for (int i = 0; i < less ; ++i)
	{
		cin >> pos;
		pos--;

		game[pos]++;
	}

	for (int i = 0; i < players; ++i)
	{
		game[i] = points - less + game[i] ;
		if(game[i] > 0)
			cout << "Yes\n";
		else
			cout << "No\n";
	}

	return 0;
}

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

int main(){
  string S;
  cin >> S;
  reverse(S.begin(),S.end());
  int s=S.size();
  for(int i=0;i<s;i++){
    if(S.substr(i,5)=="maerd"){i+=4;}
    else if(S.substr(i,7)=="remaerd"){i+=6;}
    else if(S.substr(i,5)=="esare"){i+=4;}
    else if(S.substr(i,6)=="resare"){i+=5;}
    else{cout << "NO" << endl; return 0;}
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
using namespace std;
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
typedef long long ll;
typedef unsigned long long ull;
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDD pair<double,double>
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-6;
const int MAX=2e5+10;
const ll mod=1e9+7;
int dp[MAX];
int main()
{
	int n,i,ans,x;
	while(~scanf("%d",&n))
	{
		ans=0;
		for(i=1;i<=n;i++)
		{
			scanf("%d",&x);
			dp[x]=max(dp[x],dp[x-1]+1);
			ans=max(ans,dp[x]);
		}
		printf("%d\n",n-ans);
	}
	return 0;
} 


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.StringTokenizer;



public class Main {
	public static void main(String[] args) throws IOException {
		InputReader r = new InputReader(System.in);
		OutputStreamWriter out = new OutputStreamWriter(System.out);
		int n = r.nextInt();
		int[] arr = new int[n];
		Arrays.fill(arr, -1);
		out.write("0\n");
		out.flush();
		String response = r.next();
		if(response.equals("Vacant")){
			System.exit(0);
		}else if(response.equals("Male")){
			for (int i = 0; i < arr.length; i++) {
				arr[i] = i%2;
			}
		}else{
			for (int i = 0; i < arr.length; i++) {
				arr[i] = (i+1)%2;
			}
		}
		int low = 0, high = n, itr = 18;
		while(itr-->0){
			int mid = (low+high)/2;
			out.write(mid+"\n");
			out.flush();
			response = r.next();
			if(response.equals("Vacant")){
				System.exit(0);
			}else if(response.equals("Male")){
				if(arr[mid]==0)
					low = mid;
				else
					high = mid;
			}else{
				if(arr[mid]==1)
					low = mid;
				else
					high = mid;
			}
		}
	}

	static class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

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

		public InputReader(FileReader stream) {
			reader = new BufferedReader(stream);
			tokenizer = null;
		}

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		}

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

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

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

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


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

// cl /EHsc xxxx.c
int main(int arc, char *argv[])
{
	int i = 1;
	int x;
	
	while (1)
	{
		scanf("%d", &x);
		if (x == 0)
		{
			break;
		}
		printf("Case %d: %d\n", i, x);
		i++;
	}
	
	return 0;
}

Measured memory_bytes: 600
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

#include<bits/stdc++.h>
using namespace std;

#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

int32_t main(){
	NINJA;

	string s; cin >> s;
	int n = sz(s);

	if(n%2==0){
		int l=0,r=n-1;

		int cnt = 0;
		while(l<r){
			if(s[l]==s[r]) cnt+=0;
			else cnt++;
			l++,r--;
		}
		cout << cnt << endl;
	}else{
		int l=0,r=n-1;

		int cnt = 0;
		while(l<=r){
			if(s[l]==s[r]) cnt+=0;
			else cnt++;
			l++,r--;
		}
		cout << cnt << endl;
	}
	
	return 0;
}

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

int main() {
    int n; cin >> n;
    int a;
    vector<pair<int, int>> A;
    for (int i = 1; i <= n; i++) {
        cin >> a;
        A.push_back(make_pair(a, i));
    }

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

    cout << A[0].second;
    for (int i = 1; i < n; i++) cout << ' ' << A[i].second;
    cout << endl;

    return 0;
}


Measured memory_bytes: 1780
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>
#include<limits>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

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

   VI a(n);
   rep(i,n) cin>>a[i];

   sort(all(a));
   cout<<a[a.size()/2]-a[a.size()/2 -1]<<endl;
   

}


Measured memory_bytes: 640