akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
#include<math.h>
#define Limit 100
#define Size 16
int mdt[Size][Size], space, score, edge;
int swap_upper(int*, int*, int);
int swap_lower(int*, int*, int);
int swap_left(int*, int*, int);
int swap_right(int*, int*, int);
int Dfs(int*, int*, int, int, int);
int main(void)
{
  int i, j, init[Size], goal[Size];
  edge = sqrt(Size);
  for (i = 0; i < Size; i++) {
    for (j = 0; j < Size; j++) {
      mdt[i][j] = fabs(i / edge - j / edge) + fabs(i % edge - j % edge);
    }
  }
  for (i = 0; i < Size; i++) {
    scanf("%d", &init[i]);
    if (!init[i]) space = i;
    else score += mdt[i][init[i]-1];
    goal[i] = (i + 1) % Size;
  }
  for (i = score; i < Limit; i++) {
    if (Dfs(init, goal, 0, -1, i)) {
      printf("%d\n", i);
      break;
    }
  }
}
int swap_upper(int *board, int *next, int prev)
{
  int i;
  if (!(space / edge) || prev == 1) return 0;
  else {
    memcpy(next, board, sizeof(int) * Size);
    next[space] = board[space - edge];
    next[space - edge] = board[space];
    score += mdt[space][next[space] - 1] - mdt[space - edge][next[space] - 1];
    space -= edge;
  }
  return 1;
}
int swap_lower(int *board, int *next, int prev)
{
  int i;
  if ((space / edge) == edge - 1 || prev == 0) return 0;
  else {
    memcpy(next, board, sizeof(int) * Size);
    next[space] = board[space + edge];
    next[space + edge] = board[space];
    score +=  mdt[space][next[space] - 1] - mdt[space + edge][next[space] - 1];
    space += edge;
  }
  return 1;
}
int swap_left(int *board, int *next, int prev)
{
  int i;
  if (!(space % edge) || prev == 3) return 0;
  else {
    memcpy(next, board, sizeof(int) * Size);
    next[space] = board[space - 1];
    next[space - 1] = board[space];
    score +=  mdt[space][next[space] - 1] - mdt[space - 1][next[space] - 1];
    space--;
  }
  return 1;
}
int swap_right(int *board, int *next, int prev)
{
  int i;
  if ((space % edge) == edge - 1 || prev == 2) return 0;
  else {
    memcpy(next, board, sizeof(int) * Size);
    next[space] = board[space + 1];
    next[space + 1] = board[space];
    score +=  mdt[space][next[space] - 1] - mdt[space + 1][next[space] - 1];
    space++;
  }
  return 1;
}
int Dfs(int *board, int *goal, int depth, int prev, int limit)
{
  int next[Size], prespace = space, prescore = score;
  if (!score) return 1;
  else if (depth + score > limit) return 0;
  if (swap_upper(board, next, prev)) {
    if (Dfs(next, goal, depth + 1, 0, limit)) return 1;
  }
  space = prespace;
  score = prescore;
  if (swap_lower(board, next, prev)) {
    if (Dfs(next, goal, depth + 1, 1, limit)) return 1;
  }
  space = prespace;
  score = prescore;
  if (swap_left(board, next, prev)) {
    if (Dfs(next, goal, depth + 1, 2, limit)) return 1;
  }
  space = prespace;
  score = prescore;
  if (swap_right(board, next, prev)) {
    if (Dfs(next, goal, depth + 1, 3, limit)) return 1;
  }
  space = prespace;
  score = prescore;
  return 0;
}



Measured memory_bytes: 2132
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <list>
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
using namespace std;
typedef pair<int,int> P;
int main(void){
    double n,m;
    cin>>n>>m;
    double  ans=0;
    double r=pow(0.5,m);
    for(double i=1;i<=1000000;i++){
        ans+=i*((1900*m)+(n-m)*100)*pow(1-r,i-1)*r;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
$n = gets.chomp
def func(i, sum)
  return sum if i === 1<<($n.length - 1)
  tmp = ""
  ($n.length - 1).times do |ii|
    if i&(1<<ii) >= 1
      tmp += $n[ii] + "+" 
    else
      tmp += $n[ii]
    end
  end
  tmp += $n[-1]
  s = tmp.split("+")
  ret = 0
  s.each do |ss|
    ret += ss.to_i
  end
  return func(i + 1, sum + ret)
end
p func(0, 0)


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

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
// #define int long long

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

void solve(int N, vector<int>& A) {
    int numOfMinus = 0;
    int minAbs = INT_MAX;
    long long sum = 0;
    for (const auto a : A) {
        if (a < 0) numOfMinus++;
        if (minAbs > abs(a)) minAbs = abs(a);
        sum += abs(a);
    }

    stringstream ss;
    ss << (numOfMinus % 2 == 0 ? sum : sum - 2 * minAbs);
    cout << ss.str() << '\n';

    return;
}

signed main() {
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i,0,N) cin >> A[i];

    solve(N, A);

    return 0;
}



Measured memory_bytes: 640
#include <cstdio>
int main (){
	int N, T, small = -1, ans = 0;
	int A[100000], low[100000], high[100000];
	scanf("%d %d", &N, &T);
	for (int i = 0; i < N; i++)
		scanf("%d", &A[i]);
	low[0] = A[0];
	for (int i = 1; i < N; i++)
		low[i] = (low[i - 1] < A[i]) ? low[i - 1] : A[i];
	high[N - 1] = A[N - 1];
	for (int i = N - 2; i >= 0; i--)
		high[i] = (high[i + 1] > A[i]) ? high[i + 1] : A[i];
	for (int i = 0; i < N; i++){
		if (small < high[i] - low[i]){
			small = high[i] - low[i];
			ans = 1;
		} else if (small == high[i] - low[i]){
			if (i == 0)
				ans++;
			else if (low[i] != low[i - 1])
				ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <stdio.h>
using namespace std;
typedef long long ll;

int main() {
	int n, a, b,ans;
	cin >> n >> a >> b;
	if (a*n > b) {
		ans = b;
	}
	else {
		ans = a * n;
	}
	cout << ans << endl; 
}


Measured memory_bytes: 256
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

Vec2<ll> dist;

void WarshallFloyd(ll V){
	rep(k, V) rep(i, V) rep(j, V) chmin(dist[i][j], dist[i][k]+dist[k][j]);
}

int main(void){
	ll n, m, r;
	cin >> n >> m >> r;
	dist.resize(n);
	rep(i, n) dist[i].assign(n, LINF);
	rep(i, n) dist[i][i] = 0;
	Vec rr(r);
	rep(i, r) cin >> rr[i];
	rep(i, r) rr[i]--;
	sort(all(rr));
	rep(i, m){
		ll a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		dist[a][b] = c;
		dist[b][a] = c;
	}

	WarshallFloyd(n);

	ll ans = LINF;
	do{
		ll sum = 0;
		rep(i, r-1) sum += dist[rr[i]][rr[i+1]];
		chmin(ans, sum);
	}while(next_permutation(all(rr)));
	co(ans);

	return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)

using namespace std;


int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    int i,j,k,p=1,q=1;
    long n,m,tmp;
    ll sum=0;
    int a[10000];
    string s[200000];
    string str;
    int strr[200005];
    cin >> n;
    rep(i,n) cin>>a[i];
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            sum+=a[i]*a[j];
        }
    }

    std::cout<< sum << endl;
    //outputfile<<str;
   // outputfile.close();

    return 0;
}

Measured memory_bytes: 1792
using System;class P{static void Main(string[] args){bool a=false;int b,c,d,e;int[] f,g=new int[4],h=new int[4],i=new int[]{10,50,100,500};while(true){b=int.Parse(Console.ReadLine());if(b==0){break;}if(!a){a=!a;}else{Console.WriteLine();}c=0;f=Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);for(e=3;e>=0;e--){c+=f[e]*i[e];}d=c-b;for(e=3;e>=0;e--){g[e]=d/i[e];d-=g[e]*i[e];h[e]=f[e]-g[e];}for(e=0;e<4;e++){if(h[e]>0){Console.WriteLine("{0} {1}",i[e],h[e]);}}}}}


Measured memory_bytes: 9344
#include<iostream>
#include<algorithm>
typedef long long lint;
using namespace std;

int main()
{
	int N;
	lint T,A;
	lint t,a;
	lint tmp;
	lint ans[2]{};
	
	cin >> N;
	for(int i=0;i<N;i++)
	{
		cin >> T >> A;
		t=T;
		a=A;
		tmp=max(ans[0]/T,ans[1]/A);
		if(tmp!=0)
		{
			T=T*tmp;
			A=A*tmp;
		}
		while(true)
		{
			if(T>=ans[0] && A>=ans[1])
			{
				ans[0]=T;
				ans[1]=A;
				break;
			}
			T+=t;
			A+=a;
		}
	}
	cout << ans[0]+ans[1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<math.h>
#include<algorithm>
#include<fstream>
using namespace std;
#define ll long long
#define endl '\n'
const int max_n = 2*1e5 + 3;
const ll INF = 1e12+1;


ll N;
int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> N;

	//N
	vector<ll>res;
	for (int j = 1; (long long)j*j*1LL <= N; j++)
	{
		if (N % j == 0)
			res.push_back(j + N / j);
	}
	ll minval = INF;
	for (int i = 0; i < res.size(); i++)
		minval = min(minval, res[i]);
	
	cout << minval - 2;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int N, R;
  cin >> N;
  vector<int> X(N);
  for (int i=0; i<N; i++) {
    cin >> X[i];
  }
  sort(X.begin(),X.end());
  R=X[N-1]-X[0]+1;
  vector<int> P(R);
  for (int i=0; i<R; i++) {
    P[i]=0;
    for (int j=0; j<N; j++) {
      P[i]=P[i]+(X[j]-(X[0]+i))*(X[j]-(X[0]+i));
    }
  }
  sort(P.begin(),P.end());
  cout << P[0] << endl;
}

Measured memory_bytes: 3604
#include<stdio.h>
int main()
{
  int a;
  // 整数の入力
  scanf("%d", &a);
  // 出力
  if(a <= 3 || a == 5 || a == 6 || a == 9 || a == 10 || a == 13 || a == 17){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}




Measured memory_bytes: 128
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	
	int A,B;
	cin>>A>>B;
	
	if(B%A==0)
		cout<<A+B<<endl;
	else 
		cout<<B-A<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

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

void solve_A(){
    int n;
    cin >> n;
    int i = 1;
    while(1){
        if(i * 1000 >= n){
            break;
        }
        i ++;
    }

    cout << i *1000 - n<< endl;
}

void solve_B(){
    int n;
    cin >> n;
    string s[n];
    map<string, int> mp;
    REP(i,n){
        cin >> s[i];
        mp[s[i]]++;
    }

    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;

}

void solve_C(){
    int h, w, k;
    cin >> h >> w >> k;
    char cc[h][w], c[h][w];
    REP(i,h){
        REP(j,w){
            cin >> cc[i][j];
            c[i][j] = cc[i][j];
        }
    }

    int ans = 0;
    //white: . , black: # , red: ^
    for(int bith = 0; bith < (1 << h); bith++){
        for(int bitw = 0; bitw < (1 << w); bitw++){
            for(int i = 0; i < h; i++){
                if(bith & (1 << i)){
                    REP(a,w){
                    c[i][a] = '^';
                    }
                }
            }
            for(int j = 0; j < w; j++){
                if(bitw & (1 << j)){
                    REP(b,h) c[b][j] = '$';
                }
            }

            int black_sub = 0;
            REP(i,h){
                REP(j,w){
                    if(c[i][j] == '#') black_sub++;
                }
            }
            if(black_sub == k) ans++;

            REP(i,h){
                REP(j,w) c[i][j] = cc[i][j];
            }
        }
    }

    cout << ans << endl;
}

int main(void){
    solve_C();
    
    return 0;
}

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

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int N;
	static double[] x, y, r;

	public static void main(String[] args) {
		int t = 1;
		while (true) {
			N = sc.nextInt();
			if (N == 0) break;
			x = new double[N];
			y = new double[N];
			r = new double[N];
			for (int i = 0; i < N; ++i) {
				x[i] = sc.nextDouble();
				y[i] = sc.nextDouble();
				r[i] = sc.nextDouble();
			}
			System.out.printf("%d %.2f\n", t, solve());
			++t;
		}
	}

	static double solve() {
		double[] xs = new double[N * 2];
		double[] ys = new double[N * 2];
		for (int i = 0; i < N; ++i) {
			xs[2 * i] = x[i] - r[i];
			xs[2 * i + 1] = x[i] + r[i];
			ys[2 * i] = y[i] - r[i];
			ys[2 * i + 1] = y[i] + r[i];
		}
		Arrays.sort(xs);
		Arrays.sort(ys);
		boolean[][] covered = new boolean[2 * N][2 * N];
		for (int i = 0; i < N; ++i) {
			int x1 = Arrays.binarySearch(xs, x[i] - r[i]);
			int x2 = Arrays.binarySearch(xs, x[i] + r[i]);
			int y1 = Arrays.binarySearch(ys, y[i] - r[i]);
			int y2 = Arrays.binarySearch(ys, y[i] + r[i]);
			for (int j = x1; j < x2; ++j) {
				for (int k = y1; k < y2; ++k) {
					covered[j][k] = true;
				}
			}
		}
		double ans = 0;
		for (int i = 0; i < 2 * N; ++i) {
			for (int j = 0; j < 2 * N; ++j) {
				if (covered[i][j]) {
					ans += (xs[i + 1] - xs[i]) * (ys[j + 1] - ys[j]);
				}
			}
		}
		return ans;
	}
}

Measured memory_bytes: 13000
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  long h[n];
  int i;
  for(i=0;i<n;i++){
    cin >> h[i];
  }

  sort(h,h+n);

  long min = 9999999999;
  for(i=0;i<n-k+1;i++){
    if(min > h[i+k-1]-h[i]) min = h[i+k-1]-h[i];
  }
  cout << min;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 2345;
const int INF = 6789;
struct node {
    int a, b, x;
    node(int _a, int _b, int _x) {
        a = _a;
        b = _b;
        x = _x;
    }
};

int dp[MAXN][MAXN];
vector<node> tmp_dp;
int max_dp[MAXN];
int A[3 * MAXN];

void update(int a, int b, int c, int N, int bst) {
    //take 2
    tmp_dp.push_back(node(a, b, dp[c][c] + 1));
    tmp_dp.push_back(node(a, b, bst));
    //take 1
    for (int i = 1; i <= N; i++) {
        if (b == c)
            tmp_dp.push_back(node(i, a, dp[b][i] + 1));
        // replace x in (i, x) with a, x is random variable
        tmp_dp.push_back(node(i, a, max_dp[i]));
    }
}

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 0; i < 3 * N; i++)
        scanf("%d", &A[i]);
    for (int i = 1; i <= N; i++) {
        max_dp[i] = -INF;
        for (int j = 1; j <= N; j++)
            dp[i][j] = -INF;
    }
    dp[A[1]][A[0]] = dp[A[0]][A[1]] = 0;
    max_dp[A[1]] = max_dp[A[0]] = 0;
    int ans = 0, offs = 0, bst = 0;
    for (int i = 0; i < N - 1; i++) {
        int a = A[3 * i + 2], b = A[3 * i + 3], c = A[3 * i + 4];
        if (a == b && b == c) {
            offs++;
            continue;
        }
        tmp_dp.clear();
        assert(tmp_dp.empty());
        update(a, b, c, N, bst);
        update(b, c, a, N, bst);
        update(c, a, b, N, bst);
        for (auto i : tmp_dp) {
            int x = i.a, y = i.b, z = i.x;
            dp[x][y] = dp[y][x] = max(dp[x][y], z);
            max_dp[x] = max(max_dp[x], z);
            max_dp[y] = max(max_dp[y], z);
            bst = max(bst, z);
        }
    }

    for (int i = 1; i <= N; i++)
        for (int j = 1; j <= N; j++)
            ans = max(ans, dp[i][j]);
    printf("%d\n", max(ans, dp[A[3 * N - 1]][A[3 * N - 1]] + 1) + offs);
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
by Benq;
*/


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int a , b , c , d , e , k;

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


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a,b,c,i;
  cin >> i; 
  for(int n = 0;n < i;n++){
    cin >> a >> b >> c;
    if(a*a == b * b + c * c){
      cout << "YES" << endl;
    } else if(b*b == a * a + c * c){
      cout << "YES" << endl;
    } else if(c*c == b * b + a * a){
      cout << "YES" << endl;
    } else {cout <<"NO" << endl;} 
  }
}

Measured memory_bytes: 3032
#include<bits/stdc++.h>
#include<iostream>
#define ll long long
#define pb push_back
#define mp make_pair
#define pi 3.1415926535897
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define sz(v) ((int)(v).size())
#define mod 1000000007
#define MXM (ll)1e18
#define db(x) cout<<x<<" "
#define db1(x) cout<<x<<'\n'
#define db2(x,y) cout<<x<<" "<<y<<'\n'
#define db3(x,y,z) cout<<x<<" "<<y<<" "<<z<<'\n'
#define REP(i,a,n) for(ll i=a;i<(n);i++)
#define RREPA(i,a,n) for(ll i=a;i>=(n);i--)
#define REPA(i,a,n) for(ll i=a;i<=(n);i++)
using namespace std;
 
 
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
//////
// prime Seive
/*
bitset<1000005> bt;
//unordered_map<ll,bool> is_prime;
vector<ll> primes;
void pS(ll n){
    ll val = min(n+1,(ll)1000006);
    for(ll i=3;i<=val;i+=2){
        bt[i] =true;
    }
    bt[0] =false;
    bt[1] =false;
    bt[2] =false;
    //is_prime[2] =true;
    primes.pb((ll)2);
    for(ll i=3;i<=val;i+=2){
        if(bt[i])
            for(ll j=i*i;j<=val;j+=2*i)
                bt[j] =false;
    }
    for(ll i=3;i<=val;i+=2){
        if(bt[i]){primes.pb(i);
        //is_prime[i]=true;
        //cout<<i<<" :PRIME\n";
        }
    }
    return;
}
   */          
/////
// Fenwick Tree
/*
BIT[200005] ={0};
//BUILD BIT
// for(int i=1;i<1;i++){ cin>>a[i];update(i,a[i],n);};
 
void update(int i,int val,int n){
    while(i<=n){
    BIT[i]+= inc;
    i+= (i&(-i));
    }
}
ll query(int i){
    ll ans =0;
    while(i>0){
        ans+= BIT[i];
        i-=(i&(-i));
    }
    return ans;
}
 
*/
//__builtin_popcount(4)
ll logPow(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1){
            ans*=a;
        }
        a*=a;
        b= b>>1;
    }
    return ans;
}



int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    */
    int t=1;
    
    //memset(arr,0,sizeof(arr));
    //cin>>t;
    //pS(INT_MAX);
    while(t--){
      ll n;
      string m;
      cin>>n>>m;
      //m*=100;
      ll m_int = m[0]-'0';
      ll m_fract = (m[2]-'0')*10+(m[3]-'0');
      ll ans = n*m_int;
      ll fract_add = n*m_fract;
      fract_add/=100;
      ans += fract_add;
      //cout<<n<<":abcd";
      //cout<<m<<":efgh\n";
      //cout<<m_int<<" "<<m_fract<<"\n";
      cout<<ans<<"\n";
      //cout<<(ll)(n*m)/100<<"\n";
    }
    return 0;
}

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

int main()
{
  char c;
  cin >> c;

  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' )
  {
    cout << "vowel" << endl;
  }

  else
  {
    cout << "consonant" << endl;
  }
}


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

main(){
  int tcase; cin >> tcase;
  char ch; 
  double h, m, diff;
  for ( int i = 0; i < tcase; i++ ){
    cin >> h >> ch >> m;
    h = 30.0*h + m/2.0;
    m = 6.0*m;
    diff = max(h, m) - min(h, m);
    diff = min(diff, 360-diff);
    if ( 0 <= diff && diff < 30 ) cout << "alert" << endl;
    else if ( 90 <= diff && diff <= 180 ) cout << "safe" << endl;
    else cout << "warning" << endl;
  }
}

Measured memory_bytes: 0
import java.util.Scanner;
class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int H,W;
        while(true){
            H=sc.nextInt();
            W=sc.nextInt();
            if(H==0&&W==0)break;
            for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 34984
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;

void merge(vector<int>& A, int left, int mid, int right, int&counter) {
  int n1 = mid - left;
  int n2 = right - mid;
  vector<int> L(n1 + 1);
  vector<int> R(n2 + 1);
  for (int i = 0; i < n1; i++) {
    L[i] = A[left + i];
  }
  L[n1] = inf;
  for (int i = 0; i < n2; i++) {
    R[i] = A[mid + i];
  }
  R[n2] = inf;
  int i = 0;
  int j = 0;
  for (int k = left; k < right; k++) {
    counter++;
    if (L[i] <= R[j]) {
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
    }
  }
};

void mergeSort(vector<int>& A, int left, int right, int& counter) {
  if (right - left > 1) {
    int mid = (left + right) / 2;
    mergeSort(A, left, mid, counter);
    mergeSort(A, mid, right, counter);
    merge(A, left, mid, right, counter);
  }
}

int main() {
  int n;
  cin >> n;
  int counter = 0;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  mergeSort(A, 0, n, counter);
  for (int i = 0; i < n; i++) {
    if (i < n - 1) {
      cout << A[i] << ' ';
    } else {
      cout << A[i] << endl;
    }
  }
  cout << counter << endl;
};



Measured memory_bytes: 6748
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }



signed main(){

    string S; cin >> S;
    map<char, bool> m;
    REP(i, S.size()) m[S[i]] = true;
    if((m['N'] ^ m['S']) || (m['W'] ^ m['E'])) cout << "No";
    else cout << "Yes";
    
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby
# require 'pry'

# dpテンプレ
# 最小化
# dp = Hash.new{ Float::INFINITY }
# dp[i] = [dp[i], dp[i-1] + hoge].min
# dp[0] = 0
# 最大化
# dp = Hash.new{ 0 }
# dp[i] = [dp[i], dp[i-1] + hoge].max
# dp[0] = 0

x,n = gets.split(' ').map(&:to_i)
P = gets.split(' ').map(&:to_i)
if n == 0
  puts x
  exit
end

0.upto(100) do |num|
  a = x-num
  b = x+num
  if P.include?(a) && P.include?(b)
    next
  elsif P.include?(a)
    puts b
    exit
  else
    puts a
    exit
  end
end


Measured memory_bytes: 14368
n,y = [int(e) for e in input().split()]
for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i,j,n-i-j)
            break
    else:
        continue
    break
else:
    print("-1 -1 -1")

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

int main () {
  string S;
  cin >> S;
  int N = S.size();
  vector<int> a(N);
  for(int i=0; i<N; i++){
    a.at(i) = (int)(S.at(i) - '0');
  }
  int64_t sum = 0;
  for (int tmp = 0; tmp < (1 << (N-1)); tmp++) {
    bitset<9> s(tmp);
    int64_t num = a[0];
    for (int i = 0; i < N-1; i++) {
      if (s.test(i)) {
        sum += num;
        num = 0;
      }
      num = num*10 + a.at(i+1);
    }
    sum += num;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int n, K;
vi V;

int solve(int i, int k){
    int ret = 0;
    vi vec;
    rep(j, i, i + k){
        ret += V[j];
        vec.emplace_back(V[j]);
    }
    sort(_all(vec));
    rep(i, min(k, K - k)){
        if(vec[i] < 0) ret -= vec[i];
    }
    return ret;
}

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

    cin >> n >> K;
    V = vi(n); for(auto& e : V) cin >> e;
    rep(i, n){
        V.emplace_back(V[i]);
    }

    int res = 0;
    rep(k, 1, min(n + 1, K + 1)){
        rep(i, n - k, n + 1){
            chmax(res, solve(i, k));
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
X = [0] * (M)
Y = [0] * (M)

started = False
contains_red = set([1])
ans = 1

nums = [1] * (N + 1)

for _ in range(M):
    x, y = map(int, input().split())
    X[_] = x
    Y[_] = y

for _ in range(M):
    nums[X[_]] -= 1
    nums[Y[_]] += 1

    if X[_] in contains_red:
        contains_red.add(Y[_])

    if nums[X[_]] == 0 and X[_] in contains_red:
        contains_red.remove(X[_])

# print(contains_red)
print(len(contains_red))


Measured memory_bytes: 17900
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#include<deque>
#define rep(i,rept)	for(int i = 0; i<(int)rept;++i)
typedef long long ll;
using namespace std;

int main() {
	//12日目-1

	cin.tie(0); ios::sync_with_stdio(false);

	int n = 0, x = 0, a[100000] = {};
	ll ans = 0;
	cin >> n >> x;
	rep(i, n) {
		cin >> a[i];
		if (a[i] > x) {
			ans += a[i] - x;
			a[i] = x;
		}
	}
	for (int i = 0; i + 1 < n; i++) {
		if (a[i] + a[i + 1] > x) {
			ans += (a[i + 1] + a[i]) - x;
			a[i + 1] -= (a[i] + a[i + 1]) - x;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN
#define INF         100000000000000000
#define PI          3.1415926535897932384626433832795l



#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"


// ll mod = 1000000007;
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)






// struct mycomp {
//     bool operator() (const pair<int,int> &a, const pair<int,int> &b) const{
//         if (a.second-a.first != b.second-b.first)
//         return (a.second-a.first > b.second-b.first);
//         return a.first < b.first;
//     }
// };



/////////////////////GCD//////////////////////
ll gcd(ll a, ll b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}


ll extended_gcd(ll a, ll b, ll& x, ll& y)
{
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll x1, y1;
	ll d = extended_gcd(b, a%b, x1, y1);
	x=y1;
	y=x1-y1*(a/b);
	return d;
}

////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}	
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

////////////////////BINARY EXPONENTIATION///////////////////////
ll bin_exp(ll a, ll b, ll mod)
{
	ll ans = 1;
	while(b)
	{
		if(b%2)
		{
			b--;
			ans = (ans%mod*a%mod)%mod;
		}
		b/=2;
		a = (a%mod*a%mod)%mod;
	}
	return ans;
}


///////////////////////////BFS//////////////////////////////////
void bfs(vector<int>& distance, vector<int> a[], vector<bool>& visited, int u, vector<int>& parent)
{
	visited[u]=true;
	parent[u]=-1;
	distance[u]=0;
	queue<int> q;

	q.push(u); 
    while (!q.empty()) { 
  
        int f = q.front(); 
        q.pop(); 
  		for(int i =0; i < a[f].size(); i++)
  		{
  			if(visited[a[f][i]]==false)
  			{
  				distance[a[f][i]]=distance[f]+1;
  				parent[a[f][i]]=f;
  				visited[a[f][i]]=true;
  				q.push(a[f][i]);
  			}
  		}
    } 

}

void solve()
{

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

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	int n, m;
	char a;
	cin>>n>>a>>m;
	if(a=='+') p(n+m);
	else p(n-m);
	return 0;
}	

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int A1,A2,A3,s;
    scanf("%d %d %d",&A1,&A2,&A3);
    s=A1+A2+A3;
    if(s>=22)
    {
        printf("bust\n");
    }
    else
    {
        printf("win\n");
    }

    return 0;
}


Measured memory_bytes: 1644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)
const ll mod = 1e9 + 7;
const int N = 1e5 + 7;


ll mul(ll a, ll b) {
	return (a*b)%mod;
}
vector<int> conn[N];
int parent[N];
bool vis[N];
int coloring[N];

void bfs(int root) {
	memset(vis, 0, sizeof vis);
	queue<int> q;
	q.push(root);
	parent[root] = -1;
	vis[root] = 1;
	while(q.size()) {
		int node = q.front();
		q.pop();
		for (auto i : conn[node]) {
			if (vis[i])
				continue;
			q.push(i);
			parent[i] = node;
			vis[i] = 1;
		}
	}
}

void color(int root, int k) {
	memset(vis, 0, sizeof vis);
	queue<int> q;
	q.push(root);
	coloring[root] = k;
	vis[root] = 1;
	while(q.size()) {
		int node = q.front();
		q.pop();
		int siblings = 0;
		bool pp = parent[node] != -1;
		for (auto i : conn[node]) {
			if (vis[i])
				continue;

			q.push(i);
			coloring[i] = k - (siblings+1+pp);
			siblings++;
			vis[i] = 1;
		}
	}
}


int main() {
	fastIO;
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n-1; i++) {
		int u, v;
		cin >> u >> v;
		conn[u].push_back(v);
		conn[v].push_back(u);
	}
	bfs(1);
	memset(coloring, -1, sizeof coloring);
	color(1, k);
	ll ans = 1;
	for (int i = 1; i <= n; i++) {
		ans = mul(ans, coloring[i]);
	}
	cout << ans;
}


Measured memory_bytes: 7416
# include <bits/stdc++.h>
  typedef long long ll;
#define pii  pair<int,int>
#define vpii vector<pii>
#define vll  vector<ll>
#define vi  vector<int>
#define pb push_back
#define f  first
#define s  second
#define all v.begin(),v.end()
#define fio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
typedef unsigned long long ulll;
 
using namespace std ;
int main () {

 string s;
 cin>>s;
 
 s[3] = '8';
 
 cout<<s;
   
  return 0;
}

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

using ll = long long;
using P = pair<int, int>;
using PP = pair<int, P>;
#define rep1(i,n) for (int i=1; i<=n; i++)
#define rep0(i,n) for (int i=0; i<n; i++)
#define chmin(a,b) if ((a)>(b)) { a=(b); }
#define chmax(a,b) if ((a)<(b)) { a=(b); }
#ifdef _DEBUG
string _format(string args) { string r = "", t; istringstream s(args); while (getline(s, t, ',')) r += t+":%d "; return r + "\n"; }
#define debug(...) printf(_format(#__VA_ARGS__).c_str(), __VA_ARGS__);
#else
#define debug(...) 
#endif

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

    ll n, m, k;
    cin >> n >> m >> k;
    ll A[n+1], SA[n+1];
    ll B[m+1], SB[n+1];
    SA[0] = 0; SB[0] = 0; A[0] = 0; B[0] = 0;
    rep1(i,n) { cin >> A[i]; SA[i]=SA[i-1]+A[i]; debug(A[i],SA[i]);}
    rep1(i,m) { cin >> B[i]; SB[i]=SB[i-1]+B[i]; debug(B[i],SB[i]);}

    int ib = m;
    int ans = 0;
    rep0(i,n+1) {
        if (k < A[i]) break;
        k -= A[i];
        while(SB[ib] > k && ib > 0) ib--;
        debug(i, k, ib, SB[ib], B[ib], ans);
        chmax(ans, i+ib);
    }
    cout << ans << endl;
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(2e2 + 5);

int n;

vector<vector<int>> graph(MAX_N);

vector<int> paint(MAX_N);

ll path[MAX_N][MAX_N];

// color: -1, 0, 1
bool coloring(int node, int color) {
  if (paint[node] == 0) {  // not painted
    paint[node] = color;
    for (auto &next : graph[node]) {
      if (!coloring(next, color * -1)) {
        return false;
      }
    }
  } else {  // already painted
    return paint[node] == color;
  }

  return true;
}

bool check() {
  // initialize
  for (int i = 1; i <= n; ++i) paint[i] = 0;  // no coloar at first

  return coloring(1, 1);
}

ll calc() {
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        if (path[i][j] > path[i][k] + path[k][j]) {
          path[i][j] = path[i][k] + path[k][j];
        }
      }
    }
  }

  ll ret = -1LL;

  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (path[i][j] == INF) continue;
      ret = max(ret, path[i][j]);
    }
  }

  return ret;
}

int main(void) {
  // Here your code !
  scanf("%d", &n);

  // prepare graph
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      path[i][j] = INF;
    }
  }

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

  // make graph
  for (int i = 0; i < n; ++i) {
    string tmp;
    cin >> tmp;

    for (int j = 0; j < n; ++j) {
      if (tmp[j] == '0') continue;
      graph[i + 1].push_back(j + 1);
      path[i + 1][j + 1] = 1LL;
    }
  }

  if (!check()) {
    printf("%d\n", -1);
    return 0;
  }

  ll ans = calc() + 1LL;

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 768
toInt :: (String -> Int)
toInt x = read x :: Int

getInts = do
    x <- getLine
    let y = (map$toInt)$words x
    return y

main = do
    x <- getInts
    let n = x !! 0 :: Int
    let d = x !! 1 :: Int
    let scope = 2 * d + 1 :: Int

    if (n `mod` scope /= 0)
        then print ((n `div` scope) + 1)
        else print (n `div` scope)

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
int a,b;
int main() 
{
	cin>>a>>b;
	if(a>=13)
		cout<<b<<endl;
	else if(a>=6&&a<=12)
		cout<<(int)b/2<<endl;
	else
		cout<<"0"<<endl;
	// your code goes here
	return 0;
}

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H, W = MAP()

if H%3==0 or W%3==0:
    print(0)
    exit()

def calc(h1, h2, W):
    # 3つの領域の面積abc
    a = h1 * W
    b = h2 * (W//2)
    c = h2 * ceil(W, 2)
    return max(abs(a-b), abs(b-c), abs(c-a))

ans = INF
# 2つと1つに区切るなら、/3切り捨てか切り上げが最適のはず
h1 = H // 3
h2 = H - h1
ans = min(ans, calc(h1, h2, W))
h1 = ceil(H, 3)
h2 = H - h1
ans = min(ans, calc(h1, h2, W))

# 縦横逆もやる
H, W = W, H
h1 = H // 3
h2 = H - h1
ans = min(ans, calc(h1, h2, W))
h1 = ceil(H, 3)
h2 = H - h1
ans = min(ans, calc(h1, h2, W))

# 3つ1方向に並べるパターン
ans = min(ans, abs(ceil(W, 3)*H-W//3*H))
ans = min(ans, abs(ceil(H, 3)*W-H//3*W))

print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> h(3);
  cin >> h[0] >> h[1] >> h[2];
  sort(h.begin(),h.end());
  if(h[0]==5 && h[1]==5 && h[2]==7){
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 500010
using namespace std;
char s[maxn];
int a[maxn], dp[maxn];
int main() {
    int n;
    scanf("%d%s", &n, s+1);
    for (int i = 1; i <= n; ++i) {
        if (s[i] == '0') a[i] = i;
        else a[i] = a[i-1];
    }
    for (int i = 1; i <= n; ++i) {
        dp[i] = dp[i-1];
        if (s[i] == '1') {
            if (s[i-1] == '0' && s[i-2] == '1') {
                dp[i] = max(dp[i], dp[a[i-2]]+ (i-2) - a[i-2]);
                dp[i] = max(dp[i], dp[a[i-2]+1] + (i-2) - (a[i-2]+1));
            }
            else if (a[i]>1 && s[a[i]-1] == '1') dp[i] = max(dp[i], dp[a[i]-2] + i - a[i]);
        }
    }
    printf("%d\n", dp[n]);
    return 0;
}

Measured memory_bytes: 4736
#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 oset tree < int ,  null_type ,  less ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define endl '\n'
#define int long long int
#define db long double
#define str string
#define mod 1000000007
#define ff first
#define ss second
#define PQi priority_queue<int>
#define Vi vector<int>
#define Si set<int>
#define Li list<int>
#define mk make_pair
#define pii pair<int,int>
#define all(x) (x.begin(),x.end())
#define pb(x) push_back(x)
#define For(i,n,s) for(int i=s;i<n;i++)
#define mat2D(T,r,c) vector<vector<int> > T(r,vector<int>(c))
#define vec2D vector<vector<int> >
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define getVal(x) {int val;cin>>val;x.pb(val);}
#define debug(x) {for(auto i :x) cout << i << " ";cout << endl;}

void solve() {
    int x;
    cin >> x;
    int ans = 0, i = 1 ;
    while (x > 0) {
        x -= i;
        i++;
        ans++;
    }
    cout << ans;
}

int32_t main() {
    fastIO;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
# endif
    solve();
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll N=2e5+5;
ll n,T,ans,b[N],tot1,tot2;
struct node
{
	ll x,y;
}a[N];
bool mycmp(node x,node y)
{
	return y.x*(x.y+1)<x.x*(y.y+1);
}
ll f[N];
int main()
{
	scanf("%lld%lld",&n,&T);
	for(ll i=1;i<=n;i++)
	{
		ll x,y;
		scanf("%lld%lld",&x,&y);
		if(x==0) b[tot2++]=y+1;
		else
		{
			a[tot1].x=x;
			a[tot1].y=y;
			tot1++;
		}
	}
	sort(a,a+tot1,mycmp);
	sort(b,b+tot2);
	for(int i=1;i<=30;i++) f[i]=T+1;
	f[0]=0;
	for(ll i=0;i<tot1;i++)
		for(ll j=30;j>=1;j--)
			f[j]=min(f[j],(f[j-1]+1)*(a[i].x+1)+a[i].y);
	for(ll i=1;i<tot2;i++) b[i]+=b[i-1];
	for(ll i=0;i<=30;i++)
	{
		if(f[i]>T) continue;
		ll x=0;
		if(tot2) x=upper_bound(b,b+tot2,T-f[i])-b;
		ans=max(ans,x+i);
	}
	printf("%lld\n",ans);
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n; cin>>n;
	string s; cin>>s;
	vector<vll> dp(n, vll(n, 0ll));
	for(ll i=0; i<=n-2; i++){
		if (s[i]==s[n-1]) dp[i][n-1] = 1;
	}
	for(ll i=n-2; i>=1; i--){
		for(ll j=0; j<=i-1; j++){
			if (s[j]==s[i]){
				dp[j][i] = min(dp[j+1][i+1]+1, abs(j-i));
			}
		}
	}
	ll ans=0;
	for(ll i=0; i<n; i++){
		for(ll j=0; j<n; j++){
			ans = max(ans, dp[i][j]);
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 195840
#pragma GCC optimize ("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<cmath>
#include<cstdio>
#include<algorithm>
#include<bitset>
#include<complex>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<utility>
#include<valarray>
#include<vector>
#include<array>
#include<forward_list>
#include<random>
#include<ratio>
#include<tuple>
#include<unordered_map>
#include<unordered_set>
#include<cstring>

using namespace std;
using Int = long long; using uint = unsigned int; using uInt = unsigned long long;
typedef pair<int,int> Pi; typedef pair<Int,Int> Pl;
constexpr int mod = 998244353;
constexpr int INF32 = numeric_limits<int>::max();
constexpr Int INF64 = numeric_limits<Int>::max();
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int(i)=0; i<n; ++i)
#define rer(i,l,r) for(int i=l; i<=r; ++i)
#define gnr(i,l,r) for(int i=r; i>=l; --i)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(i,n-1)cout<<a[i]<<' '; if(n)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
#define priend(a) {cout<<(a)<<'\n'; return 0;}
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

Int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

int main(){
	cin.tie(nullptr); ios::sync_with_stdio(0);
	//cout<<fixed<<setprecision(20);

	cin>>n>>m; Int a[n],sum[n+1]; sum[0]=0; unordered_map<Int,Int>p; p[0]++;
  rep(i,n){cin>>x; a[i]=x%m; sum[i+1]=(sum[i]+a[i])%m; p[sum[i+1]]++;}
  Int ans=0;
  for(Pl e:p)if(e.se>1)ans+=e.se*(e.se-1)/2;
  END
}

Measured memory_bytes: 4772
#include<stdio.h>
 
#define N 100
#define W 0
#define G 1
#define B 2
 
int n, m[N][N], color[N], d[N], f[N], t;
 
void dfs_visit(int u){
  int v;
  color[u] = G;
  d[u] = ++t;
  for(v = 0 ; v < n ; v++){
    if(m[u][v] == 0) continue;
    if(color[v] == W){
      dfs_visit(v);
    }
  }
  color[u] = B;
  f[u] = ++t;
}
 
void dfs(){
  int u;
  for(u = 0 ; u < n ; u++) color[u] = W;
  t = 0;
 
  for(u = 0 ; u < n ; u++){
    if(color[u] == W) dfs_visit(u);
  }
  for(u = 0 ; u < n ; u++){
    printf("%d %d %d\n", u + 1, d[u], f[u]);
  }
}
 
 
int main(){
  int u, v, k, i, j;
 
  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    for(j = 0 ; j < n ; j++) m[i][j] = 0;
  }
 
  for(i = 0 ; i < n ; i++){
    scanf("%d %d", &u, &k);
    u--;
    for(j = 0 ; j < k ; j++){
      scanf("%d", &v);
      v--;
      m[u][v] = 1;
    }
  }
 
  dfs();
 
  return 0;
}


Measured memory_bytes: 2108
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    N,Y=mis()
    for x in range(N+1):
        for y in range(N-x+1):
            if x*10000+y*5000+(N-x-y)*1000==Y:
                print(x,y,N-x-y,sep=' ')
                exit()
    print('-1 -1 -1')

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
use proconio::*;
fn main() {
    input! {
        n:i64,
    }
    let mut res = 0i64;
    for i in 1..n {
        if n % i == 0 {
            res += n / i - 1;
        } else {
            res += n / i;
        }
    }
    println!("{}", res);
}


Measured memory_bytes: 2128
#include<stdio.h>
#define SIZE 100

int main(void)
{
    long long c;
    int i, j, k;
    int n, m, l; scanf("%d %d %d", &n, &m, &l);
    int A[SIZE][SIZE], B[SIZE][SIZE];
    
    for ( i=0; i<n; ++i)
        for ( j=0; j<m; ++j)
            scanf("%d", &A[i][j]);
    for ( i=0; i<m; ++i)
        for ( j=0; j< l; ++j)
            scanf("%d", &B[i][j]);
            
    for ( i=0; i<n; ++i)
        for ( j=0; j<l; ++j){
            c = 0;
            for ( k=0; k<m; ++k)
                c += A[i][k] * B[k][j];
            printf("%ld", c);
            if ( j < l-1)
                putchar(' ');
            else
                putchar('\n');
        }
    
    return 0;
}


Measured memory_bytes: 2092