akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool up_min(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool up_max(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_mdvector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_mdvector(int n, Ts ... ts){
        return vector<decltype(make_mdvector(ts...))>(n, make_mdvector(ts...));
    }

    inline ll bit(int x){
        return 1ll << x;
    }

    template<class T>
    istream& operator>>(istream& is, vector<T>& v){
        for (auto &&x : v) { is >> x; } return is;
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    ll N;
    void run();
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef XELMH
    string test_cases = "test_B.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


void solver::run(){
    is >> N;
    if(!is) return;
    for (int i = 1; i < 10; ++i) {
        if(N %i == 0 and N / i < 10){
            os << "Yes\n"; return;
        }
    } // end i
    os << "No\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int>v;
int main()
{
  int n,k;
  cin>>n;
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++)
  {
     v.push_back(s[i]);
  }
  for(int i=0;i<s.size();i++)
  {
      k=v[i]+n;
    if(k<=90)
        cout<<char(k);
    else
    {
        cout<<char(k-26);
    }
  }
  cout<<endl;

}


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

int main() {
    int n;
    cin >> n;
    vector<string> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data.at(i);
    }
    sort(data.begin(), data.end());

    vector<string> vec;
    vec.push_back(data.at(0));
    for (int i = 0; i < n - 1; i++) {
        if (data.at(i) != data.at(i + 1)) {
            vec.push_back(data.at(i + 1));
        }
    }
    cout << vec.size() << endl;
}


Measured memory_bytes: 17872
<?php
list($n) = ints();
for ($i = 0; $i < $n; ++$i) {
    $a = ints();
    for ($j = 0; $j < $n - 1; ++$j) {
        $x1 = $j > 0 ? min($i, $a[$j - 1] - 1) * $n + max($i, $a[$j - 1] - 1) : 0;
        $x2 = min($i, $a[$j] - 1) * $n + max($i, $a[$j] - 1);
        $g[$x1][] = $x2;
    }
}
$seen = array_fill(0, $n * $n, 0);
echo dfs();
function dfs($v = 0)
{
    global $g, $seen, $dist;
    if ($seen[$v] === 2) return $dist[$v];
    $seen[$v] = 1; // 行きがけ
    if (isset($g[$v])) {
        foreach ($g[$v] as $to) {
            if ($seen[$to] === 1) exit('-1'); // 閉路あり
            $dist[$v] = max($dist[$v], dfs($to) + 1);
        }
    } else {
        $dist[$v] = 0;
    }
    $seen[$v] = 2; // 探索完了
    return $dist[$v];
}
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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

using namespace std;

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

#define bil ((ll)1e9)
#define mod ((ll)1e9+7)

int main(int argc,char* argv[]){
    ll a,b,x;
    cin >> a >> b >> x;

    ll ans=b/x-a/x;

    if(a%x==0)
        ans++;
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BPopularVote solver = new BPopularVote();
        solver.solve(1, in, out);
        out.close();
    }

    static class BPopularVote {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = Integer.parseInt(in.next());
            int m = Integer.parseInt(in.next());

            int[] a = new int[n];
            double total = 0;
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.next());
                total += a[i];
            }
            double ashikiri = total / (4 * m);
            int count = 0;
            for (int i = 0; i < n; i++) {
                if (a[i] >= ashikiri) {
                    count++;
                }
            }
            if (count >= m) {
                out.println("Yes");
            } else {
                out.println("No");
            }

        }

    }
}



Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)

using namespace std;

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

	int n; cin >> n;
	vector<pair<int, int>> vs(n);
	for (auto& v : vs) { cin >> v.first >> v.second; }

	FOR_LT(i, 0, n) {
		if (i + 1 == n) break;
		if (i + 2 == n) break;

		if (vs[i].first == vs[i].second && vs[i + 1].first == vs[i + 1].second && vs[i + 2].first == vs[i + 2].second)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	int mx=-1;
	for(int i=1;i*i<=n;i++)
    {
        mx=max(i*i,mx);
    }
    printf("%d\n",mx);
	return 0;
}


Measured memory_bytes: 256
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define pb push_back
#define mp make_pair
#define fe first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl
#define lets_go ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 1e9 + 7;
const int N = 1e7 + 10;
const int IM = 1e15 + 37;
const double PI = 3.1415926535897932384;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " " ; cout << endl;}
void PVV(vii v) {for (int i = 0 ; i < v.size() ; i++) cout << v[i].fe << " " << v[i].se << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << ' ' ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}
inline void PP(int n) { cout << n << " ";}
inline void PP(int n, int m) { cout << n << " " << m << endl;}
inline void PP(int n, int m, int q) {  cout << n << " " << m << " " << q << endl;}
inline void PP(int n, int m, int q, int u) {  cout << n << " " << m << " " << q << " " << u << endl;}
inline void op() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
// <=================================================================================================================================
// <=================================================================================================================================

int p[N];
vi v;
void pre() {
    for (int i = 1; i < N; i++) {
        {
            for (int j = i; j < N; j += i)
                p[j]++;
        }
    }
}

signed  main() {
    //op();
    pre();
    lets_go
    int i, j, x, y, u, l;
    //int t; cin >> t; while (t--)
    {
        i = j = x = y = u = l = 0;

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

        /* */

    }
    return 0;

}


Measured memory_bytes: 81760
/*
 * atcoder/abc116_2nd/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
#include <map>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

/*
 * 各typeのトップ（最高価値のすし）の集合topsとそれ以下の集合othersを分けて考える.
 * typeを増やしたい場合はtopsの大きい方から取る.
 * typeを増やしたくない（増えてもいい）場合はothersから取る.
 * typeが不本意にも増えた場合でも点が減ることはないので問題ない.
 */
int N, K;
map<ll, ll> M;
vector<ll> tops, others, t_acc, o_acc;
ll t, d;
void solve() {
  cin >> N >> K;
  loop(n,0,N) {
    cin >> t >> d;
    t--;
    if (M.count(t)) {
      if (M[t] <= d) {
        others.push_back(M[t]);
        M[t] = d;
      } else {
        others.push_back(d);
      }
    } else {
      M[t] = d;
    }
  }
  for (auto&& top: M) tops.push_back(top.second);
  sort(tops.rbegin(), tops.rend());
  sort(others.rbegin(), others.rend());

  t_acc.assign(tops.size()+1, 0);
  o_acc.assign(others.size()+1, 0);

  for (int i=0; i<tops.size(); i++) t_acc[i+1] = t_acc[i] + tops[i];
  for (int i=0; i<others.size(); i++) o_acc[i+1] = o_acc[i] + others[i];

  ll maxT = min((ll)K, (ll)t_acc.size()-1);
  ll max_ = 0;
  for (ll t=1; t<=maxT; t++) {
    chmax(max_, t_acc[t] + o_acc[min(K-t, (ll)o_acc.size()-1)] + t * t);
  }
  cout << max_ << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 8184
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


# @mt
def slv(A, B, C, K):
    ans = A - B if K % 2 == 0 else B - A
    if abs(ans) > 1e+18:
        return 'Unfair'
    return ans


def main():
    A, B, C, K = read_int_n()

    print(slv(A, B, C, K))


if __name__ == '__main__':
    main()


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

#define int long long
#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define endl "\n"
#define ends " "
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
#define debugV(v) cerr << #v << ": [ "; for(int __ = 0; __ < v.size(); __++) cerr << v[__] << ((__ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugVP(v) cerr << #v << ": [ "; for(int ___ = 0; ___ < v.size(); ___++) cerr << '{' << v[___].first << ", " << v[___].second << '}' << ((___ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugA(a, n) cerr << #a << ": [ "; for(int ____ = 0; ____ < n; ____++) cerr << a[____] << ((____ != n - 1) ? ", " : ends); cerr << ']' << endl
#define print(args...) fprintf (stderr, args)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
const int INF = 1e9, MOD = INF + 7;

/////////////////////////////////////////////////////////////////////

const int N = 1e3 + 20;

bool a[N][N];
int dp[N][N];

int32_t main(){

    sync;

    int n, m; cin >> n >> m;
    for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) {
    	char c; cin >> c;
    	a[i][j] = (c == '#');
    }
    dp[0][1] = 1;
    for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) {
    	if (a[i][j]) continue;
    	dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
    }
    cout << dp[n][m] << endl;

    return 0;
}

Measured memory_bytes: 9344
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main()
{
	int N;
	cin>>N;
	int flag=1;
	for(int i=1;i<=N;i++)
	{
		int a;
		cin>>a;
		if(a%2==0)
		{
			if(a%3==0||a%5==0)
			;
			else
			{
				flag=0;
			}
		}
	}
	if(flag==0) cout<<"DENIED"<<endl;
	else
	cout<<"APPROVED"<<endl;
}

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

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

  int res = 0;
  // どこかで切る
  for (int i = 0; i < n; ++i) {
    string x = s.substr(0, i);
    string y = s.substr(i);
    set<char> both;
    for (char xc : x) {
      for (char yc : y) {
        if (xc == yc) {
          both.insert(xc);
        }
      }
    }
    res = max(res, (int) both.size());
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;

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

struct field {
	vector<vector<int>>drys;
	int cy;
	int cx;
	long long int hash;
	field(vector<vector<int>>drys_, const int cy_, const int cx_) :drys(drys_), cy(cy_), cx(cx_),hash(0) {
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				hash = hash * 10 + drys[i][j];
			}
		}
		hash = hash * 10 + cy;
		hash = hash * 10 + cx;
	}
	
};
bool operator<(const field&l, const field&r) {
	return l.hash < r.hash;
}

int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<vector<vector<int>>>fests(N, vector<vector<int>>(4, vector<int>(4)));
		for (int day = 0; day < N; ++day) {
			for (int y = 0; y < 4; ++y) {
				for (int x = 0; x < 4; ++x) {
					int a; cin >> a;
					fests[day][y][x] = a;
				}
			}
		}
		set<field,less<field>,allocator<field>>fields;
		fields.emplace(field(vector<vector<int>>(4, vector<int>(4)), 1, 1));
		for (int day = 0; day < N; ++day) {
			set<field>nextfields;
			for (const auto f : fields) {
				const int nowcx = f.cx;
				const int nowcy = f.cy;
				if (day) {
					for (int cway = 0; cway <4; ++cway) {
						for (int dis = 1; dis <= 2; ++dis) {
							vector<vector<int>>nowdrys(f.drys);
							for (int y = 0; y < 4; ++y) {
								for (int x = 0; x < 4; ++x) {
									nowdrys[y][x]++;
								}
							}
							const int nexcx = nowcx + dx[cway] * dis;
							const int nexcy = nowcy + dy[cway] * dis;
							if (nexcx < 0 || nexcx >= 3 || nexcy < 0 || nexcy >= 3)continue;
							bool ok = true;
							for (int rainway = 0; rainway < 4; ++rainway) {
								const int rainy = nexcy + dy2[rainway];
								const int rainx = nexcx + dx2[rainway];
								if (fests[day][rainy][rainx])ok = false;
								nowdrys[rainy][rainx] = 0;
							}
							for (int y = 0; y < 4; ++y) {
								for (int x = 0; x < 4; ++x) {
									if (nowdrys[y][x] >= 7)ok = false;
								}
							}
							if (ok) {
								nextfields.emplace(nowdrys, nexcy, nexcx);
							}
						}
					}
				}
				{
					const int nexcx = nowcx;
					const int nexcy = nowcy;
					vector<vector<int>>nowdrys(f.drys);
					for (int y = 0; y < 4; ++y) {
						for (int x = 0; x < 4; ++x) {
							nowdrys[y][x]++;
						}
					}
					if (nexcx < 0 || nexcx>3 || nexcy < 0 || nexcy>3)continue;
					bool ok = true;
					for (int rainway = 0; rainway < 4; ++rainway) {
						const int rainy = nexcy + dy2[rainway];
						const int rainx = nexcx + dx2[rainway];
						if (fests[day][rainy][rainx])ok = false;
						nowdrys[rainy][rainx] = 0;
					}
					for (int y = 0; y < 4; ++y) {
						for (int x = 0; x < 4; ++x) {
							if (nowdrys[y][x] >= 7)ok = false;
						}
					}
					if (ok) {
						nextfields.emplace(nowdrys, nexcy, nexcx);
					}
				}
				
			}
			fields = nextfields;
			
		}
		if (!fields.empty())cout << 1 << endl;
		else cout << 0 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 4204
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; i++)cin >> A[i];
	sort(A.begin(), A.end());
	cout << A[n - 1] - A[0] << endl;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
using namespace std;
int main() {
	int A, B;
	cin >> A >> B;
	int counter = 0;
	for (int i = A; i <= B; i++) {
		string tmp = to_string(i);
		if ((tmp[0] == tmp[4]) && (tmp[1] == tmp[3])) counter++;
	}
	cout << counter << endl;
	return 0;
}

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}



//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
  int N;cin>>N;
  vvi c(10,vi(10));
  for(int i=1;i<=N;i++){
    string s=to_string(i);
    for(int j=1;j<=9;j++){
      for(int k=1;k<=9;k++){
        if(s[0]==j+'0' &&s[(s.size()-1)]==k+'0'){
          c[j][k]++;
        }
      } 
    }
  }
  ll ans=0;
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      ans +=(ll)c[i][j]*(ll)c[j][i];
    } 
  }
  cout<<ans<<endl;
}







Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int e;

  while(cin >> e, e ){
    int m = 1e8;
    for( int z=0;; z++ ){
      int zzz = z*z*z;
      if( zzz > e )
	break;
      for( int y=0;; y++ ){
	int yy = y*y;
	if( zzz + yy > e )
	  break;

	int x = e-zzz-yy;
	m = min( m, x+y+z);
      }
    }
    cout << m << endl;

  }

}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  long long a,b,c;
  cin>>a>>b>>c;
  if(a%2==0 || b%2==0 || c%2==0){
    cout<<0<<endl;
  }else{
    cout<<min(b*c,min(c*a,a*b))<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

int n,q;
vector<bool>seen(n);
void dfs(const Graph &G,int v,vector<int>&cnt,int p = -1){
    seen[v] = true;
    for(auto nv : G[v]){
        if(nv==p)continue;
        if(seen[nv])continue;
        cnt[nv] += cnt[v];
        dfs(G,nv,cnt,v);
    }
}

int main(){
    cin>>n>>q;
    Graph G(n);
    rep(i,n-1){
        int a,b;cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int>cnt(n,0);
    rep(i,q){
        int p,x;cin>>p>>x;
        p--;
        cnt[p] += x;
    }
    seen.assign(n,false);
    dfs(G,0,cnt);
  rep(i,n)cout<<cnt[i]<<" ";
}



Measured memory_bytes: 29696
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<min(a,b)+min(c,d)<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


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

int main() {
	
	int h, w;
	cin >> h >> w;
	vector<vector<char>> s(h, vector<char>(w));
	rep(i, h) rep(j, w) cin >> s[i][j];
	
	bool can_draw = true;;
	rep(i, h){
		rep(j, w){
			if(s[i][j] == '#'){
				if(i < h - 1) if(s[i + 1][j] == '.')
				if(i > 0) if(s[i - 1][j] == '.')
				if(j < w - 1) if(s[i][j + 1] == '.')
				if(j > 0) if(s[i][j - 1] == '.'){
					can_draw = false;
					break;
				}
			}
		}
		if(!can_draw) break;
	}
	
	if(can_draw) puts("Yes");
	else puts("No");
	return 0;
}

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

bool parity(int x, int y)
{
    return (x + y) % 2;
}

int main()
{
    int N;
    cin >> N;
    int x = 0, y = 0, t = 0;
    bool flg = true;

    while (N--) {
        int nx, ny, tx;
        cin >> tx >> nx >> ny;

        t = tx - t;
        if (t < abs(nx-x) + abs(ny-y)) flg = false;

        if (parity(nx, ny) != parity(x, y)) {
            if (t % 2 == 0) flg = false;
        }else {
            if (t % 2) flg = false;
        }

        x = nx, y = ny, t = tx;
    }

    if (flg) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

int a[1000200];
map<int, bool> m;

int f(int n) {
  if (n % 2 == 0) {
    return n / 2;
  } else {
    return 3 * n + 1;
  }
}

int main() {
  cin >> a[0];
  m[a[0]] = true;
  for (int i = 1; i < 1000100; i++) {
    a[i] = f(a[i - 1]);
    if (m[a[i]]) {
      cout << i + 1 << endl;
      return 0;
    }
    m[a[i]] = true;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int MOD=1000*1000*1000+7;

vector<long long> facts;
vector<long long> fact_invs;
vector<long long> invs;

void comb_init(int n){
    facts=vector<long long>(n+1);
    fact_invs=vector<long long>(n+1);
    invs=vector<long long>(n+1);
    facts[0]=facts[1]=1;
    fact_invs[0]=fact_invs[1]=1;
    invs[1]=1;
    for(int i=2; i<=n; ++i){
        facts[i]=facts[i-1]*i%MOD;
        invs[i]=MOD-invs[MOD%i]*(MOD/i)%MOD;
        fact_invs[i]=fact_invs[i-1]*invs[i]%MOD;
    }
}

long long comb(long long n, long long k){
    return facts[n]*(fact_invs[k]*fact_invs[n-k]%MOD)%MOD;
}

long long f(long long h, long long w){
    return comb(h+w-2, w-1);
}

int main(){
    int h, w, a, b; cin >> h >> w >> a >> b;
    comb_init(h+w);
    long long ans=f(h, w);
    for(int i=0; i<b; ++i){
        long long removed=f(a, w-b+i+1);
        long long times=f(h-a, b-i);
        ans=ans-(removed*times%MOD);
        if(ans<0) ans+=MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
using namespace std;
long long A[200001] = {0};
long long B[200001] = {0};
int main(void) {
  int N, M;
  long long K;
  cin >> N >> M >> K;
  for (int i = 1; i <= N; i++) {
    long long a;
    cin >> a;
    A[i] = A[i-1]+a;
  }
  for (int i = 1; i <= M; i++) {
    long long b;
    cin >> b;
    B[i] = B[i-1]+b;
  }
  // Aをi冊読んだとする
  int ans = 0;
  long long minutes = 0;
  for (int i = 0; i <=N; i++) {
    if (A[i] > K) continue; // 読めない場合は計算しない

    minutes = A[i];
    // 残りの時間でBを何冊読めるか数える
    long long left_minutes = K-A[i];
    int l = 0;  // lは必ず読める冊数
    int r = M;
    int m = (l+r)/2;
    while (l < r) {
      if (B[m] <= left_minutes) {
        // 読める
        l = m;
        m = (l+r+1)/2;
      } else {
        // 読めない
        r = m-1;
        m = (l+r)/2;
      }
    }
    ans = max(ans, i+l);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6744
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        m: usize,
        sc: [(usize,usize);m]
    }

    let mut map = HashMap::new();

    let mut cont = false;
    for e in sc {
        if map.get(&e.0) == None {
            map.insert(e.0, e.1);
        } else {
            if map.get(&e.0).unwrap() != &e.1 {
                cont = true;
                break;
            }
        }
    }

    if cont {
        println!("-1");
    } else {
        let mut ans = 0;
        for (digit, value) in map.iter() {
            ans += usize::pow(10, n as u32 - *digit as u32) * value;
        }

        if usize::pow(10, n as u32 - 1) > ans && usize::pow(10, n as u32 - 1) != 1 {
            if map.get(&1) == None {
                ans += usize::pow(10, n as u32 - 1);
                println!("{}", ans);
            } else {
                println!("-1");
            }
        } else {
            println!("{}", ans);
        }
    }
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


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

int main(){
	
	double x1,x2,y1,y2;
	double d;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	
	d=sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
	printf("%f\n",d);
	return 0;


}

Measured memory_bytes: 652
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define mod (int)1e9+7
#define inf (int)1e16
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T,vector<T>,greater<T>>
struct edge { int to, cost; };
typedef pair<int, int> P;
int n, m;
int a[114514];
int dp[114514];
signed main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> a[i];
		if (i) {
			if (a[i] - 1 == a[i - 1]) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	dp[0] = 1;
	if (binary_search(a, a + m, 1)) dp[1] = 0;
	else dp[1] = 1;
	rep(i, n + 1) {
		if (i < 2) continue;
		if (binary_search(a, a + m, i)) {
			dp[i] = 0;
		}
		else {
			dp[i] = dp[i - 1] + dp[i - 2];
			dp[i] %= mod;
		}
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
	string str;
	while (cin >> str) {
		string ans;
		for (int i = 0; i < str.size(); i++) {
			if (str[i] == '@') {
				int num = str[i + 1] - '0';
				for (int j = 0; j < num; j++)
					ans += str[i + 2];
				i += 2;
			}
			else {
				ans += str[i];
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
 
int main() {
    int n;
    cin >> n;
  if(n>=64){
     cout<<64<<endl;
   }
  else if(n>=32){
    cout<<32<<endl;
  }
  else if(n>=16){
    cout<<16<<endl;
  }
  else if(n>=8){
    cout<<8<<endl;
  }
  else if(n>=4){
    cout<<4<<endl;
  }
  else if(n>=2){
    cout<<2<<endl;
  }else{
    cout<<1<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	int N;
	cin >> N;

	vector<int> A;
	rep(i, N) {
		int a;
		cin >> a;
		A.push_back(a);
	}

	multiset<int> ms;

	for(int i = 0; i < N; i++){
		if(ms.size() == 0 || A[i] <= *ms.begin()){
			ms.insert(A[i]);
		}else{
			auto itr = ms.lower_bound(A[i]);
			itr--;
			ms.insert(A[i]);
			ms.erase(itr);
		}
	}

	cout << ms.size() << endl;
}


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

int main()
{
  int N;
  cin >> N;
  long ans = 0;
  for (int i = 1; i <= N; i++)
  {
    if (i % 3 != 0 && i % 5 != 0)
    {
      ans += i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
const int INF = 1e9;
using namespace std;

signed main() {
    map<string, int> m;
    int N;
    cin >> N;
    rep(i, N) {
        string s;
        cin >> s;
        m[s]++;
    }
    int M;
    cin >> M;
    rep(i, M) {
        string s;
        cin >> s;
        m[s]--;
    }
    int max=0;
    for(auto p:m){
        if(max<p.second) max=p.second;
    }
    cout << max << endl;
}


Measured memory_bytes: 256
N = int(input())
T = list(map(int, input().split()))
M = int(input())
P, X, ans = [0]*M, [0]*M, []
base = sum(T)

for i in range(M):
    P, X = map(int, input().split())
    ans.append(base-T[P-1]+X)

for i in ans:
    print(i)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
		System.out.println((b-a)==(c-b)?"YES":"NO");
		sc.close();
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vi a(N);
    cin >> a;
    int beg = 0;
    int ans = 0;
    REPF(i, 1, N) {
        if (a[i - 1] != a[i]) {
            int len = i - beg;
            ans += len / 2;
            beg = i;
        }
    }
    ans += (N - beg) / 2;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	ll w, h, k;
	cin >> w >> h >> k;
	k = 2 * k - 2;
	ll ans = 0;
	for (ll i = 1; i < w; i++) {
		for (ll a = 1; a < h; a++) {
			if (a * i > k + 2 * w) break;
			ll x = (k - i * a) / (w - i);
			chmin(x, h - 1);
			if (x < a) {
				for (ll b = a; b < h; b++) {
					if (a * i + b * (w - i) > k + 2 * w) break;
					if (a * i + b * (w - i) - gcd(w - i, a) - gcd(i, b) - gcd(w, a - b) <= k) ans += (b > a ? 2 : 1);
				}
			}
			else {
				ans += (x - a) * 2 + 1;
				for (ll b = x + 1; b < h; b++) {
					if (a * i + b * (w - i) > k + 2 * w) break;
					if (a * i + b * (w - i) - gcd(w - i, a) - gcd(i, b) - gcd(w, a - b) <= k) ans += (b > a ? 2 : 1);
				}
			}
		}
	}
	swap(w, h);
	for (ll i = 1; i < w; i++) {
		for (ll a = 1; a < h; a++) {
			if (a * i > k + 2 * w) break;
			ll x = (k - i * a) / (w - i);
			chmin(x, h - 1);
			if (x < a) {
				for (ll b = a; b < h; b++) {
					if (a * i + b * (w - i) > k + 2 * w) break;
					if (a * i + b * (w - i) - gcd(w - i, a) - gcd(i, b) - gcd(w, a - b) <= k) ans += (b > a ? 2 : 1);
				}
			}
			else {
				ans += (x - a) * 2 + 1;
				for (ll b = x + 1; b < h; b++) {
					if (a * i + b * (w - i) > k + 2 * w) break;
					if (a * i + b * (w - i) - gcd(w - i, a) - gcd(i, b) - gcd(w, a - b) <= k) ans += (b > a ? 2 : 1);
				}
			}
		}
	}
	cout << ans * 2 << '\n';
}

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

int main() {
    int N;
    int A[30];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    int c = 1;
    bool higher = true;
    for (int i = 1; i < N; i++) {
        higher = true;
        for(int j = 0; j < i; j++) {
            higher *= (A[j] <= A[i]);
        }
        if (higher) c++;
    }

    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1<<30;
int main(){
	ll a,b;
	cin>>a>>b;
	ll out=a;
	ll x=b,y=a-b;
	while(1){
		if(x==y){
			out+=x;
			break;
		}
		if(x>y){
			ll t=x/y-1;
			if(t==0)t=1;
			out+=y*2*t;
			x-=y*t;
		}else{
			ll t=y/x-1;
			if(t==0)t=1;
			out+=x*2*t;
			y-=x*t;
		}
	}
	cout<<out<<endl;
}






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

int main() {
  int H,W;
  cin >> H >> W;
  
  while (H != 0 || W != 0){
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cout << '#';
        if (j == W - 1){
          cout << endl;
        }
      }
      if ( i == H - 1){
        cout << endl;
      }
    }
    cin >> H >> W;
  }
}  
  


Measured memory_bytes: 3096
#include <iostream>
#include <stdio.h>
#include <algorithm>
#define MAX 1000
using namespace std;

int main()
{
    int n, m;
    int arr[MAX] = {0}, brr[MAX] = {0};

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
    }

    scanf("%d", &m);
    for (int i = 0; i < m; i++)
    {
        scanf("%d", &brr[i]);
    }

    if (n < m)
    {
        for (int loop = 0; loop < n; loop++)
        {
            if (arr[loop] > brr[loop])
            {
                printf("%d\n", 0);
                return 0;
            }
            else if (arr[loop] < brr[loop])
            {
                break;
            }
        }
        printf("%d\n", 1);
    }
    else if (n > m)
    {
        for (int i = 0; i < m; i++)
        {
            if (arr[i] < brr[i])
            {
                printf("%d\n", 1);
                return 0;
            }
            else if (arr[i] > brr[i])
            {
                break;
            }
        }
        printf("%d\n", 0);
    }
    else
    {
        for (int loop = 0; loop < m; loop++)
        {
            if (arr[loop] < brr[loop])
            {
                printf("%d\n", 1);
                return 0;
            }
            else if (arr[loop] > brr[loop])
            {
                break;
            }
        }
        printf("%d\n", 0);
    }

    return 0;
}



Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 3e18+7
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;

int NMAX=1000;
int MMAX=2000;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    vector<int> a(MMAX),b(MMAX),c(MMAX);
    REP(i,M){
        cin >> a[i] >> b[i] >> c[i];
        c[i] = -c[i];
    }

    vector<ll> dist(NMAX);
    REP(i,N) dist[i]=LINF;
    dist[0]=0;

    for(int loop=0;loop<N;++loop){
        for(int i=0;i<M;++i){
            if(dist[a[i]-1]==LINF) continue;

            if(dist[b[i]-1] > dist[a[i]-1]+c[i]) dist[b[i]-1] = dist[a[i]-1] + c[i];
        }
    }

    ll ans = -dist[N-1];
    //負の閉路検出
    vector<bool> negative(NMAX,0);
    
    for(int loop=0;loop<N;++loop){
        for(int i=0;i<M;++i){
            if(dist[a[i]-1]==LINF) continue;
    
            if(dist[b[i]-1] > dist[a[i]-1] + c[i]){
                dist[b[i]-1] = dist[a[i]-1] + c[i];
                negative[b[i]-1] = true;
            }
    
            if(negative[a[i]-1]==true) negative[b[i]-1]=true;
        }
    }

    if(negative[N-1]) cout << "inf" << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

set<int> st;

void go(int nm, int i) {
        if (nm> 3234566668) return;
        st.insert(nm);
        if (i< 9)go(nm* 10ll+ (i+ 1), i+ 1);
        if (i> 0) go(nm* 10ll+ (i- 1), i- 1);
        go(nm* 10ll+ (i), i);
}

void solve() {
        for (int i= 1; i<= 9; i++) go(i, i);
        int n; cin >> n;
        vector<int> v;
        for(auto x: st) v.push_back(x);
        cout << v[n- 1]<< "\n";
}

int32_t main(){
//ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int t = 1;
        //cin >> t;
        while ( t-- ) {
                solve();
        }
return 0;
}


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

int main() {
    char X, Y;
    cin >> X >> Y;
    if (X < Y) {
        cout << '<' << endl;
    }
    else if (X == Y) {
        cout << '=' << endl;
    }
    else {
        cout << '>' << endl;
    }
}

Measured memory_bytes: 256