akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define fi first
#define se second
#define All(x) (x).begin(),(x).end()
#define TYPE(x) typeid(x).name()
int main(){
	ll x;
	cin>>x;
	for(ll i=-1000;i<=1000;++i)
	for(ll j=-1000;j<=1000;++j){
		ll a1=i*i*i*i*i;
		ll a2=j*j*j*j*j;
		if(a1-a2==x){
			cout<<i<<" "<<j<<'\n';
			return 0;
		}
	}
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define ld long double 
#define For(i, a, n) for(long long i = a; (a < n) ? (i < n) : (i > n); (a < n) ? (i++) : (i--))
#define ee 1000000007
#define pb push_back
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
using namespace std;

void solve() {

}

int main() {
    fio;
    string n;
    cin >> n;
    ll sum = 0;
    For(i, 0, n.size()) {
        sum += n[i] - '0';
    }
    if(sum % 9 == 0)
        cout << "Yes\n";
    else 
        cout << "No\n";
}

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

using namespace std;
typedef long long int ll;

const int MAXN = 20;
int n;
long double x[MAXN];
long double y[MAXN];

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(10);
	long double sum = 0, x1, y1, n1;
	cin >> n;
	n1 = (long double)n;
	for(int i = 0; i < n; i++)
	{
		cin >> x1 >> y1;
		x[i] = x1;
		y[i] = y1;
	}
	for(int i = 0; i < n; i++)
	{
		for(int j = i + 1; j < n; j++)
		{
			x1 = x[i] - x[j];
			y1 = y[i] - y[j];
			x1 *= x1;
			y1 *= y1;
			x1 += y1;
			sum += sqrt(x1);
		}
	}
	sum /= n1;
	sum *= 2;
	cout << sum << endl;
	return 0;
}



Measured memory_bytes: 256
using System;
namespace AtCoder
{
    static class Solver
    {
        static IO io = new IO();

        public static void Solve()
        {

            io.ReadSplit();
            int N = io.Int();
            int M = io.Int();

            int[] count = new int[N];

            for (int i = 0; i < M; ++i)
            {
                io.ReadSplit();
                count[io.Int() - 1] += 1;
                count[io.Int() - 1] += 1;
            }


            for (int i = 0; i < N; ++i)
            {
                io.WriteLine(count[i].ToString());
            }
        }
    }
}
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Solver.Solve();
        }
    }
    class IO
    {
        private string[] _Inputs;
        private int _Index;
        public void Read()
        {
            _Inputs = new string[1];
            _Inputs[0] = Console.ReadLine();
            _Index = 0;
        }
        public void ReadSplit()
        {
            _Inputs = Console.ReadLine().Split(' ');
            _Index = 0;
        }
        public string String()
        {
            return _Inputs[_Index++];
        }
        public string[] String(int xCount)
        {
            string[] rv = new string[xCount];
            Array.Copy(_Inputs, _Index, rv, 0, xCount);
            _Index += xCount;
            return rv;
        }
        public int Int()
        {
            return int.Parse(_Inputs[_Index++]);
        }
        public int[] Int(int xCount)
        {
            int[] rv = new int[xCount];
            for (int i = 0; i < xCount; ++i)
            {
                rv[i] = int.Parse(_Inputs[_Index++]);
            }
            return rv;
        }
        public long Long()
        {
            return long.Parse(_Inputs[_Index++]);
        }
        public long[] Long(int xCount)
        {
            long[] rv = new long[xCount];
            for (int i = 0; i < xCount; ++i)
            {
                rv[i] = long.Parse(_Inputs[_Index++]);
            }
            return rv;
        }
        public void Write(string xStr)
        {
            Console.Write(xStr);
        }
        public void WriteLine(string xStr)
        {
            Console.WriteLine(xStr);
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
using ll = long long;
const ll INF = 1e9;

int main() {
    int N, odd = 0, even = 0;
    cin >> N;
    ll A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i] % 2 == 0 ? even++ : odd++;
    }

    cout << (odd % 2 == 1 ? "NO" : "YES") << endl;


    return 0;
}

Measured memory_bytes: 1024
N = int(input())
B = [int(x) for x in input().split()]
A = [0 for y in range(N)]
A[0] = B[0]
A[N-1] = B[N-2]
for i in range(1,N-1):
    A[i] = min(B[i-1],B[i])
print(sum(A))


Measured memory_bytes: 9036
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

template<typename T = int, class F = std::plus<T>, class F_INV = std::minus<T>, const T E = 0>
struct BinaryIndexedTree {
    const F op = F(); const F_INV op_inv = F_INV();
    int n; vector<T> dat;
    void build(const vector<T>& v) {
        n = v.size(); dat.assign(n, E); for (int i = 0; i < n; ++i) add(i, v[i]);
    }
    void add(int k, T v) { for (int i = k; i < n; i |= i + 1) dat[i] = op(dat[i], v); }
    T query(int a, int b) const {
        T ret = E; if (a == b) return ret;
        for (int i = b - 1; i >= 0; i = (i & (i + 1)) - 1) ret = op(ret, dat[i]);
        return op_inv(ret, query(0, a));
    }
};

struct InversionNumber {
    BinaryIndexedTree<int> bit;
    vector<int> vcomp;

    ll inversion_number(const vector<int>& v) {
        vcomp = v;
        sort(vcomp.begin(), vcomp.end());
        vcomp.erase(unique(vcomp.begin(), vcomp.end()), vcomp.end());

        bit.n = v.size();
        bit.dat.assign(v.size(), 0);
        ll res = 0;
        for (int i = 0; i < (int)v.size(); ++i) {
            int j = lower_bound(vcomp.begin(), vcomp.end(), v[i]) - vcomp.begin();
            res += i - bit.query(0, j + 1);
            bit.add(j, 1);
        }
        return res;
    }
};

int main() {
    string S;
    cin >> S;
    int N = S.size();

    vector<int> alphacnt(26);
    rep(i, N) alphacnt[S[i] - 'a']++;
    int ocnt = 0;
    rep(c, 26) ocnt += alphacnt[c] % 2;
    if (ocnt > 1) {
        write(-1);
        return 0;
    }

    vv<int> idx(26);
    vector<int> alphaid(26), correct(N);
    int num = 0;
    rep(i, N) {
        if (alphacnt[S[i] - 'a'] % 2 && alphaid[S[i] - 'a'] == alphacnt[S[i] - 'a'] / 2) {
            correct[i] = N / 2;
        }
        else if (alphaid[S[i] - 'a'] < alphacnt[S[i] - 'a'] / 2) {
            correct[i] = num;
            idx[S[i] - 'a'].push_back(num);
            num++;
        }
        else {
            correct[i] = N - 1 - idx[S[i] - 'a'].back();
            idx[S[i] - 'a'].pop_back();
        }
        alphaid[S[i] - 'a']++;
    }

    InversionNumber in;
    ll ans = in.inversion_number(correct);
    write(ans);
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using Complex = std::complex<double>;
using namespace std;


int A, B, C;


signed main(){
    cin >> A >> B >> C;
    
    int a = max({ A, B, C });
    int c = min({ A, B, C });
    int b = A+B+C-a-c;

    int x = a%2;
    int y = b%2;
    int z = c%2;

    if(x == y && y == z) cout << (a-b)/2+(a-c)/2 << endl;
    else if(x == y) cout << 1+(a-b)/2+(a+1-c)/2 << endl;
    else if(x == z) cout << 1+(a+1-b)/2+(a-c)/2 << endl;
    else cout << 1+(a-b-1)/2+(a-c-1)/2 << endl;

    return 0;
}

Measured memory_bytes: 256
// Author -- Frame

#include<bits/stdc++.h>

#define lowbit(x) ((x)&(-(x)))
#define Finline __inline__ __attribute__ ((always_inline))
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
#define SZ(x) ((int)x.size())
#define mkpr std::make_pair
#define pb push_back

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef std::pair<int,int> pi;
typedef std::pair<ll,ll> pl;

const int inf=0x3f3f3f3f,Inf=0x7fffffff;
const ll INF=0x3f3f3f3f3f3f3f3f;

Finline uint rnd()
{
	static uint seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
template <typename _Tp>_Tp gcd(const _Tp &a,const _Tp &b){return (!b)?a:gcd(b,a%b);}
template <typename _Tp>Finline _Tp abs(const _Tp &a){return a>=0?a:-a;}
template <typename _Tp>Finline _Tp max(const _Tp &a,const _Tp &b){return a<b?b:a;}
template <typename _Tp>Finline _Tp min(const _Tp &a,const _Tp &b){return a<b?a:b;}
template <typename _Tp>Finline void chmax(_Tp &a,const _Tp &b){(a<b)&&(a=b);}
template <typename _Tp>Finline void chmin(_Tp &a,const _Tp &b){(b<a)&&(a=b);}
template <typename _Tp>Finline void read(_Tp &x)
{
	char ch(getchar());
	bool f(false);
	while(ch<48||ch>57) f|=ch==45,ch=getchar();
	x=ch&15,ch=getchar();
	while(ch>=48&&ch<=57) x=(((x<<2)+x)<<1)+(ch&15),ch=getchar();
	if(f) x=-x;
}
template <typename _Tp,typename... Args>Finline void read(_Tp &t,Args &...args){read(t);read(args...);}
template <typename _Tp,typename... Args>Finline _Tp min(const _Tp &a,const _Tp &b,const Args &...args){return a<b?min(a,args...):min(b,args...);}
template <typename _Tp,typename... Args>Finline _Tp max(const _Tp &a,const _Tp &b,const Args &...args){return a<b?max(b,args...):max(a,args...);}
Finline int read_str(char *s)
{
	char ch(getchar());
	while(ch==' '||ch=='\r'||ch=='\n') ch=getchar();
	char *tar=s;
	*tar=ch,ch=getchar();
	while(ch!=' '&&ch!='\r'&&ch!='\n'&&ch!=EOF) *(++tar)=ch,ch=getchar();
	return tar-s+1;
}

const int N=100005;
struct edge{
	int v,nxt;
}c[N<<1];
int front[N],edge_cnt;
Finline void addedge(int u,int v)
{
	c[++edge_cnt]=(edge){v,front[u]};
	front[u]=edge_cnt;
}
int len[N],ans,k;
void dfs(int x,int fa)
{
	for(int i=front[x];i;i=c[i].nxt)
	{
		int v=c[i].v;
		if(v!=fa) dfs(v,x),chmax(len[x],len[v]);
	}
	++len[x];
	if(len[x]==k&&fa>1) ++ans,len[x]=0;
}
int main()
{
	int n,x;read(n,k);
	read(x);
	ans+=x!=1;
	for(int i=2;i<=n;++i) read(x),addedge(x,i),addedge(i,x);
	dfs(1,0);
	printf("%d\n",ans);
	return 0;
}


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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }

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

    int N, T; cin >> N >> T;
    vi A(N); REP(i, N) cin >> A[i];
    int ans = 0;
    REP(i, N-1) ans += min(A[i+1]-A[i], T);
    ans += T;
    cout << ans << endl;
}

Measured memory_bytes: 3988
# 桁DP 最適化もうむり

MOD = 10 ** 9 + 7
s = gets.chomp.split("")
question = s.map { |c| c == "?" }
length = s.length
# dp[上から i 桁まで][13 で割ったあまり]の出現回数
# 桁の自由度(smaller)は本問では不要
dp = (length + 1).times.map { Array.new(13, 0) }
# 初期化
# dp[0 桁目まで][13 で割ったあまりが 0]の出現回数は 1
dp[0][0] = 1
# （右から見た）桁数 % 6
mod_memo = [4, 1, 10, 9, 12, 3]
all_nums = (0..9).to_a

# 桁数分ループする（i は遷移元の桁）
length.times do |i|
  # 13 で割ったあまりの増加分を求める
  addition = mod_memo[(length - i) % 6]
  # 桁の数字が "?" の場合は 10 回ループ、それ以外の場合はその数字のみ
  nums = question[i] ? all_nums : [s[i].to_i]
  dp_current = dp[i]
  # 最適化のため、事前に 1 行分だけ参照渡しをする
  # dp_next と dp[i + 1] の object_id は同じ
  dp_next = dp[i + 1]
  # 13 で割ったあまりごとに確認する
  13.times do |mod|
    current_count = dp_current[mod] % MOD
    nums.each do |d|
      # 次の桁に遷移する
      dp_next[(mod + addition * d) % 13] += current_count
    end
  end
end

puts dp[length][5] %= MOD


Measured memory_bytes: 26748
import math
n = int(input())
counter = False
#for n in range (0,100):
for i in range (math.ceil((n+1) / 4) ):
  for j in range (math.ceil((n+1) / 7) ):
    #print(n, i,j)
    if i*4 + j*7 == n:
      counter = True
if counter == True:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 2940
/*
 * FileName:     prime_numbers
 * CreatedDate:  2020-04-02 17:54:49 +0900
 * LastModified: 2020-04-05 17:06:07 +0900
 */

#include <stdio.h>
#include <math.h>
int main(void){
    int n;
    scanf("%d",&n);
    int box,count=0;
    int flag=0;
    for(int i=0;i<n;i++){
        scanf("%d",&box);
        for(int j=2;(double)j<=sqrt(box);j++){
            if( box%j==0 ){
                flag=1;
                break;
            }
        }
        if(flag==0){
            count++;
//            printf("%d\n",count);
        }
        flag=0;
    }
    printf("%d\n",count);
    return 0;
}



Measured memory_bytes: 2028
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
using namespace std;
typedef long long ll;
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}
int gcd(int x, int y){
	if(x<y){
    return gcd(y,x);
  }
  if(y==0){
    return x;
  }
  return gcd(y,x%y);
}
int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}







int main() {
  int H,W;
  cin>>H>>W;
  char s[H][W];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>s[i][j];    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(s[i][j]=='.'){
        int sum=0;
        
          for(int l=-1;l<2;l++){
            for(int m=-1;m<2;m++){
              if(l==0&&m==0){
                continue;
              }
              if(l+i>=0&&l+i<=H-1&&j+m>=0&&j+m<=W-1){
              if(s[i+l][j+m]=='#'){
                sum++;
              }}
            }
          }
          cout<<sum;
          if(j==W-1){
            cout<<""<<endl;
          }
        
        
        
      }else{
        cout<<'#';
        if(j==W-1){
            cout<<""<<endl;
          }
      }
    }
  }


  




  
  
}

  

  

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <string>
#include <stdio.h>
using namespace std;
//15:15
const double eps = 1e-20, INF = 1e3;
struct Butu{
	double time;
	int s1;
	int s2;
};
struct Star{
	double px;
	double py;
	double pz;
	double vx;
	double vy;
	double vz;
	double r;
	double vr;
};
Butu GetColTime(Star Star1, Star Star2,int S1N,int S2N){
	double vx = Star1.vx - Star2.vx, vy = Star1.vy - Star2.vy, vz = Star1.vz - Star2.vz, vr = Star1.vr + Star2.vr;
	double px = Star1.px - Star2.px, py = Star1.py - Star2.py, pz = Star1.pz - Star2.pz, r = Star1.r + Star2.r;
	double a = vx * vx + vy * vy + vz * vz - vr * vr;
	double b = 2 * (vx * px + vy * py + vz * pz + vr * r);
	double c = px * px + py * py + pz * pz - r * r;
	if (abs(a) < eps) {
		if (abs(b) < eps) return{ INF, -1, S2N };
		double res = -c / b;
		if (res < 0) return{ INF, -1, S2N };
		return{ res, S1N, S2N };
	}
	double D = b * b - 4 * a * c;
	if (D < 0) return{ INF, S1N, S2N };
	double resa = (-b - sqrt(D)) / 2 / a;
	double resb = (-b + sqrt(D)) / 2 / a;
	if (resa > 0) return{ resa, S1N, S2N };
	if (resb > 0) return{ resb, S1N, S2N };
	return{ INF, -1, S2N };
}

int main() {
	while (1){
		int n;
		cin >> n;
		if (!n)return 0;
		vector<Star> SCol;
		vector<double> DTCol;
		vector<Butu> ButuCol;
		for (int i = 0; i < n; ++i){
			double apx, apy, apz, avx, avy, avz, ar, avr;
			cin >> apx >> apy >> apz >> avx >> avy >> avz >> ar >> avr;
			SCol.push_back({ apx, apy, apz, avx, avy, avz, ar, avr });
			DTCol.push_back(ar / avr);
			ButuCol.push_back({ ar / avr, i, -2 });
		}
		
		for (int i = 0; i < n; ++i){
			for (int j = i + 1; j < n; ++j){
				Butu aButu=GetColTime(SCol[i], SCol[j],i,j);
				if (aButu.s1 != -1){
					ButuCol.push_back(aButu);
				}
			}
		}
		sort(ButuCol.begin(), ButuCol.end(), [](Butu B1, Butu B2){return B1.time < B2.time; });
		vector<int> Exist(n, 1);
		for (int i = 0; i < ButuCol.size(); ++i){
			if (Exist[ButuCol[i].s1] && ButuCol[i].s2 == -2){
				Exist[ButuCol[i].s1] = 0;
				DTCol[ButuCol[i].s1] = ButuCol[i].time;
			}else if (Exist[ButuCol[i].s1] && Exist[ButuCol[i].s2]){
				Exist[ButuCol[i].s1] = 0; Exist[ButuCol[i].s2] = 0;
				DTCol[ButuCol[i].s1] = ButuCol[i].time;
				DTCol[ButuCol[i].s2] = ButuCol[i].time;
			}
		}
		for (int i = 0; i < n; ++i){
			printf("%.09f", DTCol[i]); cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1976
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

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

    int n, k;
    cin >> n >> k;
    vector<int> A(n);
    REP(i, n) cin >> A[i];

    int ans = 1e9;
    for(int i = 0; i < n - k + 1; i++){
        int cost = A[i + k - 1] - A[i] + min(abs(A[i]), abs(A[i + k - 1]));
        ans = min(ans, cost);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    if((S[0]-'0')*1000+(S[1]-'0')*100+(S[2]-'0')*10+(S[3]-'0')<2019)cout << "Heisei" << endl;
    else if((S[0]-'0')*1000+(S[1]-'0')*100+(S[2]-'0')*10+(S[3]-'0')==2019 && (S[5]-'0')*10+(S[6]-'0')<5)cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}

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

int main() {
    int N, H, W; cin >> N >> H >> W;
    vector<int> X(N);
    for(int i=0; i<N; i++) cin >> X[i];

    vector<int> cls(N * W + 1);
    for(int i=0; i<N; i++) {
        int l = i * W, r = (i + 1) * W;
        if(i % 2 == 0) l += X[i], r += X[i];
        else l -= X[i], r -= X[i];

        for(int k=l; k<r; k++) cls[k]++;
    }

    int ans = 0;
    for(int i=0; i<N*W; i++) {
        if(!cls[i]) ans += H;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3148
#include<iostream>
#include<map>
#include<string.h>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<cstdlib>
#include<math.h>
#include<set>
#include<array>
using namespace std;

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 rep(n) for(int i=0;i<n;i++)
typedef pair<int, int> pii;

typedef long long ll;
typedef pair<ll, ll>pll;
const int MOD = 1000000007;
const int INF = 1 << 29;

int x, y;
long long fac[1000001], finv[1000001], inv[10000001];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < 1000001; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {

	
	cin >> x >> y;
	if ((x + y) % 3 != 0 || abs(x-y)>(x+y)/3) {
		cout << 0 << endl;
		return 0;
	}
	COMinit();
	cout << COM((x + y) / 3, ((x + y) / 3 + abs(x - y)) / 2);
	return 0;
}


Measured memory_bytes: 24448
#include <iostream>

using namespace std;

int main() {
	int W, H, x, y, r;

	cin >> W >> H >> x >> y >> r;

	if (H - y >= r && W - x >= r && x >= r && y >= r) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}



	return 0;
}


Measured memory_bytes: 3100
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
contest=[111,222,333,444,555,666,777,888,999]
ans=0
contest.each_with_index do|c,i|
  if N<=c
      ans=c
      break
  end
end
puts ans

Measured memory_bytes: 3836
using System;

namespace ABC044
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var k = int.Parse(Console.ReadLine());
            var x = int.Parse(Console.ReadLine());
            var y = int.Parse(Console.ReadLine());

            var result = 0;
            for (int i = 1; i <= n; i++)
            {
                result += (i <= k) ? x : y;
            }

            Console.Write(result);
        }
    }
}


Measured memory_bytes: 2648
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
int mi[20009];
signed main(){
	int h,n;
	cin>>h>>n;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	for(int i=1;i<=h;i++){
		mi[i] = LINF;
	}
	for(int i=1;i<=h;i++){
		for(int j=0;j<n;j++){
			mi[i] = min( mi[i], mi[ max( 0LL, i-a[j] ) ] + b[j] );
		}
	}
	cout<<mi[h]<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int main(){

int N,A,B,p1,p2;
cin >> N >> A >> B;
 p1 = N*A;
 p2 = B;
 if (p1 <= p2){
     cout << p1 << endl;

 }else{
     cout << B << endl;
 }
    return 0;


}




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

int main()
{
	int array[3];
	for (int i = 0; i < 3; ++i)
	{
		cin >> array[i];
	}
	sort(array, array + 3);
	cout << array[0] + array[1] << endl;


	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,i,j,k,l;
    ll a,b,c,p;
    cin>>a>>b>>c>>k;
    for(i=0;i<=k;i++)
     for(j=0;j<=k-i;j++)
      for(l=0;l<=k-i-j;l++)
       {
           ll red = a*pow(2,i) ,green =b*pow(2,j) ,blue=c*pow(2,l);
           if(red<green && green<blue){
               cout<<"Yes";
               return 0;
           } 
       }

    cout<<"No";
}

Measured memory_bytes: 4112
let n, t0 = Scanf.scanf " %d %d" @@ fun a b -> a, b
let cts = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a, b
let _ =
  let cts1 = cts |> Array.to_list |> List.filter (fun (c, t) -> t <= t0) in
  if cts1 = [] then print_endline "TLE"
  else List.fold_left min cts.(0) cts1 |> fst |> Printf.printf "%d\n"

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>  // sort, 二分探索, etc
#include <iomanip>  // setprecision (浮動小数点の出力の誤差)
#include <map>
#include <queue>
#include <set>
#include <stack>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define cauto const auto&
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SIZE(x) ((ll)(x).size()) // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

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

template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return true;}return false;}

const char newl = '\n';

ll qp(ll a,ll b){ll ans=1;do{if(b&1)ans*=a;a*=a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mod){ll ans=1;do{if(b&1)ans=ans*a%mod;a=a*a%mod;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll comb(int n, int r) {
    vector<vector<ll> > v(n+1, vector<ll>(r+1, 0));
    for(int i=0;i<n+1;i++) {v[i][0]=1; if(i < r+1)v[i][i]=1; }
    for(int i=1;i<n+1;i++) {for(int j=1;j<min(i,r+1);j++) {v[i][j]=v[i-1][j-1]+v[i-1][j];}}
    return v[n][r];
}

// INT_MAX   = 2.1e+09 (2147483647)
// LONG_MAX  = 9.2e+18 (9223372036854775807)
// LLONG_MAX = 9.2e+18 (9223372036854775807)


int main() {
    string s;
    cin >> s;
    ll n = s.size();

    ll rprev = 0;
    map<ll, ll> mp;
    mp[0] += 1;
    for (int i = 0; i < n; i++) {
        char c = s[n - i - 1];
        ll mod = (qp(10, i, 2019) * (c - '0') + rprev) % 2019;
        rprev = mod;
        mp[mod] += 1;
    }

    ll total = 0;
    for (auto & itr : mp) {
        if (itr.second == 1) {
            continue;
        }
        total += (itr.second * (itr.second - 1) / 2);
    }
    cout << total << newl;


    return 0;
}


Measured memory_bytes: 3360
#include<bits/stdc++.h>
#define For(i, a, b)  for(int i = a; i <= b; ++i)
#define Ford(i, a, b) for(int i = a; i >= b; --i)
#define F             "TRIPEDGE"
#define READ          freopen(F".inp", "r", stdin)
#define WRITE         freopen(F".out", "w", stdout)
#define ll            long long
#define pb            push_back

const int N = 1e6 + 7;

using namespace std;

static ll n, m, u, v, color[N], chk[N], flag = 0;
vector<ll> a[N];

void dfs(int u)
{
    chk[u] = 1;
    int newcolor = 1 - color[u];
    for(int v: a[u])
    {
        if(color[v] == -1) color[v] = newcolor;
        else if(color[v] != newcolor) flag = 1;
        if(chk[v] == 0) dfs(v);
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //READ; WRITE;
    cin >> n >> m;
    For(i, 1, m)
    {
        cin >> u >> v;
        a[u].pb(v);
        a[v].pb(u);
    }
    For(i, 1, n)
    {
        if(chk[i] == 1) continue;
        fill_n(color, N, -1);
        color[i] = 1;
        dfs(i);
        if(flag == 1)
        {
            cout << n * (n - 1) / 2 - m;
            return 0;
        }
    }
    ll cnt1 = 0, cnt2 = 0;
    For(i, 1, n)
    {
        if(color[i] == 1) ++cnt1;
        else ++cnt2;
    }
    cout << cnt1 * cnt2 - m;
return 0;
}

Measured memory_bytes: 37504
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<map>
using namespace std;
int n,m,k,i,j;
int main()
{
	cin>>n>>m>>k;
	for (i=0;i<=n;i++)
	{
		for (j=0;j<=m;j++)
		{
			if (i*m+j*n-i*j*2==k)
			{
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

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

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void testCase();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	testCase();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void testCase() {
	int a, b, t;
	cin >> a >> b >> t;
	int res = 0, curr = a;
	while (2 * curr < 2 * t + 1) {
		res += b;
		curr += a;
	}
	cout << res << "\n";
}

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

int main() {
  int H, W, N, a[10000];
  int g[100][100];
  cin >> H >> W >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  int color = 0;

  for (int i = 0; i < H; i++) {
    if (i % 2 == 0) {
      for (int j = 0; j < W; j++) {
        g[i][j] = color;
        a[color]--;
        if (a[color] == 0) {
          color++;
        }
      }
    } else {
      for (int j = W - 1; j >= 0; j--) {
        g[i][j] = color;
        a[color]--;
        if (a[color] == 0) {
          color++;
        }
      }
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << g[i][j] + 1 << " ";
    }
    cout << endl;
  }
  return 0;
}

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

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

    if(D==25) cout<<"Christmas"<<endl;
    else if(D==24) cout<<"Christmas Eve"<<endl;
    else if(D==23) cout<<"Christmas Eve Eve"<<endl;
    else if(D==22) cout<<"Christmas Eve Eve Eve"<<endl;

}

Measured memory_bytes: 256
#if By_CYJian

AGC039 A

#endif

#include <bits/stdc++.h>

using namespace std;

#define FILE(Name) freopen(Name".in", "r", stdin), freopen(Name".out", "w", stdout)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

template<typename T> inline void chkmax(T&a, T b) { a = a > b ? a : b; }
template<typename T> inline void chkmin(T&a, T b) { a = a < b ? a : b; }
template<typename T> inline T gcd(T&a, T b) { return !b ? a : gcd(b, a % b); }
typedef unsigned uit;
typedef long long ll;
typedef double db;

// 看题目取用
// const int mod = 2999999; // for Hash
// const int mod = 4999999; // for Hash
// const int mod = 19491001;
// const int mod = 19260817;
// const int mod = 104857601;
// const int mod = 998244353;
// const int mod = 998244853;
// const int mod = 1004535809;
const int mod = 1000000007;

template<typename T> const T Mod(T x) { return x >= mod * 2 ? x % mod : (x >= mod ? x - mod : x); }
template<typename T> const void Add(T&a, T b) { a = Mod(a + b); }

char s[120];

int main() {
	gstr(s); int k; gi(k);
	int len = strlen(s);
	ll res = 0;
	int l = 0, lc = 0, bg = 0;
	for(int i = 0; i < len; i++) {
		if(s[i] == lc) ++l;
		else {
			if(l && !bg) bg = l;
			res += 1LL * k * (l >> 1);
			lc = s[i];
			l = 1;
		}
	}
	if(l == len)
		res = 1LL * k * len >> 1;
	else {
		if(s[len - 1] == s[0]) {
			res -= 1LL * (bg >> 1) * (k - 1);
			res += 1LL * ((bg + l) >> 1) * (k - 1) + (l >> 1);
		} else res += 1LL * (l >> 1) * k;
	}
	print(res), pc('\n');
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF = 1LL << 60;

vector<ll> cnt(10000);

int main() {
    int n, p; cin >> n >> p;
    string S; cin >> S;
    ll ans = 0;
    if (p == 2 || p == 5) {
        for (int i = n - 1; i >= 0; i--) {
            if ((S[i] - '0') % p == 0) {
                ans += i + 1;
            }
        }
    } else {
        cnt[0] = 1;
        int rem = 0; int q = 1;
        for (int i = n - 1; i >= 0; i--) {
            rem = (rem + (q * (S[i] - '0'))) % p;
            cnt[rem]++;
            q = (10 * q) % p;
        }
        for (auto m : cnt) {
            ans += m * (m - 1) / 2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  bool j = true;
  for (int i=0; i<3; i++) {
    if (s.at(i) == s.at(i+1)) {
      j = false;
    }
  }
  if (j) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int a[n],n4=0,no=0,ne=0;
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        if(a[i]%4==0){
            n4++;
        }else if(a[i]%2==0){
            ne++;
        }else{
            no++;
        }
    }
    
    if(n%2==1){
        if(n4>=no-1){
            printf("Yes");
        }else{
            printf("No");
        }
    }else{
        if(n4>=no){
            printf("Yes");
        }else{
            printf("No");
        }
    }
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	long int i, j;
	long int a, b;
	long int count = 0;
	char s[20], t[20], u[20];
	
	scanf("%s %s %ld %ld %s", s, t, &a, &b, u);
	
	if(strlen(s) == strlen(t) ) {
		for(i = 0; i < strlen(s); i++) {
			if(s[i] != u[i]) {
				printf("%ld %ld\n", a, b - 1);
				return 0;
			}
		}
		printf("%ld %ld\n", a - 1, b);
		return 0;
	} else {
		if(strlen(s) == strlen(u) ) {
			printf("%ld %ld\n", a - 1, b);
		} else {
			printf("%ld %ld\n", a, b - 1);
		}
	}
	
	return 0;
}


Measured memory_bytes: 128
# frozen_string_literal: true

n = gets.to_i
a = gets.split.map(&:to_i)

if a.any?(0)
  puts 0
  exit
end
m = 1
a.each do |e|
  m *= e
  if m > 10**18
    puts '-1'
    exit
  end
end
puts m


Measured memory_bytes: 21648
#include <bits/stdc++.h>
#include <algorithm>  
#include <unordered_set>
#include <cmath>
#define ll long long

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll L, R, d;

	cin >> L >> R >> d;

	ll occur = 0;

	for (ll x = L; x <= R; x++) {
		if (x % d == 0) {
			occur++;
		}
	}

	cout << occur << endl;


	return 0;
}

Measured memory_bytes: 3588
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	io := newIo()
	defer io.Flush()

	N := io.NextInt()
	K := io.NextInt()

	x := make([]int, N)
	for i := range x {
		x[i] = io.NextInt()
	}
	ans := math.MaxInt64
	for i := range make([]struct{}, N-K+1) {
		a := x[i]
		b := x[i+K-1]
		ans = min(ans, min(abs(a), abs(b))+abs(a-b))
	}
	io.Println(ans)
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}
func (io *io) Flush() {
	_ = io.writer.Flush()
}
func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, _ := io.reader.ReadLine()
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}
func (io *io) NextWord() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}
func (io *io) NextInt() int {
	i, _ := strconv.Atoi(io.NextWord())
	return i
}
func (io *io) Print(a ...interface{}) {
	fmt.Fprint(io.writer, a...)
}
func (io *io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}
func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}


Measured memory_bytes: 6912
#include<iostream>
#include<sstream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int sz=110;
string s[sz],cmp[sz];
int a,b;
bool solve()
{
    if(a==b)
    {
        rep(i,a)rep(j,b)if(s[i][j]!=cmp[i][j])return 0;
        else return 1;
    }
    rep(i,a-b)
    {
        rep(j,a-b)
        {
            if(s[i][j]==cmp[0][0])
            {
                bool ok=1;
                rep(k,b)rep(l,b)if(s[i+k][j+l]!=cmp[k][l])
                    {
                        ok=0;
                        break;
                    }
                if(ok)return 1;
            }
        }
    }
    return 0||s==cmp;
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>a>>b;
    rep(i,a)cin>>s[i];
    rep(i,b)cin>>cmp[i];
    if(solve())puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
  int n;
  cin>>n;
  int arr[n];
  int maxs=INT_MIN;
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>arr[i];
  	if(arr[i]>=maxs){
    	maxs=arr[i]; 
    }
    sum+=maxs-arr[i];
  }
   cout<<sum<<endl;
	
}

Measured memory_bytes: 5200
def funuke(now):
    count = 0
    for ele in list(str(now)):
        count += int(ele)
    return now / count

def main():
    num = int(input())

    keta = 1
    now = 1
    count = 0

    while count < num:
        if funuke(now) <= funuke(now + keta):
            count += 1
            print(now)
            now += keta
        else:
            now += 9 * keta
            keta *= 10

if __name__ == '__main__':
    main()

Measured memory_bytes: 38896
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var nextString func() string

func init() {
	nextString = newReadString(os.Stdin)
}

func main() {
	n := nextInt()
	ans := 0

	for i := 0; i < n; i++ {
		l := nextInt()
		r := nextInt()
		ans += r - l + 1
	}
	fmt.Println(ans)
}

func nextInt() (result int) {
	result, _ = strconv.Atoi(nextString())
	return
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
		}
		return r.Text()
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define forn(x, n)              for (int x = 0; x < n; x++)
#define forr(x, n)              for (int x = n; x >= 0; x--)
#define fore(x, a, b, c)        for (int x = a; x <= b; x += c)
#define forre(x, a, b, c)       for (int x = a; x >= b; x -= c)
#define clr                     cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define all(container)          (container).begin(), (container).end()
#define rall(container)         (container).rbegin(), (container).rend()
#define FILL(x, val)            memset(x, val, sizeof(x))
#define sz(container)           ((int) (container).size())
#define pb                      push_back
#define eb                      emplace_back
#define fi                      first
#define se                      second
#define mod                     (ll)1000000007
#define INF                     (int)0x3f3f3f3f

using namespace std;

#ifdef LOCAL_DEFINE
    #include "../../CLionProjects/Codeforces/library/DEBUG.hpp"
#endif

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
int MAX() {return -INF;}
int MIN() {return INF;}
template<typename T, typename... Args>
T MAX(T a, Args... args) {return max(a, MAX(args...));}
template<typename T, typename... Args>
T MIN(T a, Args... args) {return min(a, MIN(args...));}

typedef long long ll; 
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<long long, long long>> vpll;


int main(void) {    
#ifdef LOCAL_DEFINE
    freopen("in.txt", "r", stdin);
#endif
    
    int a, b;
    while (scanf("%d %d", &a, &b) == 2) {
        int num = a + b, ans = 0;
        while (num) {
            ++ans;
            num /= 10;
        }
        printf("%d\n", ans);
    }

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << '\n';
#endif
    return 0;
}


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

int main(){

  int N, M, X, Y; cin >> N >> M >> X >> Y;
  vector<int> x(N, 0);
  vector<int> y(M, 0);

  for(int i = 0 ; i < N ; ++i){
    cin >> x[i];
  }

  for(int i = 0 ; i < M ; ++i){
    cin >> y[i];
  }


  sort(x.begin(), x.end(), greater<int>());
  sort(y.begin(), y.end());

  // cout << X << "\t" << Y << endl;
  // cout << x[0] << "\t" << y[0] << endl;
  if(x[0] >= y[0] || x[0] >= Y || y[0] <= X) cout << "War" << endl;
  else cout << "No War" << endl;



}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


vector<pii> dist[100005];
ll x[100005]={};
bool ans = true;
void dfs(int l, ll pos=0){
	if( !ans ) return;
	if( x[l] == -1 ) x[l] = pos;
	else return;
	for(auto p: dist[l]){
		int r = p.X;
		int d = p.Y;
		if( x[r] == -1 ){
			dfs(r, x[l] + d);
		}else if( x[r] != x[l] + d ){
			ans = false;
			return;
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	int N, M;
	int cnt[100005]={};

	cin >> N >> M;
	rep(i,M){
		int L, R, D;
		cin >> L >> R >> D;
		L--; R--;
		dist[L].emplace_back(R, D);
		cnt[R]++;
	}

	Fill(x, -1ll);
	rep(n,N) if(cnt[n] == 0){
		dfs(n);
	}

	rep(i,N) if(cnt[i] > 0 && x[i] == -1) ans = false;

	cout << (ans ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 9984
import sys

input = sys.stdin.readline


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


class Graph:
    def __init__(self, n_nodes):
        self.n_nodes = n_nodes
        self.edges = [[float('inf')] * n_nodes for _ in range(n_nodes)]

    def add_edge(self, s, t, d):
        self.edges[s][t] = d
        self.edges[t][s] = d


class FloydWarshall:
    def __init__(self, graph):
        self.graph = graph
        self.distances = [[float('inf')] * graph.n_nodes
                          for _ in range(graph.n_nodes)]
        self._init()

    def _init(self):
        for x in range(self.graph.n_nodes):
            self.distances[x][x] = 0
        for source in range(self.graph.n_nodes):
            for destination, distance in enumerate(self.graph.edges[source]):
                self.distances[source][destination] = distance

    def compute_shortest_path_lengths(self):
        for k in range(self.graph.n_nodes):
            for i in range(self.graph.n_nodes):
                for j in range(self.graph.n_nodes):
                    s = self.distances[i][k] + self.distances[k][j]
                    if s < self.distances[i][j]:
                        self.distances[i][j] = s
        return self.distances


n, m, l = read_i()
graph = Graph(n)
for _ in range(m):
    a, b, c = read_i()
    if c > l:
        continue
    graph.add_edge(a - 1, b - 1, c)
fw = FloydWarshall(graph)
ds = fw.compute_shortest_path_lengths()

graph = Graph(n)
for s in range(n):
    for t in range(n):
        if s >= t:
            continue
        if ds[s][t] > l:
            continue
        graph.add_edge(s, t, 1)
fw = FloydWarshall(graph)
ds = fw.compute_shortest_path_lengths()

q = int(input())
for _ in range(q):
    s, t = read_i()
    s -= 1
    t -= 1
    d = ds[s][t] - 1
    if d == float('inf'):
        print(-1)
    else:
        print(d)

Measured memory_bytes: 84688