akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <complex>
 
 
using namespace std;
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
 
 
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
 
const int MOD =  1e9 + 7; 
 
 
 
ll power(ll a, ll b){
	if(b == 0) return 1;
	else {
		ll x = power(a,b/2);
		x = (x*x)%MOD;
		if(b&1) return (x*a)%MOD;
		else return x;
	}
}
 
 
ll& Mod(ll& a) {
    if (a >= MOD) {
        return Mod(a -= MOD);
    } else if (a < 0) {
        return Mod(a += MOD);
    } else {
        return a;
    }
}
 
ll gcd(ll a, ll b) { 
	// b < a
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
 



int main() {
	fast_cin();	
	
	string s; cin >> s;
	for(int i = 0; i < s.size(); i++){
		cout << 'x';
	}
	cout << '\n';
	
	
	
	
		
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#include "string"

const int N = 1e5 + 5;
const int M = 1e9 + 7;
int mod( int m ,int mod = M) {
   m %= mod;
   return (m + mod) % mod;
}

string s;
int n;
int pw[N],dp[N][14];

int solve(int id,int cur){
	if(id == n)
		return (cur == 5);
	int &tmp = dp[id][cur];
	if(tmp != -1)
		return tmp;
	tmp = 0;
	if(s[id] == '?'){
		for(int i=0;i<10;i++)
			tmp = mod(tmp + solve(id+1,mod(cur + i*pw[n-id],13)));
	}
	else
		tmp = solve(id+1,mod(cur + (s[id]-'0')*pw[n-id],13));
	return tmp;
}

int32_t main(){
	boost;
	cin>>s;
	n = s.size();
	pw[0] = 1;
	pw[1] = 1;
	for(int i=2;i<=n;i++)
		pw[i] = mod(pw[i-1] * 10,13);
	memset(dp,-1,sizeof dp);
	int ans = solve(0,0);
	cout<<ans<<endl;
}



Measured memory_bytes: 23308
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var A1i = Sarray();
            var A2i = Sarray();
            var rui1 = new long[N+1];
            var rui2 = new long[N+1];
            for (var i = 1; i < N + 1; ++i)
            {
                rui1[i] = rui1[i - 1] + A1i[i - 1];
                rui2[i] = rui2[i - 1] + A2i[i - 1];
            }
            var ans = 0L;
            for (var i = 1; i <= N; ++i)
            {
                ans = Max(ans, rui1[i] + rui2[N] - rui2[i - 1]);
            }
            WriteLine(ans);

            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>

using namespace std;

int main()
{
	map<string, int> list;
	int acc = 0;
	int n;

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		char input[101];
		string str;
		int val;

		scanf("%s %d", input, &val);

		str = input;

		acc += val;

		list[str] = acc;
	}

	char input[101];
	string str;

	scanf("%s", input);
	str = input;

	int sol;

	sol = list[str];

	printf("%d\n", acc - sol);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;

int main(void)
{
    string S;
    cin >> S;

    int heisei = false;
    if (S.at(5) - '0' == 0 && S.at(6) - '0' <= 4)
        heisei = true;

    if (heisei == true)
        cout << "Heisei" << endl;
    else
        cout << "TBD" << endl;

    return (0);
}

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

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

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

using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> P;
#define inf 1ll<<60
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define int llong


signed main(){
	int N, h[101] = {};
	cin >> N;
	for(int i = 1; i <= N; i++)
		cin >> h[i];

	int ans = 0;
	while(true){
		int cnt = 0;
		int zero = 0;
		for(int i = 1; i <= N; i++){
			if(h[i] > 0 && h[i-1] == 0)
				cnt++;
		}
		for(int i = 1; i <= N; i++){
			if(h[i] == 0)
				zero++;
			else
				h[i]--;

			// cerr << h[i] << " ";
		}
		// cerr << endl << cnt << endl;
		if(zero == N)
			break;
		else
			ans += cnt;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std; using namespace placeholders;

typedef vector< int > VI;
typedef vector< VI > VVI;

template < typename T > inline T fromString( const string &s ){ T res; istringstream iss( s ); iss >> res; return res; };
template < typename T > inline string toString( const T &a ){ ostringstream oss; oss << a; return oss.str(); };

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( e, c ) for ( auto &e : c )
#define ALL( c ) (c).begin(), (c).end()
#define AALL( a, t ) (t*)a, (t*)a + sizeof( a ) / sizeof( t )
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int vanish( VVI &board )
{
	int res = 0;

	FOR( row, board )
	{
		REP( i, 0, 5 )
		{
			for ( int j = 4; i + 2 <= j; j-- )
			{
				if ( row[i] && set<int>( row.begin() + i, row.begin() + j + 1 ).size() == 1 )
				{
					res += row[i] * ( j - i + 1 );
					fill( row.begin() + i, row.begin() + j + 1, 0 );
				}
			}
		}
	}

	return res;
}

VVI fall( const VVI &board )
{
	VVI res( board.size(), VI( 5 ) );

	REP( x, 0, 5 )
	{
		VI bricks;
		REP( y, 0, board.size() )
		{
			if ( board[y][x] )
			{
				bricks.PB( board[y][x] );
			}
		}
		reverse( ALL( bricks ) );
		REP( i, 0, bricks.size() )
		{
			res[ res.size() - 1 - i ][x] = bricks[i];
		}
	}

	return res;
}

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

	for ( int h; cin >> h, h; )
	{
		VVI board( h, VI( 5 ) );
		FOR( row, board )
		{
			FOR( a, row )
			{
				cin >> a;
			}
		}

		int res = 0;
		for ( int d; d = vanish( board ); res += d, board = fall( board ) );
		cout << res << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

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

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define fi first 
#define se second

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;


void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int N; cin >> N;
	VI T(N), A(N), X(N, 0), Y(N, 0);
	REP(i, N) cin >> T[i];
	REP(i, N) cin >> A[i];
	X[0] = T[0];
	Y[N - 1] = A[N - 1];

	FOR(i,1,N) if (T[i] > T[i - 1]) X[i] = T[i];
	for (int i = N - 2; i >= 0; --i) if (A[i] > A[i + 1]) Y[i] = A[i];

	ll cnt = 1;
	REP(i, N) {
		if (X[i] == 0 && Y[i] == 0) (cnt *= min(A[i], T[i])) %= MOD;
		if (X[i] != 0 && Y[i] == 0) cnt *= ((X[i] <= A[i]) ? 1 : 0);
		if (X[i] == 0 && Y[i] != 0) cnt *= ((Y[i] <= T[i]) ? 1 : 0);
		if (X[i] != 0 && Y[i] != 0) cnt *= ((X[i] == Y[i]) ? 1 : 0);
	}
	cout << cnt << endl;
	
	return 0;
}



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

using std::pair;
using std::vector;
using std::string;
 
typedef long long ll;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

int n, d1, d2;
bool vis[605][605];
vector <pii> vec[4], G;
int id1[605][605], id2[605][605];

void dfs1(int x, int y, int bel) {
    if(x < 0 || y < 0 || x >= 2*n || y >= 2*n || vis[x][y]) return;

    id1[x][y] = bel;
    vis[x][y] = true;

    for(auto v : G) {
        int i = v.fst, j = v.snd;
        dfs1(x + i, y + j, bel ^ 1);
        dfs1(x + i, y - j, bel ^ 1);
        dfs1(x - i, y + j, bel ^ 1);
        dfs1(x - i, y - j, bel ^ 1);
    }
}

void dfs2(int x, int y, int bel) {
    if(x < 0 || y < 0 || x >= 2*n || y >= 2*n || vis[x][y]) return;

    id2[x][y] = bel;
    vis[x][y] = true;

    for(auto v : G) {
        int i = v.fst, j = v.snd;
        dfs2(x + i, y + j, bel ^ 2);
        dfs2(x + i, y - j, bel ^ 2);
        dfs2(x - i, y + j, bel ^ 2);
        dfs2(x - i, y - j, bel ^ 2);
    }
}

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    read(n), read(d1), read(d2);

    memset(vis, 0, sizeof vis);

    G.clear();
    for(int i = 0, j; i < 2*n; ++i) { 
        j = (int) sqrt(d1 - i * i); 
        if(i * i + j * j == d1) G.pb(mp(i, j));
    }
    for(int i = 0; i < 2*n; ++i) {
        for(int j = 0; j < 2*n; ++j) 
            if(!vis[i][j]) dfs1(i, j, 0);
    }

    memset(vis, 0, sizeof vis);

    G.clear();
    for(int i = 0, j; i < 2*n; ++i) { 
        j = (int) sqrt(d2 - i * i); 
        if(i * i + j * j == d2) G.pb(mp(i, j));
    }

    for(int i = 0; i < 2*n; ++i) {
        for(int j = 0; j < 2*n; ++j) 
            if(!vis[i][j]) dfs2(i, j, 0);
    }

    for(int i = 0; i < 2*n; ++i) 
        for(int j = 0; j < 2*n; ++j) 
            vec[id1[i][j] | id2[i][j]].pb(mp(i, j));

    for(int i = 0; i < 4; ++i) if((int) vec[i].size() >= n * n) {
        int t = n * n;
        for(auto v : vec[i]) {
            if(t-- > 0) printf("%d %d\n", v.fst, v.snd);
        }
        break;
    }

    return 0;
}


Measured memory_bytes: 35188
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 998244353;

int main()
{
    int A, B, C; cin >> A >> B >> C;
    int sum = A + B + C;
    int M = max(A, max(B, C));
    if ((M * 3) % 2 == sum % 2)
    {
        cout << (M * 3 - sum) / 2 << endl;
    }
    else
    {
        cout << ((M + 1) * 3 - sum) / 2 << endl;
    }
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20)
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1e9+7;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
//llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	string str;cin>>str;
	int i,w;cin>>w;
	for(i=0;i<str.size();i+=w){cout<<str[i];}cout<<endl;
	return 0;
}

Measured memory_bytes: 256
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;

LL ans = 0;

void solve(){
	for(LL p=1;p*p<N;p++){
		if(N%p==0){
			LL m = N/p - 1;
			if(p<=m-1) ans += m;
		}
	}
}
 
int main(){
    cin >> N;
 
    solve();
 
    cout << ans << endl;
    return 0;
}

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

int main() {
  string x, y;
  cin >> x >> y;
  int ans = 0;
  rep(i, 3) {
    if (x[i] == y[i]) ans ++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int m = -1;
    int f = -1;
    int r = -1;
    
    while( 1 )
    {
        // input
        std::cin >> m;
        std::cin >> f;
        std::cin >> r;
        
        if( m < -1 || m > 50 || f < -1 || f > 50 || r < -1 || r > 100 )
        {
            std::cout << "Error : out of range!" << std::endl;
            return -1;
        }
        
        if( -1 == m && -1 == f && -1 == r )
        {
            break;
        }
        
        // output
        if( -1 == m || -1 == f )
        {
            std::cout << "F" << std::endl;
            continue;
        }
        
        if( m + f < 30 )
        {
            std::cout << "F" << std::endl;
            continue;
        }
        
        if( m + f >= 80 )
        {
            std::cout << "A" << std::endl;
            continue;
        }

        if( m + f >= 65 && m + f < 80 )
        {
            std::cout << "B" << std::endl;
            continue;
        }     
    
        if( m + f >= 50 && m + f < 65 )
        {
            std::cout << "C" << std::endl;
            continue;
        }

        if( m + f >= 30 && m + f < 50  && r >= 50 )
        {
            std::cout << "C" << std::endl;
            continue;
        }

        if( m + f >= 30 && m + f < 50  && r < 50 )
        {
            std::cout << "D" << std::endl;
            continue;
        }        
    }
    
    return 0;
}


Measured memory_bytes: 3080
#include <stdio.h>
int max2(int x,int y){
    if(x>y){
        return x;
    }else{
        return y;
    }
}

int main(void){
    int A,B,C,D;
    int x,y;
    scanf("%d %d %d %d",&A,&B,&C,&D);

    x=A*B;
    y=C*D;

    printf("%d\n",max2(x,y));

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <ctype.h>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <array>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <array>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
// #include <pair> 
       
using namespace std;
typedef pair<long long int, long long int> ii;
typedef vector<long long int> vi;
typedef vector<ii> vii;
#define INF 1000000000000000
       
#define endl '\n'
#define MOD 1000000007
// #define INF 1ll<<30
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES
 
// long long binpow(long long a,long long b)
// {
//     if (b == 1) return a;
//     long long res = binpow(a, b/2)%MOD;
//     if (b % 2) return (res*((res*a)%MOD))%MOD;
//     else return (res * res)%MOD;
// }
 
// long long int fact(long long int a)
// {
//     if(a==0||a==1)
//         return 1;
//     long long int ans = 1;
//     for(int i=a;i>=1;i--)
//         ans = (ans * i);
//     return ans;
// }
 
// long long int ivmod(long long int a)
// {
//     return binpow(a,MOD-2);
// }
 
// long long int ncr(long long int a,long long int b)
// {
//     long long int pans=1;
//     for(int i =a;i>max(b,a-b);i--)
//         pans=pans*i;
//     long long int div = fact(min(b,a-b));
//     pans = pans/div;
//     return pans;
// }

vector< vector< int > > g(102);
vector<int> ans;
bool vis[102];

void dfs(int node)
{
    vis[node] =1;
    for(int i=0;i<g[node].size();i++)
    {
        int temp = g[node][i];
        if(vis[temp]==0)
        {
            dfs(temp);
        }
    }
    ans.push_back(node);
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(0);
    cout<<fixed;

#ifndef ONLINE_JUDGE
   // freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    int n,m,k;
    cin>>n>>m>>k;
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            int a;
            if(i>=j)
                a = (m*i)-(i*j)+((n-i)*j);
            else
                a =  (n*j) - (i*j) + ((m-j)*i);
            // cout<<i<<" "<<j<<" = "<<a<<endl;
            if(a==k)
            {
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";
#ifndef ONLINE_JUDGE
   cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif

    return 0;
}   


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
    int n,t,a;
    cin>>n;
    cin>>t>>a;
    float h[1000],temp[1000];
    for (int i=0;i<n;i++){
        cin>>h[i];
    }
    for (int i=0;i<n;i++){
        temp[i]=abs(t-0.006*h[i]-a);
    }
    cout<<distance(temp,min_element(temp,temp+n))+1<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int N = 100010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
 

signed main(){

  int p,r,t;
  cin>>p>>r>>t;
  
  vector<int> LL(r);
  for(int i=0;i<r;i++) cin>>LL[i];

  vector<vector<int> > n(p,vector<int> (r));
  for(int i=0;i<p;i++)
    for(int j=0;j<r;j++) cin>>n[i][j];


  vector<int> P(t),R(t);
  for(int i=0;i<t;i++) cin>>P[i]>>R[i], P[i]--,R[i]--;
  
  
  auto deadLock=[&](int x){
    vector<int> L = LL;
    vector<queue <int> > Q(r);
    vector<vector<int> > cnt(p,vector<int> (r,0));
    
    auto ok = [&](int p){
      for(int i=0;i<r;i++) if(n[p][i] != cnt[p][i]) return 0;
      return 1;
    };

    auto freeL = [&](int p){
      for(int i=0;i<r;i++) L[i] += cnt[p][i], cnt[p][i] = 0;
    };
    
    auto use =[&](){
      int res = 0;
      for(int i=0;i<r;i++){
	if(Q[i].empty()) continue;
	if(L[i] == 0) continue;
	int process = Q[i].front(); Q[i].pop();
	L[i]--, cnt[process][i]++;
	if(!ok(process)) continue;
	freeL(process);
	res = 1;
      }
      return res;
    };
    
    for(int i=0;i<x;i++){
      int pi = P[i];
      int ri = R[i];
      Q[ri].push(pi);
      while(use());
    }
    
    auto sum=[&](int p){
      int res = 0;
      for(int i=0;i<r;i++) res += cnt[p][i];
      return res;
    };

    auto canFree=[&](int p){
      for(int i=0;i<r;i++) if(n[p][i] - cnt[p][i] > L[i]) return 0;
      return 1;
    };

    int update = 1;
    while(update){
      update = 0;
      for(int i=0;i<p;i++){ //process
	if(sum(i) == 0) {continue;}
	if(!canFree(i)) continue;
	update = 1;
	freeL(i);
	while(use());
      }
    }

    for(int i=0;i<p;i++) if(sum(i)) return 1;   
    for(int i=0;i<r;i++) if(!Q[i].empty()) return 1;
    return 0;
  };

  
  int ans = -1;
  {
    int L = 1, R = t+1;
    while(L+1<R){
      int M = (L+R)/2;
      if(deadLock(M)) R = M;
      else L = M;
    }
    ans = R;
    if(R == t+1) ans = -1;
  }

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


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

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

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

void solve(long long H, long long N, vector<long long> A){
    int sum;
    sum = accumulate(A.begin(), A.end(), 0);
    if (sum < H) {
        cout << NO << endl;
    } else {
        cout << YES << endl;
    }

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long H;
    cin >> H;
    long long N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        cin >> A[i];
    }
    solve(H, N, move(A));
}


Measured memory_bytes: 1024
import scala.io.StdIn

object Main {

  def main(args: Array[String]): Unit = {

    val Array(n, h, w): Array[Int] = StdIn.readLine().split(' ').map(_.toInt)
    val abs: Seq[Seq[Int]] =
      (1 to n).foldLeft(Vector(): Vector[Vector[Int]])((acc, _) =>
        acc :+ StdIn.readLine().split(' ').toVector.map(_.toInt))

    println(solve(h, w, abs))

  }

  def solve(h: Int, w: Int, abs: Seq[Seq[Int]]): Int = {

    abs.foldLeft(0)((acc, ab) => {
      val d = if (ab(0) >= h && ab(1) >= w) 1 else 0
      acc + d
    })

  }
}


Measured memory_bytes: 30704
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define translow transform(s.begin(),s.end(),s.begin(),::tolower);
#define transup transform(s.begin(),s.end(),s.begin(),::toupper);
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;
ll n;
 vector<ll>adj[100000];
 
 
       

int main() {
                fast
                // #ifndef ONLINE_JUDGE
                // freopen("input.txt","r",stdin);
                // freopen("output.txt","w",stdout);
                // #endif
                 
                  cin>>n;
vector<ll>ans;
                  ans.resize(n+1,0);
                  vector<ll>adj[n+1];
                  for(ll i=1;i<n;i++)
                  {
                    adj[i].pb(i+1);
                    adj[i+1].pb(i);
                  }
                  ll x,y;
                  cin>>x>>y;
                  adj[x].pb(y);
                  adj[y].pb(x);
                  
                  for(ll i=1;i<=n;i++)
                  {

                   queue<ll>q;
                   ll source=i;
            q.push(source);
            vector<ll>dist(n+1,-1);
            dist[source]=0;
            while(!q.empty())
            {
                ll cn=q.front();
                q.pop();
                for(auto it:adj[cn])
                {
                    if(dist[it]==-1)
                    {
                        dist[it]=dist[cn]+1;
                        q.push(it);
                    }
                }
            }

            for(ll i=1;i<=n;i++)
            {
                ans[dist[i]]+=1;
            }
                  }
                  for(ll i=1;i<n;i++)
                    cout<<ans[i]/2<<" ";


                return 0;
            }

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

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	uint64_t A = 0;
	if (n % 2 == 0) {
		uint64_t a[n];
		for (int i = 0; i < n; i++) {
			cin >> a[i];
			A = A ^ a[i];
		}
		for (int i = 0; i < n; i++) {
			cout << (uint64_t)(A ^ a[i]);
			if (i < n-1)
				cout << " ";
		}
		cout << endl;
	} else {
		for (int i = 0; i < n; i++) {
			int a;
			cin >> a;
			cout << a;
			if (i < n-1)
				cout << " ";
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;


     
#define ll long long int
#define ld long double


#define fr first
#define se second



#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(v) (int)v.size()
#define sunq(v) sort(all(v));v.resize(distance(v.begin(),unique(all(v))))


#define pb push_back
#define mp make_pair

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define emla(a, val) memset(a, val, sizeof(a))

#define easm(a, b) (a + b - 1)/b 


#define PI 3.141592653589793238
#define E  2.718281828459045235


ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a*b/gcd(a,b);}


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

const int N = 1e5 + 10;

int dp[N];
vector<int>ad[N];


int solve(int node){
  int &re = dp[node];
  if(re != -1)return re;
  int mx = 0;
  for(auto u : ad[node])
    mx = max(mx, solve(u));
  re = mx + 1;
  return re;
}


int main(){
  //freopen("input.in", "r", stdin);
  //freopen("output.txt", "w", stdout);
  clock_t z = clock();
  int n, m;
  cin >> n >> m;
  emla(dp, -1);
  for(int i = 0; i < m; i++){
    int x, y;
    cin >> x >> y;
    ad[x].pb(y);
  }
  int mx = 0;
  for(int i = 1; i <= n; i++)
    mx = max(mx, solve(i));
  cout << mx - 1 << endl;
  debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
  /*
  *try tricky test cases:
    -bounds
    -integer overflow
    -small input (0, 1)
    -big input
    -random tests
  */
  return 0;
}

Measured memory_bytes: 8192
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	int N; cin >> N;
	rep (i, N ){
		string s; cin >> s;
		string t; cin >> t;
		int n = s.length();
		int m = t.length();
		for (int i = n - 1; i >= 0; i-- ){
			string u = "", u1 = "", u2 = "";
			char c = s[i];
			switch (c ){
  				case 'J':
					u = t.substr (0, t.length() - 1 );
					u  = t[t.length() - 1 ] + u;
					t = u;
				break;
				case 'C':
					u = t.substr (1 );
					u += t[0];
					t = u;
				break; 
				case 'E':
					if (t.length() % 2 == 0 ){
						u1 = t.substr (0, t.length()/2 );
						u2 = t.substr (t.length()/2 );
						u = u2 + u1;
						t = u;
					}else{
						u1 = t.substr (0, t.length()/2 );
						u2 = t.substr (t.length()/2+1 );
						char mid = t[t.length()/2];
						u = u2 + mid + u1;
						t = u;
					} // end if
				break;
				case 'A':
					reverse (ALL(t ) );
				break;
				case 'P':
					rep (j, m ){
						if (isdigit (t[j] ) ){
							t[j] = (char)((t[j] - '0' + 10 - 1 ) % 10 + '0' );
						} // end if
					} // end rep
				break;
				case 'M':
					rep (j, m ){
						if (isdigit (t[j] ) ){
							t[j] = (char)((t[j] - '0' + 1 ) % 10 + '0' );
						} // end if
					} // end rep
				break;
			} // end switch
		} // end for
		cout << t << endl; 
	} // end for
	
	return 0;
}

Measured memory_bytes: 1212
#include <stdio.h>
int main(){
	char a;
	char b;
	scanf("%c %c", &a, &b);
	
	if(a=='H'){
		if(b=='H'){
			printf("H");
		}
		else{
			printf("D");
		}
	}
	else{
		if(b=='H'){
			printf("D");
		}
		else{
			printf("H");
		}
		
	}
	
	return 0;
}

Measured memory_bytes: 128
# coding: utf-8
n=int(input())
for i in range(n):
    s=list(input())
    st=set()
    for j in range(1,len(s)):
        st.add((''.join(s[:j])+''.join(s[j:])))
        st.add((''.join(s[j:])+''.join(s[:j])))
        st.add((''.join(s[:j][::-1])+''.join(s[j:])))
        st.add((''.join(s[j:][::-1])+''.join(s[:j])))
        st.add((''.join(s[:j])+''.join(s[j:][::-1])))
        st.add((''.join(s[j:])+''.join(s[:j][::-1])))
        st.add((''.join(s[:j][::-1])+''.join(s[j:][::-1])))
        st.add((''.join(s[j:][::-1])+''.join(s[:j][::-1])))
    print(len(st))


Measured memory_bytes: 5644
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> x(n), y(n), h(n);
    rep(i,n) cin >> x[i] >> y[i] >> h[i];
    rep(cy,101){
        rep(cx,101){
            int H;
            rep(i,n){
                if(h[i] > 0){
                    H = h[i] + abs(x[i] - cx) + abs(y[i] - cy);
                    break;
                }
            }
            bool ok = true;
            rep(i,n){
                if(h[i] != max(H - abs(x[i] - cx) - abs(y[i] - cy), 0)){
                    ok = false;
                    break;
                }
            }
            if(ok){
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private Scanner in = new Scanner(System.in);

    void solve() {
        long n = in.nextLong(), k = in.nextLong();
        if(k == 0) {
            System.out.println(n * n);
            return;
        }
        long ans = 0;
        for(long i = 1; i <= n; i++) {
            ans += (n / i) * Math.max(0, (i - k));
            ans += Math.max(0, (n % i) - k + 1);
        }
        System.out.println(ans);
    }
    public static void main(String[] args) {
        new Main().solve();
    }
}


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

int main(){
  int n;
  string a;
  cin >> n >> a;
  
  int i;
  int r = 0, b = 0;
  for (int i = 0; i < n; i++){
  char A = a.at(i);  
    if (A == 'R'){
      r++;
    }
    else {
      b++;
    }
  }
  
if (r > b){
  cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
s, t = gets.chomp.split
sn, tn = gets.chomp.split.map(&:to_i)
u = gets.chomp.to_s

if u == s
  sn -= 1
  printf("#{sn} #{tn}")
elsif u == t
  tn -= 1
  printf("#{sn} #{tn}")
end


Measured memory_bytes: 1788
import sys
n,m=list(map(int,input().split()))
ans=[-1 for i in range(n)]

for i in range(m):
  s,c=list(map(int,input().split()))
  if n!=1 and s==1 and c==0:
    print(-1)
    sys.exit()
  if ans[s-1]==-1 or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    sys.exit()

    
if n==1 and (ans[0]==0 or ans[0]==-1):
  print(0)
  sys.exit()
if ans[0]==-1:
  ans[0]=1
for i in range(1,n):
  if ans[i]==-1:
    ans[i]=0
ans=map(str, ans)
print("".join(ans))

  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n;
  cin >> n;
  vi a(n + 2, 0);
  ll total = 0;
  rep(i, n){
    cin >> a[i + 1];
    total += abs(a[i] - a[i + 1]);
  }
  total += abs(a[n]);
  for(int i = 1; i <= n; i++){
    cout << total + abs(a[i - 1] - a[i + 1]) - abs(a[i] - a[i + 1]) - abs(a[i] - a[i - 1]) << endl;
  }
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
    string str;
    cin >> str;
    auto n = str.length();
    auto d1 = 0;
    auto d2 = 0;
    for (auto i = 0; i < n; i++) {
        auto i1 = i % 2;
        auto i2 = 1 - i1;
        auto x = stoi(str.substr(i, 1));
        d1 += static_cast<int>(abs(static_cast<double>(i1 - x)));
        d2 += static_cast<int>(abs(static_cast<double>(i2 - x)));
    }
    auto m = min({d1, d2});
    cout << m;
}

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

int main(){
  int h1,m1,s1,h2,m2,s2;
  int ans1,ans2,newans;
  int h_ans,m_ans,s_ans;
  for(int i=0;i<3;i++){
    ans1=0,ans2=0,h_ans=0,m_ans=0,s_ans=0;
    cin >> h1 >> m1 >> s1;
    cin >> h2 >> m2 >> s2;
    ans1 += h1 * 3600 + m1 * 60 + s1;
    ans2 += h2 * 3600 + m2 * 60 + s2;
    newans = ans2 - ans1;
    while(newans != 0){
      while(newans >= 3600){
	h_ans++;
	newans -= 3600;
      }
      while(newans >= 60){
	m_ans++;
	newans -= 60;
      }
      while(newans >= 1){
	s_ans++;
	newans -= 1;
      }
    }
    cout << h_ans << " " << m_ans << " " << s_ans << endl;
  }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define WR "txt"
#define N 100

void Open() { freopen(WR".in", "r", stdin); freopen(WR".out", "w", stdout); }
void Close() { fclose(stdin); fclose(stdout); }
using namespace std;
int Read()  {
	int val = 0, opt = 1; char ch;
	while (!isdigit(ch = getchar() )) if (ch == '-') opt = -1;
	while (isdigit( ch )) (val *= 10) += ch - '0', ch= getchar();
	return val * opt;
}

int a[N], n, k, Ans, f[N];

int Chose(int t)  {
	int Sum = 0;
	sort(f + 1, f + 1 + k - t);
	for (int i = 1;i <= k - t; i++)
		Sum += f[i];
	t = min(t, k - t);
	for (int i = 1;i <= t; i++)
		if (Sum - f[i] > Sum) Sum = Sum - f[i];
	return Sum;
}

int Take(int t)  {
	int Max = 0, p;
	for (int i = 0;i <= t; i++)  {
		p = 0;
		for (int j = 1;j <= n; j++)  {
			if (j <= i) f[++p] = a[j];
			if (n - (t - i) + 1 <= j) f[++p] = a[j];
		}
		Max = max(Max, Chose(k - t));
	}
	return Max;
}

void work()  {
	n = Read(), k = Read();
	for (int i = 1;i <= n; i++)
		a[i] = Read();
	int t = min(k, n);
	for (int i = 1;i <= t; i++)
		Ans = max(Ans, Take(i));
	printf("%d", Ans);
}

int main(void)  {
	//Open();
	work();
	//Close();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  char hyou[9][5]={
    {' ','.',',','!','?'},
    {'c','a','b','0','0'},
    {'f','d','e','0','0'},
    {'i','g','h','0','0'},
    {'l','j','k','0','0'},
    {'o','m','n','0','0'},
    {'s','p','q','r','0'},
    {'v','t','u','0','0'},
    {'z','w','x','y','0'}
  };
  string a;
  int n,b=1;
  cin>>n;
  for(int i=0;i<n;i++){
    b=1;
    cin>>a;
    if(a.size()==1)cout<<hyou[a[0]-'0'][1];
    int size=a.size();
    for(int j=0;j<size-1;j++){
      if(a[j]=='0'){
	b=1;
	continue;
      }
      if(a[j]==a[j+1])b++;
      else{
	if(a[j]=='7'||a[j]=='9')b%=4;
	else if(a[j]=='1')b%=5;
	else b%=3;
	cout<<hyou[a[j]-'0'-1][b];
      }
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3136
N = int(input())

stairs = list(map(int, input().split())) + [0]
for i in range(N-1):
    if stairs[i + 1] - stairs[i] < 0:
        stairs[i] -= 1
    elif stairs[i + 1] - stairs[i] == 0 and stairs[i] - stairs[i-1] > 0:
        stairs[i] -= 1

del stairs[-1:]
new_stairs = sorted(stairs)
if new_stairs == stairs:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14224
import java.util.Scanner;

public class Main {

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

		while(sc.hasNext()) {
				for(int i = 0; i < nums.length; i++) {
					nums[i] = sc.nextDouble();
				}

			simuEqu(nums);
		}

		sc.close();
	}

	private static void simuEqu(double[] nums) {
		double a = nums[0]; /* x + */ double b = nums[1]; /* y = */ double c = nums[2];
		double d = nums[3]; /* x + */ double e = nums[4]; /* y = */ double f = nums[5];

		double x = ( c * e - f * b )/ ( a * e - b * d );

		double y = ( c - a * x ) / b;

		if (x == 0.0) {
			x = 0.0;
		}

		if (y == 0.0) {
			y = 0.0;
		}

		System.out.printf("%.3f %.3f\n",x ,y);
	}



}



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

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}

auto factor(int n){
  map<int,int>res;
  for(int i=2;i*i<=n;i++){
      for(; n%i==0;n/=i) res[i]++;
  }
  if(n>1)res[n]++;
  return res;
}
////////////////////////////////////////////////////////////
signed main() {
  int n;
  cin>>n;
  vector<int>v(100001);
  rep(i,n){
    int t;
    cin>>t;
    v[t]++;
  }
  int kaburi=0;
  rep(i,100001)
    if(v[i]>1)kaburi+=v[i]-1;
  cout<<n-(kaburi+1)/2*2<<endl;
}


Measured memory_bytes: 4032
alfa = ["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"]
S = [i for i in input()]
for s in set(S):
    if s in alfa:
        alfa.remove(s)
if len(alfa)==0:
    print("None")
else:
    print(alfa[0])

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

typedef long long ll;
typedef unsigned long long ull;

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

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

  vector<ll> dp(n+10, INT_MAX);
  dp[0] = 0;
  for (ll i = 1; i < n; ++i) {
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
    if (i > 1) {
      dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
  }

  cout << dp[n-1] << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,b,a) for(int i=(b);i>=(a);i--)
#define len(a) int((a).size())
using namespace std;
using LL = long long;
using PII = pair<int, int>;

int main() {
    int n;
    scanf("%d", &n);
    vector<int> A;
    while (n) {
        A.push_back(n%10);
        n /= 10;
    }
    if (A[0] == A[1] && A[1] == A[2] || A[1] == A[2] && A[2] == A[3]) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
//_____
#define rep(i,n) for(int i=0; i<(n); ++i)
#define reps(i,f,n) for(int i=(f); i<=(n); ++i)
#define outl(x) cout << (x) << '\n'
#define FAST() cin.tie(0), ios::sync_with_stdio(false)
template<class A, class B>inline bool chmax(A &a, B b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, B b){return b<a ? a=b,1 : 0;}
//_______


int slv(string &a, string &b)
{
   const int alen = a.size();
   const int blen = b.size();
   int dp[1005][1005] = {};
   a = ' ' + a;
   b = ' ' + b;
   int ret = 0;

   reps(i, 1, alen){
      reps(j, 1, blen){
         if(a[i] == b[j]){
            dp[i][j] = dp[i-1][j-1] + 1;
         } else {
            dp[i][j] = max(dp[i-1][j] , dp[i][j-1] );
         }
         chmax(ret, dp[i][j]);
      }
   }
   return(ret);
}

signed main()
{
   FAST();
   int N;
   string a,b;
   cin >> N;
   rep(i, N){
      cin >> a >> b;
      outl( slv(a, b) );
   }
}




Measured memory_bytes: 7184
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,j,A[500005],t;
string s;  
int main() {
           cin>>a>>b;
           for(long long i=1;i<=100000;i++) {
                      if((i*8)/100==a && (i*10)/100==b) { cout<<i; return 0; }
           }
           cout<<-1;
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

import copy
N = int(input())
A = [0] * N
for i in range(N):
  a, b = map(int, input().split())
  A[i] = [i, a, b]

B = copy.deepcopy(A)  
A = sorted(A, key = lambda x:x[1])
B = sorted(B, key = lambda x:x[2])
#print(A, B)

#それぞれの辺のながさを求めて、小さい順にする
#[点の番号、点の番号、２点間距離]
A2 = [0] * (N - 1)
for i in range(1, N):
  l = abs(A[i][1] - A[i - 1][1])
  A2[i - 1] = [A[i][0], A[i - 1][0], l]

B2 = [0] * (N - 1)
for i in range(1, N):
  l = abs(B[i][2] - B[i - 1][2])
  B2[i - 1] = [B[i][0], B[i - 1][0], l]  
Len = A2 + B2
Len = sorted(Len, key = lambda x:x[2])
#print(Len)

data = UnionFind(N + 1)
cost = 0
for i in range(len(Len)):
    if not data.same_check(Len[i][0], Len[i][1]):
      data.union(Len[i][0], Len[i][1])
      cost += Len[i][2]

  
print(cost)  
  
  

  

Measured memory_bytes: 75860
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define flush fflush(stdout)
#define debug printf("Hello\n")
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
int n, m, k, x, y, cnt;
ll ans;
double a, sum;
int main () {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  FOR(i,1,n) {
    cin >> a;
    sum += 1.0/a;
  }
  cout << fixed<<setprecision(10)<<1.0/sum<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
    #include<math.h>
    #include<stdlib.h>
     
    //D日目時点のスコアを計算
    int score(int D, int c[], int s[][26], int t[]){
        int pen_day[26]={1};
        for(int i=0; i<26; i++){
            pen_day[i]=1;
        }
        int score=0;
        
        for(int i=0; i<D; i++){
            int type=t[i]-1;
            pen_day[type]=0;
            //満足度増加
            score+=s[i][type];
            //満足度低下
            for(int j=0; j<26; j++){
                int dec=c[j]*pen_day[j];
                score-=dec;
            }
            //日数追加
            for(int j=0; j<26; j++){
                pen_day[j]++;
            }        
        }
        return score;
    }
     
    void Greedy(int D, int c[], int s[][26]){
        int t[D], max_type=0, max_score=0;
     
        for(int i=0; i<D; i++){
            max_score=0;
            for(int j=0; j<26; j++){
                t[i]=j+1;
                int S=score(i+1, c, s, t);
                if(max_score < S){
                    max_score = S;
                    max_type=j+1;
                }
            }
            t[i]=max_type;
        }
     
        //局所探索
        int new=0;
        int roop_num=0;
        int MAX=max_score;
        while(1){
            int a=rand()%D;
            int b=rand()%D;
     
            //a,bを入れ替え
            int tmp;
            tmp=t[a];
            t[a]=t[b];
            t[b]=tmp;
     
            //scoreを計算
            int now_score=score(D, c, s, t);
            if(MAX<now_score) MAX=now_score;
            else{
                tmp=t[a];
                t[a]=t[b];
                t[b]=tmp;  
            }
            new++;
            roop_num++;
            if(roop_num==D*50) break;
        }
     
        for(int i=0; i<D; i++){
            printf("%d\n", t[i]);
        }
    }
     
    int main(void){
        int D, c[26], s[365][26], t[365];
     
        //入力
        scanf("%d", &D);
        for(int i=0; i<26; i++){
            scanf("%d", &c[i]);
        }
        for(int i=0; i<D; i++){
            for(int j=0; j<26; j++){
                scanf("%d", &s[i][j]);
            }
        }
        /*
        for(int i=0; i<D; i++){
            scanf("%d", &t[i]);
        }
        */
     
       /*ここから処理*/
       /*
        int num=1;
        for(int i=0; i<D; i++){
            printf("%d\n", num);
            num++;
            if(num>26) num=1;
        }
        */
     
       Greedy(D, c, s);
     
     
        return 0;
    }

Measured memory_bytes: 1756
#include<iostream>
using namespace std;
long long a,b,c,aa,bb,cc;
bool fuck(int a,int b,int c)
{
	return ((a&1) || (b&1) || (c&1));
}
int main()
{
	cin>>a>>b>>c;
	for (int i=1;i<=1000000;i++)
	{
		if (fuck(a,b,c)) 
		{
			cout<<i-1<<endl;
			return 0;
		}
		aa=(b+c)/2;
		bb=(a+c)/2;
		cc=(a+b)/2;
		a=aa;b=bb;c=cc;
	}
	cout<<-1<<endl;
	return 0;
}

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

int main(){
int a,b,c;
cin>>a>>b>>c;
int go=0,shichi=0;

if(a==5) go++;
else if(a==7) shichi++;
if(b==5) go++;
else if(b==7) shichi++;
if(c==5) go++;
else if(c==7) shichi++;

if(go==2 && shichi==1) cout<<"YES";
else cout<<"NO";
}

Measured memory_bytes: 256