akhauriyash/Code-Regression huggingface dataset:
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int inf = 1e9 + 7;
const ll mod = 1e9 + 7;

bool cal(int x) {
	int keta = 0;
	while (x) {
		++keta;
		x /= 10;
	}
	return keta%2 == 1;
}

int main() {
	int n;
	cin >> n;
	int cnt = 0;
	REP(i, 1, n+1) {
		if (cal(i)) ++cnt;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int A, B, x; 
  cin >> A >> B >> x;

  if(A != 0) cout << B/x-(A-1)/x << "\n";
  else cout << B/x+1 << "\n";

  return 0;
}

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

int main()
{
    int n, a = 0;

    cin >> n;

    string s;

    bool j = true;
    for( int i = 0; i < n; i++ )
    {
        cin >> s;
        if( s == "A" )
            a++;
        else
            a--;
        if( a < 0 )
            j = false;
    }

    if( a == 0 && j == 1 )
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 3152
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    A = list(map(int, input().split()))
    node_count = [0] * (N+1)
    for i, a in enumerate(A[::-1]):
        if i == 0:
            node_count[N] = a
            continue
        node_count[N-i] = node_count[N-i+1] + a
    can_build = True
    for i, a in enumerate(A):
        if i == 0:
            if N > 0 and a > 0:
                can_build = False
                break
            if N == 0 and a > 1:
                can_build = False
                break
            node_count[0] = min(node_count[0], 1)
            continue
        if (i < N and a >= node_count[i-1]*2) or (i == N and a > node_count[i-1]*2):
            can_build = False
            break
        node_count[i] = min(node_count[i], node_count[i-1]*2-A[i-1]*2)
    if can_build:
        ans = sum(node_count)
    else:
        ans = -1
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 82900
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define   ull unsigned long long 
#define mp make_pair
#define pb push_back
const int MAX=2e5+9;
const long long mod=1e9+7;
using namespace std;
vector<int>adj[MAX];
int main(){
	int n;
	cin>>n;
	int f=0;
	int arr[2*n+7];
	for(int i=1;i<=n;i++)
		cin>>arr[i];
	int b[2*n+6];
	memset(b, 0 , sizeof(b));
	for(int i=n;i>=1;i--){
		int tot=0;
		for(int j=i;j<=n;j=j+i){
			tot=tot+b[j];
		}
		if((tot%2)!=(arr[i]))
			b[i]++;

		
	}
	 f=0;
		vector<int>v;
		for(int i=1;i<=n;i++){
			if(b[i]>1)
				f=1;
			else if(b[i]==1)
				v.push_back(i);

		}
		if(f)
			cout<<-1;
		else{
		cout<<v.size()<<"\n";
		for(int i=0;i<v.size();i++)
			cout<<v[i]<<" ";
	}


}

Measured memory_bytes: 8568
#include <stdio.h>

int main(void)
{
  int r,c,i,j,cell[101][101]={0};

  scanf("%d %d",&r,&c);

  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      scanf("%d",&cell[i][j]);
    }
  }

  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      cell[i][c]+=cell[i][j];
    }
  }

  for(j=0;j<=c;j++){
    for(i=0;i<r;i++){
      cell[r][j]+=cell[i][j];
    }
  }

  for(i=0;i<=r;i++){
    for(j=0;j<=c;j++){
      if(j==c){
      printf("%d\n",cell[i][j]);
      }
      else{
	printf("%d ",cell[i][j]);
      }
    }
  }

  return 0;
}

Measured memory_bytes: 648
N = int(input())
 
i=1
x = 0
 
while True:
  m = 10 ** i - 1
  if N <= m:
    x += max((N - (10 ** (i-1) - 1)), 0)
    break
  x += (m - (10 ** (i-1) - 1))
  i += 2
print(x)

Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(10 ** 6)
readline = sys.stdin.readline

N, M = map(int, readline().split())
ans = [0] * (N + 2)
ans[0] = 1
for _ in range(M):
    a = int(readline())
    ans[a] = -1

for i in range(1, N + 1):
    if ans[i] == -1:
        continue
    a1 = max(ans[i - 2], 0)
    a2 = max(ans[i - 1], 0)
    ans[i] = a1 + a2

print(ans[N] % (10 ** 9 + 7))


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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
bool chmin(T &a,T b){if(a>b){a=b;return true;}else return false;}
template<typename T>
bool chmax(T &a,T b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  string s;cin>>s;
  ll n=s.size();
  rep(i,0,n){
    if(i%2==0&&s.substr(i,2)!="hi")judge=false;
  }
  ans1(judge);
  return 0;
}

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

using namespace std;

const int MAXN = 100010;
const int MAXD = 110;
const int MOD = 1000000007;

int N, D;
string S;
int dp[MAXN][MAXD][2];


int main() {

	cin >> S;
	cin >> D;
	N = S.length();

	dp[0][0][0] = 1;

	for (int i = 1; i <= N; i++) {
		for (int mod = 0; mod < D; mod++) {
			int last_digit = S[i - 1] - '0';
			for (int digit = 0; digit <= 9; digit++) {
				int sum = (mod + digit) % D;
				dp[i][sum][1] = (dp[i][sum][1] + dp[i - 1][mod][1]) % MOD;
			}

			for (int digit = 0; digit < last_digit; digit++) {
				int sum = (mod + digit) % D;
				dp[i][sum][1] = (dp[i][sum][1] + dp[i - 1][mod][0]) % MOD;
			}
			int sum = (mod + last_digit) % D;
			dp[i][sum][0] = (dp[i][sum][0] + dp[i - 1][mod][0]) % MOD;
		}
	}
	int64_t ans = (dp[N][0][0] + dp[N][0][1]) % MOD;
	if (ans == 0) ans = MOD - 1;
	else ans --;
	cout << ans;
	return 0;
}

Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
	int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

const int MAXN = 1e5;
int n, m, sum, ans, pre[MAXN + 5];

int main() {
	read(n), read(m);
	for (int l, r, i = 1; i <= m; ++i) {
		read(l), read(r);
		++pre[l], --pre[r + 1];
	}
	for (int i = 1; i <= n; ++i) {
		sum += pre[i]; 
		if (sum == m) ++ans;
	}
	write(ans);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1'000'000'007;
constexpr ll mod2 = 998244353;
const double PI = 3.14159265358;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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 N,M;
vector<vector<int>> G;
vector<int> ans;
vector<bool> dist;

void dfs(int v){
  for(int nv: G[v]){
    if(dist[nv]) continue;
    dist[nv] = true;
    ans.emplace_back(nv);
    dfs(nv);
    break;
  }
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> M;
  G.resize(N);
  for(int i=0; i<M; i++){
    int a,b;
    cin >> a >> b;
    a--;b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  dist = vector<bool>(N,false);
  dist[0] = true;
  dfs(0);
  reverse(ans.begin(),ans.end());
  ans.emplace_back(0);
  dfs(0);
  cout << ans.size() << "\n";
  for(int i=0; i<ans.size(); i++){
    cout << ans[i]+1 << " \n"[i+1==ans.size()];
  }
  return 0;
}

Measured memory_bytes: 11880
with open(0) as f:
    N, *a = map(int, f.read().split())
Set = set()
free = 0
for x in a:
    x //= 400
    if x < 8:
        Set.add(x)
    else:
        free += 1

Ans = [max(1, len(Set)), len(Set)+free]
print(*Ans)


Measured memory_bytes: 9036
package main
import("fmt")

func main(){
  var n int
  fmt.Scanf("%d",&n)
  
  a:=make([]float64,n)
  s:=0.0
  for i:=0; i<n; i++{
    fmt.Scanf("%f",&a[i])
    a[i]=1.0/a[i]
    s+=a[i]
  }
  var answer float64
  answer = 1.0/s
  fmt.Printf("%f",answer)
}

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

int main() {
  int N; cin >> N;
  if(N<10) cout << N << endl;
  else if(N<100) cout << 9 << endl;
  else if(N<1000) cout << 9 + (N-99) << endl;
  else if(N<10000) cout << 909 << endl;
  else if(N<100000) cout << 909 + (N-9999) << endl;
  else cout << 90909 << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

    int n;
    cin >> n;

    bool flg = true;
    rep(_, n){
        int a;
        cin >> a;
        if(a%2==0){
            if(a%3==0 || a%5==0){
                flg = flg && true;
            }
            else{
                flg = false;
            }
        }
    }
    if(flg) puts("APPROVED");
    else puts("DENIED");

    return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll M[505][505];

int main()
{
    ll H, W, h, w;
    cin >> H >> W >> h >> w;
    memset(M, 0, sizeof(M));
    ll t =1000;
    ll s = -1 * ((h * w - 1) * t + 1);
    for (int i = 1; h * i <= H; ++i)
    {
        for (int j = 1; w * j <= W; ++j)
        {
            M[h * i - 1][w * j - 1] = s;
        }
    }
    REP(i, H)
    {
        REP(j, W)
        {
            if (M[i][j] == 0)
                M[i][j] = t;
        }
    }

    ll sum = 0;
    REP(i, H)
    {
        REP(j, W)
        {
            sum += M[i][j];
        }
    }

    if (sum > 0)
    {
        cout << "Yes" << endl;
        REP(i, H)
        {
            REP(j, W)
            {
                cout << M[i][j] << " ";
            }
            cout << endl;
        }
    }
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3584
object Main extends App {
    val in = io.Source.stdin.getLines
    for (n <- in if n != "0") {
        val dic = in.take(n.toInt).map{r => val Array(k, v) = r.split(" "); (k, v)}.toMap
        println(in.take(in.next.toInt).map(k => dic.getOrElse(k, k)).mkString)
    }
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    vector<vector<int> > c(3, vector<int>(3));
    rep(i,3)
    {
        rep(j,3)
        {
            cin >> c[i][j];
        }
    }

    rep(i,2)
    {
        int key = c[i][0] - c[i+1][0];
        rep(j,3)
        {
            if( key != c[i][j] - c[i+1][j] )
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}


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

ll n,m;
ll x[100010];

class UnionFind{
    public:
    //親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<ll> parent;

    UnionFind(ll N){
        parent = vector<ll>(N);
        for(ll i=0;i<N;i++) parent[i] = -x[i];
    }

    ll root(ll A){
        if(parent[A] < 0) return A;
        return parent[A]=root(parent[A]);
    }

    ll size(ll A){
        return -parent[root(A)];
    }

    bool unite(ll A, ll B) {
        A = root(A), B = root(B);
        if(A == B) return false; 

        if(size(A) < size(B)) swap(A,B);
        parent[A] += parent[B];
        parent[B] = A;
        return true;
    }

    bool same(ll A, ll B){
        return root(A)==root(B);
    } 
};

vector<vector<array<ll,3>>> v(100010);

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

    cin>>n>>m;
    for(ll i=0;i<n;i++){
        cin>>x[i];
    }
    array<ll,3> a[m];
    for(ll i=0;i<m;i++){
        ll u,t,s;
        cin>>u>>t>>s;
        u--,t--;
        a[i] = {s,t,u};
    }
    sort(a,a+m);
    for(ll i=0;i<m;i++){
        v[a[i][1]].push_back({a[i][2],a[i][0],i});
        v[a[i][2]].push_back({a[i][1],a[i][0],i});
    }
    UnionFind uni(n);
    bool pos[m]={};
    for(ll i=0;i<m;i++){
        uni.unite(a[i][1],a[i][2]);
        if(uni.size(a[i][1]) >= a[i][0]) pos[i] = 1;
    }
    bool used[m] = {};
    for(ll i=m-1;i>=0;i--){
        if(used[i]) continue;
        if(pos[i]){
            used[i] = 1;
            queue<ll> q;
            q.push(a[i][1]);
            q.push(a[i][2]);
            while(q.size()){
                ll p = q.front(); q.pop();
                for(auto j:v[p]){
                    if(!used[j[2]] && j[1] <= a[i][0]){
                        used[j[2]]=1;
                        q.push(j[0]);
                    }
                }
            }
        }
    }
    ll ans = 0;
    for(ll i=0;i<m;i++){
        if(!used[i]) ans++;
    }
    cout << ans << endl;

}

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

int main() {
  string s;
  cin >> s;
  vector<int> ci;
  vector<int> fi;
  for (int i=0; i<s.size(); i++) {
    if (s[i] == 'C') ci.push_back(i);
    if (s[i] == 'F') fi.push_back(i);
  }
  sort(ci.begin(), ci.end());
  sort(fi.begin(), fi.end());

  if (ci.size() == 0 || fi.size() == 0) cout << "No" << endl;
  else if (ci[0] > fi[fi.size()-1]) cout << "No" << endl;
  else cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    import numpy as np
    n, k = map(int, input().split())
    h = list(map(int, sys.stdin.readline().split()))
    h = np.array(h, dtype=np.int32)
    ans = np.array([10**9] * n, dtype=np.int32)
    ans[0] = 0
    for i in range(n):
        ans[i:i+k+1] = np.minimum(ans[i:i+k+1], ans[i]+np.abs(h[i:i+k+1]-h[i]))

    print(ans[n-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 22852
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <map>
# include <stack>
using namespace std;
//# define M_PI 3.141592
# define INF ((int)(1<<30))
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 

class Point
{
public:
	double x, y;

	Point(double x = 0, double y = 0) :x(x), y(y) {}


	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double k) { return Point(x * k, y * k); }
	Point operator / (double k) { return Point(x / k, y / k); }
	bool operator < (const Point &p)const { return x != p.x ? x < p.x : y < p.y; }
	bool operator ==(const Point &p)const { return fabs(x - p.x) < EPS&&fabs(y - p.y) < EPS; }

	double abs() { return sqrt(norm()); }
	double norm() { return x*x + y*y; }
};
typedef Point Vector;
struct Segment
{
	Point p1, p2;
};
typedef Segment Line;
class Circle
{
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) :c(c), r(r) {}
};

double dot(Vector a, Vector b) { return a.x*b.x + a.y*b.y; }//??????
double cross(Vector a, Vector b) { return a.x*b.y - a.y*b.x; }//??????
bool isOrthogonal(Vector a, Vector b) { return fabs(dot(a, b)) < EPS; }//??´??????
bool isOrthogonal(Point a1, Point a2, Point b1, Point b2) { return isOrthogonal(a1 - a2, b1 - b2); }
bool isOrthogonal(Line l1, Line l2) { return fabs(dot(l1.p2 - l1.p1, l2.p2 - l2.p1)) < EPS; }
bool isParallel(Vector a, Vector b) { return fabs(cross(a, b)) < EPS; }//?????????
bool isParallel(Point a1, Point a2, Point b1, Point b2) { return isParallel(a1 - a2, b1 - b2); }
bool isParallel(Line l1, Line l2) { return fabs(cross(l1.p2 - l1.p1, l2.p2 - l2.p1)) < EPS; }
Point project(Line s, Point p)
{
	Vector base = s.p2 - s.p1;
	double r = dot(p - s.p1, base) / base.norm();
	return s.p1 + base*r;
}


int main()
{
	int n; cin >> n;
	while (n--)
	{
		int h, m;
		scanf("%d:%d", &h, &m);
		double r1, r2;
		r1 = 360.0 / 60.0 * (double)m;
		r2 = 360.0 / 12.0*(double)h;
		r2 += 360.0 / 12.0*(double)m/60.0;
		double d = fabs(r1 - r2);
		d = min(d, fabs(360.0 - d));
		if (d < 30.0)cout << "alert" << endl;
		else if (d < 90.0)cout << "warning" << endl;
		else cout << "safe" << endl;
	}
}

Measured memory_bytes: 3120
s = input()
s_each = list(s)
count = 0
c = int (len(s) / 2 )
#print(c)
#print (s_each)

if len(s) % 2 == 0 :
    for i in range(c) :
        if s_each[i] != s_each[-1-i]:
            count += 1

else :
    for i in range(c) :
        if s_each[i] != s_each[-1-i] :
            count += 1

print (count)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = 1LL<<59;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

void solve() {
    str s;
    cin >> s;
    map<char, ll> mp;
    mp['a']=0;
    mp['b']=0;
    mp['c']=0;
    REP(i, s.size()) {
        mp[s[i]]++;
    }
    ll mx = -INF, mn = INF;
    for(auto &p: mp){
        mx = max(mx, p.second);
        mn = min(mn, p.second);
    }
    if(mx - mn <= 1) {
        out("YES");
    }else {
        out("NO");
    }
}

int main() {
    fast_io;
    solve();
    return 0;
}


Measured memory_bytes: 512
from math import isinf

V,E = map(int, input().split())
a,b = [0]*E, [0]*E
for i in range(E):
    ai,bi = map(int, input().split())
    a[i],b[i] = ai-1, bi-1
    
ans = 0
for l in range(E):
    d = [[float('inf')]*V for _ in range(V)] # 各頂点間距離
    for i in range(V):
        d[i][i] = 0
    for i in range(E):
        if i==l: continue 
        d[a[i]][b[i]] = 1
        d[b[i]][a[i]] = 1
        
    # ワーシャルフロイド
    for k in range(V):
        for i in range(V):
            for j in range(V):
                if d[i][j] > d[i][k]+d[k][j]:
                    d[i][j] = d[i][k]+d[k][j]
    bridge = False
    # print(a[l], b[l], d[0])
    for dd in d[0]:
        if isinf(dd): bridge=True
    if bridge:
        ans += 1
        
print(ans)

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

long long int sum_xor(auto x){
  if(x % 4 == 0) return x;
  if(x % 4 == 1) return 1LL;
  if(x % 4 == 2) return x + 1;
  if(x % 4 == 3) return 0LL;
}

int main(){
  long long int a, b; cin >> a >> b;
  
  long long int ans = sum_xor(a - 1) ^ sum_xor(b);
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define mod2 998244353
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define sz(v) ((ll)(v).size())
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	#define dbg(a) cout<<#a<<" --> "<<(a)<<"\n";
	#define forn(i,n) for (ll i=0; i<(n); ++i)
	#define fornd(i,n) for (ll i=(n)-1; i>=0; --i)
	#define forab(i,a,b) for (ll i=(a); i<=(b); ++i)
	#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
	using namespace std;
	bool isPowerOfTwo(int x) {
    return x && (!(x & (x - 1)));
	}
	int takemod(int x) {
    return (x % mod + mod) % mod;
	}
	int fpow(int base, int power, int MOD) {
    int result = 1;
    base = base % MOD;
    while (power) {
        if (power & 1)
            result = (result * base) % MOD;
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result;
	}
 
	int modinv(int x) {return fpow(x, mod - 2, mod);}
	void solve()
	{
		string A,B;
		cin>>A>>B;
		ll n=A.length();
		ll ans=0;
		forn(i,n)
		{
			if(A[i]!=B[i])
				ans++;
		}
		cout<<ans<<endl;
	}

	int main()
	{	
		#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		#endif
		fast_io;
		int T=1;
//		cin>>T;
		// cin.ignore(); must be there when using getline(cin, s)
		while(T--)
		{
			solve();
		}
		return 0;
	}


Measured memory_bytes: 3828
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <array>
#include <string>
#include <tuple>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>

/* ----- Type Alias ----- */
using Int = long long int;
using Real = long double;
using std::array;
using std::pair;
using std::string;
using std::tuple;
using std::vector;
template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return vector<decltype(genv<T>(ts...))>(l, genv<T>(ts...));
}

template <class Cost = Int>
struct Edge {
    Int src, dst;
    Cost cost;
    Edge(Int src = -1, Int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = Int>
using Edges = vector<Edge<Cost>>;
template <class Cost = Int>
using Graph = vector<vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    Int precision;
    Fout(Int precision) : precision(precision) {}
};
std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}


/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// const Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

int main() {
    int h, w, a, b;
    std::cin >> h >> w >> a >> b;
    for (int x = 0; x < h; ++x) {
        for (int y = 0; y < w; ++y) {
            std::cout << ((x < b) == (y < a));
        }
        std::cout << std::endl;
    }
    return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<stdlib.h>
int main(){
  int a,min,max=0,i;
  int *b;
  scanf("%d",&a);
  b=(int *)malloc(sizeof(int) * a);
  for(i=0;i<a;i++){
    scanf("%d",&b[i]);
  }
  min=b[0];
  max=b[1]-b[0];
  for(i=1;i<a;i++){
    if(max<b[i]-min)max=b[i]-min;
    if(min>b[i])min=b[i];     
  }
  printf("%d\n",max);
  return 0;
}




Measured memory_bytes: 2524
#include<stdio.h>
#define MIN -1000000
#define MAX  1000000

int main(void)
{
    int a, n, min, max;
    long long sum;      /* sum: 合計値は最大11桁になるので 64 bit 必要*/
    
    scanf("%d", &n);
    min = MAX;
    max = MIN;
    sum = 0;
    
    for ( ; n > 0; --n) {
        scanf("%d", &a);

        sum += a;
        if ( a < min)
            min = a;
        if ( a > max)
            max = a;
    }
    
    printf("%d %d %ld\n", min, max, sum);
    
    return 0;
}


Measured memory_bytes: 2112
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

a,b=map(int,input().split())
ans=1
while ans*8//100!=a or ans//10!=b:
    ans+=1
    if ans>2*10**5:
        print(-1)
        exit()
print(ans)

Measured memory_bytes: 69668
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {

	/*	String S = null;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			S = br.readLine();
			br.close();
		} catch (IOException e) {

		}
		int s = Integer.parseInt(S);
		int s2 = s % 60;
		int h = s / 3600;
		int m = s % 3600 / 60;
		System.out.println(h + ":" + m + ":" + s2);
		/*
		 
	/
	

/*
S = 60 * 60 * h + 60 * m + s

String S = null
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			S = br.readLine();
			br.close();
		} catch (IOException e) {
System.out.println(h + ":" + m + ":" + s);

SはコンソールにするからSystem.out.printlnとString　＝null
で表す

S=3600s
h=s/3600
m=s%3600/60

int s = Integer.parseInt(S)
int h = s/3600
int m = s%3600/m
*/

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input = null;
		try {
			input = br.readLine();
			br.close();
		} catch (IOException e) {
		}

		String [] ab = input.split(" ");

		int a = Integer.parseInt(ab[0]);
		int b = Integer.parseInt(ab[1]);
		
		/*
		 System.out.println((a + b) * 2);/
		System.out.println(a * b);
		
		*/
		 
		System.out.println(a * b + " " + (a + b) * 2);
		

	}
}



Measured memory_bytes: 24248
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
 
signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);
  
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  sort(a.begin(), a.end(), greater<int>());

  int b = 0,c = 0;

  REP(i, a.size() - 1){
    if(a[i] == a[i + 1]){
      if(b == 0) b = a[i];
      else if(c == 0)c = a[i];
      else break;
      i++;
    }
  }

  cout << b * c << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <math.h>
#include <stdio.h>
int factor(int n,int i){
    int ans=0,temp=i;
    while(n/i!=0){
        ans+=n/i;
        i*=temp;
    }
   // printf("%d %d\n",i,ans);
    return ans;
}
int main(void){
    int n;
    scanf("%d",&n);
    int i,j,flag;
    long long int ans=1;
    for(i=2;i<=n;i++){
        flag=1;
        //iが素数であるか否か判定
        for(j=2;j<=sqrt(i);j++){
            if(i%j==0){
                flag=0;
                break;}
        }
        //iが素数であるのならば
        if(flag==1){
            ans=(ans*(factor(n,i)+1))%1000000007;
        }
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)
#define dep(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)
#define fec(i,a) for(__typeof a.begin() i=a.begin();i!=a.end();++i)
#define For(i,u) for(int i=H[u];i;i=nxt[i])
#define re(i,a,b) for (int i=a;i<b;++i)
#define si(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
template<class T> inline void read(T&x){char c;bool fu=0;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x*=-1;}
template<class T> inline void read(T&x,T&y){read(x);read(y);}
template<class T> inline void read(T&x,T&y,T&z) {read(x,y);read(z);}
typedef long long ll;
typedef pair<int,int> pii;
const int N=111111;
//head
ll ans=0;
int n;
char s[15];
int a[15];
void dfs(int x,ll y,ll an){
	if(x>n){if(y==0)ans+=an;return;}
	dfs(x+1,y*10+a[x+1],an);
	dfs(x+1,a[x+1],an+y);
}
int main() {
	scanf("%s",s+1);n=strlen(s+1);
	rep(i,1,n)a[i]=s[i]-'0';
	dfs(1,a[1],0);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
static const ll mod = 1000000007;
/* ちゃんと考えて実装して問題なくACできた時嬉しいよ！！ */

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int ans = min(c, b/a);
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>


int main()
{
char s[5];

scanf("%s",s);

  

if('R'==s[1])
{
    printf("ABC");
}
if('B'==s[1])
{
  printf("ARC");
}
return 0;
}

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

#define ll long long;
#define pb push_back;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m;cin>>n>>m;
    cout<<((n*(n-1))/2)+((m*(m-1))/2);
    return 0;
}

Measured memory_bytes: 256
from collections import Counter

N, M = map(int, input().split())
A = [0] + list(map(int, input().split()))

for i in range(1, N+1):
    A[i] += A[i-1]
    A[i] %= M

CA = Counter(A)
ans = 0
for value in CA.values():
    ans += value * (value - 1) // 2
print(ans)

Measured memory_bytes: 85828
from math import *
n,k=map(int,input().split())
dict1={}
flag=0
ans=0
if(k%3==0):
    flag=1
for i in range(1,n+1):
    try:
        dict1[i%k]+=1
    except:
        KeyError
        dict1[i%k]=1
for i in dict1.keys():
    if((i+i)%k==0):
        ans+=dict1[i]*dict1[i]*dict1[i]

print(ans)

Measured memory_bytes: 15080
#include<iostream>
using namespace std;
int n,k,q,a;
int p[100005];
int main(){
    cin>>n>>k>>q;
    if(k>q){
        for(int i=0;i<n;i++)cout<<"Yes"<<endl;
    }else{
        for(int i=1;i<=n;i++){
            p[i]=k;
        }
        for(int i=0;i<q;i++){
            cin>>a;
            p[a]++;
        }
        for(int i=1;i<=n;i++){
            
            if(q<p[i])cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }
    }
}

Measured memory_bytes: 896
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N, max = 0, submax = -1, max_c = 0;
    in >> N;
    ll A[N];
    REP(i, N){
        in >> A[i];
        if(A[i]>submax){
            if(A[i]>=max){
                if(A[i]!=max){
                    max_c = 0;
                    submax = max;
                }
                max = A[i];
                max_c++;
            }else{
                submax = A[i];
            } 
        }
    }

    //out << max << max_c << endl;
    //out << submax << endl;

    REP(i, N){
        if(A[i]==max && max_c==1){
            out << submax << endl;
        }else{
            out << max << endl;
        }
    }


}

Measured memory_bytes: 3200
n,m,q = map(int, input().split())
A = [list(map(int, input().split())) for i in range(q)]


def check(arr):
    num = 0
    for e in A:
        if arr[e[1]-1] - arr[e[0]-1] == e[2]:
            num += e[3]

    # print(arr, num)
    return num


def dfs(idx):
    # print(idx, B)
    if idx == -1:
        res = check(B)
        max_res[0] = max(max_res[0], res)

    else:
        prev = B[idx+1] if idx != n-1 else m
        for j in range(1, prev+1):
            B[idx] = j
            dfs(idx-1)

B = [0]*n
max_res = [0]
dfs(n-1)

print(max_res[0])


Measured memory_bytes: 70556
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>
#include <cmath>
#include <iomanip>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int N;
    cin >> N;

    vector<vector<double>> dp(N + 1, vector<double>(N + 1));

    dp[0][0] = 1.0;
    for (int i = 1; i <= N; i++) {
        double p;
        cin >> p;

        for (int j = 0; j <= i; j++) {
            if (j)
                dp[i][j] += dp[i-1][j-1] * p;
            dp[i][j] += (1 - p) * dp[i-1][j];
        }
    }

    double res = 0;
    for (int i = (N + 1) / 2; i <= N; i++) {
        res += dp[N][i];
    }
    cout << std::fixed << std::setprecision(10) << res << "\n";

    return 0;
}


Measured memory_bytes: 70656
#include<stdio.h>
 
int main( void )
{
  long int a,b,c,d;
  long int max;
  scanf("%ld %ld %ld %ld",&a,&b,&c,&d);
  max=a*c;
  if(max<a*d)
  {
    max=a*d;
  }
  if(max<b*c)
  {
    max=b*c;
  }
  if(max<b*d)
  {
    max=b*d;
  }
  printf("%ld\n",max);
  return 0;
}

Measured memory_bytes: 1736
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if((a + b) % 2 == 0){
      System.out.println((a + b) / 2);
    }else{
      System.out.println("IMPOSSIBLE");
    }
  }
}

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

#define PI 4*atan(1)
#define INF 1e8

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

int main(){
  int N;
  cin >> N;
  cout << 800 * N - N / 15 * 200 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>
#include <climits>
#include <bitset>
#include <cassert>
#include <ctime>
#include <list>
#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end())
#define MP make_pair
#define MT make_tuple

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int num[110];
int vacant[110];

vector<vector<int>> G;

void add_edge(int a, int b){
	G[a].push_back(b);
	G[b].push_back(a);
}

vector<int> rec;

void dfs(int &id, int d, int prv, int &i){
	if (rec.size() == i) return;
	int cur = id;
	int x = rec[i];

	if (x < 0){
		--id;
		add_edge(prv, vacant[d - 1 + x]);
		return;
	}

	if (prv > 0) add_edge(prv, cur);
	
	num[cur] = x;
	if (G[cur].size() < num[cur]) vacant[d] = cur;
	while (G[cur].size() < num[cur]){
		++id, ++i;
		dfs(id, d + 1, cur, i);
	}
}

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

	int t;
	cin >> t;
	while (t--){
		rec.clear();
		int a;
		while (cin >> a, a) rec.push_back(a);

		G.assign(110, vector<int>());

		int id = 1, i = 0;
		dfs(id, 0, -1, i);
		for (int i = 1; i <= id; ++i){
			sort(ALL(G[i]));
			cout << i;
			for (auto v : G[i]) cout << ' ' << v;
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1248
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ST = Console.ReadLine().Split(' ');
            var S = ST[0]; var T = ST[1];
            var AB = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var A = AB[0]; var B = AB[1];
            var U = Console.ReadLine();

            if (S == U) A -= 1;
            else B -= 1;
            Console.WriteLine($"{A} {B}");
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  long long O=1000000007;
  long long N,K;cin>>N>>K;
  vector<int>A(N);
  vector<int>B(N*2);
  for(int X=0;X<N;X++){
    cin>>A[X];
    B[X]=A[X];
    B[N+X]=A[X];
  }
  long long M=0;
  for(int X=0;X<N-1;X++){
    for(int Y=X+1;Y<N;Y++){
      if(A[X]>A[Y]){
        M++;
        M%=1000000007;
      }
    }
  }
  long long H=0;
  for(int X=0;X<N;X++){
    for(int Y=N;Y<N*2;Y++){
      if(B[X]>B[Y]){
        H++;
        H%=1000000007;
      }
    }
  }
  cout<<((M*K)%O+(H*(K*(K-1)/2%O))%O)%O<<endl;
}


Measured memory_bytes: 3608
N = int(input())
D = {i: [0] for i in range(100)}
for i in range(1, N+1):
  if i % 10 != 0:
    s = str(i)
    D[int(s[0])*10+int(s[-1])][0] += 1
    D[int(s[0])*10+int(s[-1])].append(i)
S = 0
for i in range(10):
  for j in range(10):
    S += D[i*10+j][0] * D[j*10+i][0]
print(S)

Measured memory_bytes: 10756
#include <bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<long, long> pl;
typedef vector<long, long> vll;
typedef map<int, int> mi;
typedef map<long, long> ml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ii> vii;
typedef tuple<double, int, int> dii;
typedef tuple<int, int, int> iii;
typedef priority_queue<int, vi, greater<int>> min_pq;
 
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, b) for(int i = 0; i < b; ++i)
#define ROF(i, b, a) for(int i = b; i >= a; --i)
#define PER(i, b) for (int i = b; i >= 0; --i)
#define trav(x, a) for(auto x: a)
#define TC(test_case) while(test_case--)
 
#define mp make_pair
#define mtp make_tuple
#define pb push_back
#define eb emplace_back
#define rsz resize
#define pf push_front
#define F first
#define S second

#define ar array
#define LSOne(S) ((S) & -(S))
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
// #define MxN 1005
#define INF 1e9
#define EPS 1e-9
enum {UNVISITED = -1, VISITED = -2};

const int MxN = 1e3, MOD = 1e9 + 7;
int n, b, dp[MxN][MxN];
string s[MxN];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    // freopen("filename3.in", "r", stdin); freopen("filename3.out", "w", stdout);
    cin >> n >> b;
    REP (i, n) cin >> s[i];

    dp[0][0] = 1;
    REP (i, n) {
    	REP (j, b) {
    		if (i) dp[i][j] += dp[i - 1][j];
    		if (j) dp[i][j] += dp[i][j - 1];
    		dp[i][j] %= MOD;
    		if (s[i][j] == '#') dp[i][j] = 0;
    	}
    }
    cout << dp[n - 1][b - 1];
    return 0;
}

Measured memory_bytes: 8628
def examD():
    N, A, B = LI()
    X = LI()
    cur = int(0)
    for i in range(N-1):
        cur += min(A*(X[i+1]-X[i]),B)
    print(cur)

import sys
import copy
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()

Measured memory_bytes: 14556
h, w = map(int, raw_input().split())
if h % 3 == 0 or w % 3 == 0:
    print(0)
    exit()

def calc2(h, w):
    half = h // 2
    return [half * w, (h - half) * w]
    
def calc(h, w):
    a = h // 3
    slist = []
    slist.append([a * w] + calc2(h - a, w))
    slist.append([a * w] + calc2(w, h - a))
    slist.append([(a + 1) * w] + calc2(h - a - 1, w))
    slist.append([(a + 1) * w] + calc2(w, h - a - 1))
    candi = []
    for value in slist:
        candi.append(max(value) - min(value))
    return min(candi)

print(min(calc(h, w), calc(w, h)))

    


Measured memory_bytes: 2696