akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;

const ll MOD=1e9+7;

//II→factorialを計算するrange
const int II = 1e6+5;
 
ll addMod(ll a,ll b){
      return ((a%MOD)+(b%MOD))%MOD;
}
 
ll mulMod(ll a,ll b){
      return ((a%MOD)*(b%MOD))%MOD;
}
 
ll powMod(ll a,ll b){
      if(b==0) return 1;
      else if(b%2==0){
            ll ret=powMod(a,b/2);
            return ((ret%MOD)*(ret%MOD))%MOD;
      }
      else return ((powMod(a,b-1)%MOD)*(a%MOD))%MOD;
}
ll divMod(ll a,ll b){
      return ((a%MOD)*(powMod(b,MOD-2)%MOD))%MOD;
}
 
ll fact[II+1];
ll invfact[II+1];

void calc(){ //main関数内にcalc();を入れること(前計算)
      fact[0]=1;
      invfact[0]=1;
      rep0(i,II){
            fact[i+1]=mulMod(fact[i],i+1);
            invfact[i+1]=divMod(1,fact[i+1]);
      }
}

int main(){
      string l;
      cin>>l;
      ll n=l.size();
      ll ans=powMod(3,n-1);
      l.push_back('1');
      ll bit1=1;
      for(ll i=1;i<n;i++){
            if(l[i]=='1'){
                  ll pos=powMod(3,n-i-1);
                  pos=mulMod(pos,powMod(2,bit1));
                  ans=addMod(ans,pos);
                  bit1++;
            }
      }
      ans=addMod(ans,powMod(2,bit1));
      cout<<ans<<endl;
      return 0;
}

Measured memory_bytes: 512
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n,k;
    cin >> k >> n;
    int a[n];
    for(int i=0;i<n;++i)
    {
        cin >> a[i];
    }

    int longest = (k - a[n-1]) + a[0];

    for(int i=0;i<n-1;++i)
    {
        longest = max(longest, a[i+1] - a[i]);
    }
    cout << k - longest << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


inline void solve(){

  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  int b[100005];
  FOR(i,n){
    if(s[i]=='1')
      b[i]=1;
    else
      b[i]=-1;
  }
  int a[100005]={};
  int f = -1;
  FOR(i,n){
    if(!i || b[i] != b[i-1])
      f++;
    a[f]+=b[i];
  }
  int c[100005]={};
  int hoge = 0;
  vit x;
  FOR(i,f+1){
    if(a[i] < 0)
      hoge++;
    c[i+1] = c[i]+abs(a[i]);
    if(hoge>k){
      if(a[i] < 0)
        x.bash(c[i+1]-c[i+1-2*k]);
      else
        x.bash(c[i+1] - c[i-2*k]);
    }
    else
      x.bash(c[i+1]);
  }
  sort(ALL(x),greater<int>());
  cout << x[0] fin;
}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 2172
import numpy as np
import copy

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]
c = np.array(c)

ans = 0
change_h = np.array(["." for _ in range(h)])
change_w = np.array(["." for _ in range(w)])

for i in range(2**h):
    for j in range(2**w):
        idx_i, idx_j = [], []
        for ii in range(h):
            if i>>ii & 1:
                idx_i.append(ii)
        for jj in range(w):
            if j>>jj & 1:
                idx_j.append(jj)

        d = copy.deepcopy(c)
        for item in idx_i:
            d[item, :] = change_w
        for item in idx_j:
            d[:, item] = change_h
        x = np.count_nonzero(d == "#")
        if x == k:
            ans += 1
        
print(ans)

Measured memory_bytes: 27200
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int a,b;
	cin >> a >>b;
	if (a % 3 == 0|| b % 3 == 0 || (a + b) % 3 == 0){
		cout  << "Possible" << endl;
	}
	else{
		cout << "Impossible" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/// 11:57 AM 29/03/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;

template<typename T>
void ContainerError(T &v) {
    cout << "{";
    for (auto &x:v) { cout << x << ','; }
    cout << "}" << endl;
    return;
}

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll powmod(ll base, ll exp, ll MOD) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return (res % MOD);
}

ll mpow(ll base, ll exp) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base);
        base = (base * base);
        exp /= 2;
    }
    return (res);
}

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

void update(ll val, ll in, ll n, vector<ll> &tree) {
    while (in <= n) {
        tree[in] += val;
        in += (in & (-in));
    }
    return;
}

ll query(ll in, vector<ll> &tree) {
    ll ans = 0;
    while (in > 0) {
        ans += tree[in];
        in -= (in & (-in));
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll q;
    cin >> q;
    vector<vector<ll> > tree(26, vector<ll>(n + 1, 0));
    for (ll i = 1; i <= n; i++) {
        ll c = s[i - 1] - 'a';
        update(1, i, n, tree[c]);
    }
    while (q--) {
        ll type;
        cin >> type;
        if (type == 1) {
            ll in;
            char cc;
            cin >> in >> cc;
            update(-1, in, n, tree[s[in - 1] - 'a']);
            s[in - 1] = cc;
            update(1, in, n, tree[s[in - 1] - 'a']);
        } else {
            ll l, r;
            cin >> l >> r;
            ll ans = 0;
            for (ll i = 0; i < 26; i++) {
                ll temp = query(r, tree[i]) - query(l - 1, tree[i]);
                ans += ((temp > 0) ? 1 : 0);
            }
            cout << ans << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 106396
S=input()
n1,n2=int(S[:2]),int(S[2:])
isy=lambda n: True
ism=lambda n: n<13 and n>0
isyymm = (isy(n1) and ism(n2))
ismmyy = (ism(n1) and isy(n2))

if isyymm and ismmyy:
    print("AMBIGUOUS")
elif isyymm:
    print("YYMM")
elif ismmyy:
    print("MMYY")
else:
    print("NA")


Measured memory_bytes: 3060
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    mod = 10**9 + 7
    it = map(int, sys.stdin.read().split())
    N = next(it)
    A = list(it)

    ans,  sm = 0, A[-1]
    for i in reversed(range(N-1)):
        ans = (ans + A[i] * sm) % mod
        sm = (sm + A[i]) % mod
    print(ans % mod)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 110560
import java.util.Scanner;

public class Main {
    public static Scanner sc;
    public static void main(String[] args) throws Exception {
        sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if (a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

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

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

int main(){
  ll N; cin >> N;
  ll a[N];
  rep(i, N) cin >> a[i];

  ll ans = 0;
  rep(i, N){
    ans += a[i] - 1;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  
  map<long long,long long> M;
  long long ans=0;
  for(int i=0;i<N;i++){
    ans += M[i-A[i]];
    M[i+A[i]]++;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 27316
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#ifdef ONLINE_JUDGE
  #define debug(x)
  #define debug2(x,y)
  #define debug3(x,y,z)
  #define assert(e) if(!(e)){stod("");}
#else
  #define debug(x) std::cerr<<#x<<": "<<x<<"\n"
  #define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
  #define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"
#endif

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void solve() {
  int a;
  scan(a);
  int ans = a + a*a + a*a*a;
  print(ans);
}

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


Measured memory_bytes: 3224
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;
	static int[] par, dep, ch;

	static void solve() {
		out.println((int)Math.pow((int)Math.sqrt(ir.nextInt()),2));
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int>A(N);
  for (int i = 0; i < N; i ++) cin >> A[i];
  int r = 0;
  int sum = 0;
  int xr = 0;
  long long ans = 0;
  for (int l = 0; l < N; l ++) {
    while (r < N && ((sum + A[r]) == (xr ^ A[r]))) {
      sum += A[r];
      xr = xr ^ A[r];
      //cout << xr << endl;
      r ++;
    }
    //cout << r << endl;
    ans += (long long) r - l;
    if (r == l) r ++;
    sum -= A[l];
    xr = xr ^ A[l];
  }
  cout << ans << endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;

	int ans = -1;
	for (int i = 0; i <= 1000; ++i) {
		if (floor(i * 0.08) == a && floor(i * 0.1) == b) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int n,a[10000010];
int main() {
	std::cin>>n;
	lint ans=0;
	REP(i,n){
		for(int j=i;j<=n;j+=i)a[j]++;
		ans+=(lint)i*a[i];
	}
	std::cout<<ans<<std::endl;
	return 0;
}

Measured memory_bytes: 42688
#include <iostream>
using namespace std;
int main(){
	int rps[5],res[5];
	while(cin>>rps[0]){
		if(!rps[0])break;
		int f1=0,f2=0,f3=0,max=1,min=3;
		for(int i=1;i<5;++i)cin>>rps[i];
		for(int i=0;i<5;++i){
			if(max<rps[i]) max=rps[i];
			else if(min>rps[i]) min=rps[i];
			if(rps[i]==1) f1=1;
			else if(rps[i]==2) f2=1;
			else if(rps[i]==3) f3=1;
		}
		if((f1&&f2&&f3)||max==min) for(int i=0;i<5;++i)res[i]=3;
		else{
			for(int i=0,win=(max%3+1==min%3)?max:min;i<5;++i){
				if(rps[i]==win)res[i]=1;
				else res[i]=2;
			}
		}
		for(int i=0;i<5;++i)cout<<res[i]<<"\n";
	}
	return 0;
}

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

int main(){
    string s, t;
    cin >> s >> t;
    if(s.length()+ 1 != t.length()){
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] != t[i])
        {
        cout << "No" << endl;
        return 0;
        }
        
    }
    
    cout << "Yes"<< endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const LL INF=1<<17;

int main(){
    int N;cin >> N;
    LL K;cin >> K;
    vector<LL> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    vector<LL> x(100,0);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= 60; j++) {
            if(a[i]&(1LL<<j)) x[j]++;
        }
    }
    LL t=0;
    int k=0;
    LL p=K;
    while(p){
        k++;
        p/=2;
    }
    bool c=true;
    for (int i = k; i >=0 ; i--) {
        if(2*x[i]<N){
            if(c) t+=K&(1LL<<i);
            else t+=1LL<<i;
            continue;
        }
        else if((1LL<<i)&K) c=false;
    }
    LL ans=0;
    for (int i = 0; i < N; i++) {
        ans+=t^a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }
// 桁和
LL Ketawa_s(string s) { LL a = 0; FOR(i, 0, s.length())a += s[i] - '0'; return a; }

//二項係数 nCk mod pを求める
const LL MAX = 510000, p = 998244353; LL fac[MAX], finv[MAX], inv[MAX];
/* 前処理 */void COM_init() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, MAX) { fac[i] = fac[i - 1] * i % p; inv[i] = p - inv[p%i] * (p / i) % p; finv[i] = finv[i - 1] * inv[i] % p; } }
/* 主処理 */LL 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] % p) % p; }

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

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

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	string s;
	cin >> s;
	int ans = 0;
	FOR(i, 0, s.length()) {
		if (s[i] == '2')ans++;
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
template<typename T> inline void add(T& a, T b) { a += b; if (a >= MOD) a -= MOD; }
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  long double r;
  cin >> r;
  long double ans = r * (long double)2 * 3.14159265358979323846;
  cout << std::fixed << std::setprecision(20) << ans << endl;
}

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

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


//naosu
long int gcd(long int a,long int b){
  long int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


long int lcm(long int a,long int b){
  return a/gcd(a,b)*b;
}


long int f(long int n,long int c,long int d){
  long int cnt=n/c+n/d-n/lcm(c,d);
  return n-cnt;
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  int n;
  scanf("%d",&n);

  int N=n;
  int sum=0;
  while(n>0){
    sum+=n%10;
    n/=10;
  }

  if(N%sum==0){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 1636
#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
int out=0;

void change( int n,int r )
{
     if( n )
     {
         change( n / r, r );
       out++;
     }
 }
int main()
{
    int n,k;
    cin>>n>>k;
    change(n,k);
    cout<<out<<endl;
}


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

#define rep(i,n)  for(int i=0;i<n;++i)
#define sc1(a)  scanf("%d",&a)

int main(){
    int n;
    long ans=0l;
    sc1(n);
    vector <int> a(n);
    vector <int> b(n);
    vector <int> c(n);
    rep(i,n) sc1(a[i]);
    rep(i,n) sc1(b[i]);
    rep(i,n) sc1(c[i]);
    sort(a.begin(),a.end());
    sort(c.begin(),c.end());
    rep (i,n) {
        //printf("%ld %d\n",lower_bound(a.begin(),a.end(),b[i])-a.begin(),n-*upper_bound(c.begin(),c.end(),b[i]));
        ans+=(lower_bound(a.begin(),a.end(),b[i])-a.begin())*(c.end()-upper_bound(c.begin(),c.end(),b[i]));
        //ans+=*lower_bound(a.begin(),a.end(),b[i])*(n-*upper_bound(c.begin(),c.end(),b[i])+1);
    }
    printf("%ld\n",ans);
    return 0;
}


Measured memory_bytes: 4596
N = int(input())
H = [i for i in map(int, input().split())]
ans ='Yes'
temp_max =H[0]
for idx in range(N):
  if temp_max - H[idx] > 1:
    ans = 'No'
    break
    
  if temp_max < H[idx]:
    temp_max=H[idx]
  
print(ans)
    

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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

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

#define MAX_V 100000

#define MOD 1000000007L
#define INF 2147483647

signed main() {
	int N, K;
	cin >> N >> K;
	ll res = K * pow((K - 1), (N - 1));
	cout << res << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] S = new String[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.next();
        }
        boolean first = true;
        TreeMap<String, Integer> map = new TreeMap<>();
        for (String line : S) {
            HashMap<String, Integer> tmp = new HashMap<>();
            for (int i = 0; i < line.length(); i++) {
                String ch = line.substring(i, i + 1);
                if (tmp.containsKey(ch)) {
                    tmp.put(ch, tmp.get(ch) + 1);
                } else {
                    tmp.put(ch, 1);
                }
            }

            for (String ch : tmp.keySet()) {
                if (map.containsKey(ch) && map.get(ch) > 0) {
                    if (tmp.get(ch) < map.get(ch)) {
                        map.put(ch, tmp.get(ch));
                    }
                } else {
                    if (first) {
                        map.put(ch, tmp.get(ch));
                    } else {
                        map.put(ch, 0);
                    }
                }
            }

            for (String ch : map.keySet()) {
                if (!tmp.containsKey(ch)) {
                    map.put(ch, 0);
                }
            }
            first = false;
        }
        StringBuffer ans = new StringBuffer();
        for (String ch : map.keySet()) {
            for (int i = 0; i < map.get(ch); i++) {
                ans.append(ch);
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21972
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 3e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;



int main() {
    int n=read();
    __int128 res=1;
    int f1=0, f2=0;
    for(int i=1; i<=n; ++i) {
        ll x; cin>>x;
        res*=x;
        if(res>1000000000000000000ll) f1=1;
        if(x==0) f2=1;
    }
    if(f2) printf("0\n");
    else if(f1) printf("-1\n");
    else cout<<ll(res)<<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,ans;scanf("%d%d",&n,&k);
    if(n%k==0)
    {
        printf("0");
        return 0;
    }
    else
    {
        printf("1");
        return 0;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
using namespace std;
 
int main(){
    int c[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++)cin>>c[i][j];
    }
bool s=false,t=false;
    for(int a1=0;a1<100;a1++){
        int b1=c[0][0]-a1,b2=c[0][1]-a1,b3=c[0][2]-a1;
        if(c[1][0]-b1==c[1][1]-b2&&c[1][0]-b1==c[1][2]-b3)s=true;
        
        if(s&&c[2][0]-b1==c[2][1]-b2&&c[2][0]-b1==c[2][2]-b3){
            t=true;
            break;
        }
    }
    if(t)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main(){
	

	int n;
	ll sum = 0;
	int card[200000] = { 0 };
	ull ans = INF*INF;
	ll sunuke = 0;

	cin >> n;
	rep(i, 0, n) {
		cin >> card[i];
		sum += card[i];
	}

	rep(i, 0, n-1) {
		sunuke += card[i];
		if (abs(sum) == abs(sunuke)) {
			cout << 0 << endl; return 0;
		}
		ans = min((ull)abs(2*sunuke - sum), ans);
	}

	cout << ans << endl;

	return 0;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int A[1000000], n;

bool bin(int key) {
    int left = 0;
    int right = n - 1;

    while ( left <= right ) {
        int mid = (left + right) / 2;
        if (A[mid] == key) return true;
        if (A[mid] < key) left = mid + 1; // ???????????¢?´¢
        else if (A[mid] > key) right = mid - 1; // ???????????¢?´¢
    }
    return false;
}

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

    int q, sum = 0;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int k;
        cin >> k;
        if ( bin(k) ) {
            sum++;
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3396
#include <stdio.h>

int main ()
{
    int A,B;

    scanf("%d",&A);
    scanf("%d",&B);

    if ((A==1 && B==2) || (A==2 && B==1))
    {
        printf("3\n");
    }
    else if ((A==1 && B==3) || (A==3 && B==1))
             {
                 printf("2\n");
             }
    else
        {
            printf("1");
        }

return 0;
}


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

const int N = 1e5 + 5;
long long dp[N];
vector<int>a[N];
vector<bool>isvisited(N, false);
const int m = 1e9 + 7;
long long solve(int u,int p){
    if(dp[u] != -1)return dp[u];
    long long ans1 = 1,ans2 = 1;
    for(auto v: a[u]){
        if(v == p) continue;
        ans1 = (ans1 * solve(v, u)) % m;
        for(auto w : a[v]){
            if(w == u) continue;
            ans2 = (ans2 * solve(w,v)) % m;
        }
    }
    dp[u] = (ans1 + ans2)%m;
    return dp[u];
}
int main(){
    int n, x, y;
    cin >> n;
    for(int i = 1; i < n; i++){
        cin >> x >> y;
        x --, y --;
        a[x].push_back(y);
        a[y].push_back(x);
    }
    memset(dp, -1, sizeof(dp));  
    solve(0, -1);
    cout << dp[0] << endl;
}

Measured memory_bytes: 14848
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
int main(){
    int n;cin>>n;
    long long sum=0;
    for(int i=1;i<=n;i++){
        if(i%3==0&&i%5==0) continue;
        if(i%3==0) continue;
        if(i%5==0) continue;
        sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define m_p			make_pair
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i =a, i>=b;i--)
#define sz(x)       (int)x.size()
#define F			first
#define S			second
#define debug(x)	for(int i=0;i<x;i++) cout<<"##########"<<endl
#define M			1000000007
#define ll			long long int
#define lMax		LLONG_MAX
#define pii 		pair<int ,int >
#define	all(a)		a.begin(), a.end()
#define vi 			vector<int> 
#define vii 		vector<pii>

// queue<int> , prefix_sum(a,a+n) , reverse(a,a+n) , priority_queue <int> max heap , priority_queue <int, vector<int>, greater<int> > min heap;
// == > != precedence gretaer then & , << precedence greater than <= == => , 
//int chk, cnt, fl, pos, in, src, tar, val, res. dummy;  fill (myvector.begin(),myvector.begin()+4,5), freq;

void solve()
{
	int k; cin>>k;
	int last=0;
	
	rep(i,0,1000000)
	{
		last=(last*10+7)%k;
		
		if(last==0)
		{
			cout<<i+1<<endl;
			return;
		}
	}
	cout<<"-1\n";
}

signed main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3648
from itertools import product
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
ans = INF

def calc(a, b, c):
    la, lb, lc = len(a), len(b), len(c)
    if la + lb + lc < 3 or 0 in (la, lb, lc): return INF
    sa, sb, sc = sum(a), sum(b), sum(c)
    t = 0
    return abs(sa-A) + abs(sb-B) + abs(sc-C) + (la+lb+lc-3) * 10

def dfs(n, a, b, c):
    global ans
    if n == N:
        ans = min(ans, calc(a, b, c))
        return
    dfs(n+1, a, b, c)
    dfs(n+1, a+[l[n]], b, c)
    dfs(n+1, a, b+[l[n]], c)
    dfs(n+1, a, b, c+[l[n]])

dfs(0, [], [], [])
print(ans)


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

int main()
{
    int h, w;
    std::cin >> h >> w;

    std::vector<std::string> c(h * 2);

    for (int i = 0; i < h; i++) {
        std::cin >> c[i * 2];
        c[i * 2 + 1] = c[i * 2];
    }

    for (int i = 0; i < 2 * h; i++) {
        std::cout << c[i] << std::endl;
    }
}


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

int main() {
	int s_size, first, last;
	int rev;
	string s;
	first = -1;
	last = -1;

	cin >> s;
	s_size = s.size();
	rev = s_size;
	for (int i = 0; i < s_size; i++) {
		if (s[i] == 'A' && first == -1) {
			first = i;
		}

		if (s[rev] == 'Z' && last == -1) {
			last = rev;
		}
		if (first != -1 && last != -1) {
			break;
		}
		rev--;
	}
	cout << last - first + 1 << endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<pair<int, int> > task(N);
    int a,b;
  for(int i = 0;i < N;i++){
    cin >> a >> b;
    task[i] = make_pair(b,a);
  }
  sort(task.begin(),task.end());

  int sum = 0;
  int judge = 1;

  for(int i = 0;i < N;i++){
    sum += task[i].second;
    //cout << sum << endl;
    if(sum > task[i].first){
      judge = 0;
      break;
    }
    //cout << task[i].first << " " << task[i].second << " " << sum << endl;
  }
  if(judge == 1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 4768
//abc070_b.cpp
//Wed Oct 31 22:47:28 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;

	int ans = 0;
	if (a <= c){
		if (c <= b){
			if (d <= b){
				ans = d-c;
			}else {
				ans = b-c;
			}
		}else {
			ans = 0;
		}
	}else{
		if (a <= d){
			if (b <= d){
				ans = b-a;
			}else {
				ans = d-a;
			}
		}else {
			ans = 0;
		}
	}
	cout << ans << endl;
}

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

int main() {
	
    int a,b ;    
    cin >> a >> b ;
    
    int ans ;
    if(a>=13)
    {
      ans = b ;
    }else if(a<13 && a>=6)
    {
      ans = b/2 ;
    }else
    {
      ans = 0 ;
    }
      cout << ans << endl ;
  

	return 0;
}


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

int main()
{
    int n = 0;
    string s;

    cin >> n;
    cin >> s;

    // Counting west gorup
    int* westGroupCount = new int[n];
    int* eastGroupCount = new int[n];
    for(int i = 0; i < n; i++)
    {
        westGroupCount[i] = 0;
        eastGroupCount[i] = 0;
    }

    for(int i = 1; i < n; i++)
    {
        westGroupCount[i] = westGroupCount[i - 1] + (s[i - 1] == 'W' ? 1 : 0);
    }

    // Counting east group
    for(int i = n - 2; i >= 0; i--)
    {
        eastGroupCount[i] = eastGroupCount[i + 1] + (s[i + 1] == 'E' ? 1 : 0);
    }

    int minCount = INT_MAX;
    for(int i = 0; i < n; i++)
    {
        int count = westGroupCount[i] + eastGroupCount[i];
        if(count < minCount)
        {
            minCount = count;
        }
    }

    cout << minCount;

    return 0;
}


Measured memory_bytes: 2948
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD=1e9+7;

main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n,m;cin>>n>>m;
    vector<int>edges[n];
    for(int i=0;i<m;i++){
        int u,v;cin>>u>>v;u--;v--;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }

    int visit[n]={0};
    int cost;
    function<void(int)>dfs=[&](int s){
        visit[s]=1;
        cost++;
        for(auto x:edges[s]){
            if(!visit[x])   dfs(x);
        }
    };


    int ans=0;
    for(int i=0;i<n;i++){
        if(!visit[i]){
            cost=0;
            dfs(i);
            ans=max(ans,cost);
        }
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 27640
#include<stdio.h>

int main(void){
  
  int A,B,C,D;
  
  scanf("%d %d %d %d",&A,&B,&C,&D);
  
  if(A*B > C*D){
    printf("%d",A*B);
  }else{
    printf("%d",C*D);
  }
  
  return 0;
}
    

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

typedef long long ll;

using namespace std;

int N, K;
const int MAX_N = 5000;
const int MAX_K = 5000;
int a[MAX_N+1];

// fact: If x is necessary, y(>x) is necessary.
// proof:
//  x is necessary, so [K-x,K) can be created without x.
//  If The group creating [K-x,K)
//   case1. do not include y:
//    It means [K-x,K) can be created without y.
//    And [K-y,K) includes [K-x,K).
//    Therefore y is necessary.
//   case2. include y:
//    Replacing y with x decreases the number by (y - x).
//    It means [K-x-(y-x),K-(y-x)) = [K-y,K-y+x) is generated.
//    [K-y,K) includes [K-y,K-y+x).
//    Therefore y is necessary.
//  Therefore y is necessary.

bool isNecessary(int i){
    if(a[i] >= K){
        return true;
    }
    eprintf("i=%d\n",i);
    bool dp[MAX_N+1][MAX_K+1];
    fill(dp[0], dp[0] + (MAX_N+1) * (MAX_K+1), false);
    REP(j, 0, N+1) {
        dp[j][0] = true;
        if(j == 0) continue;
        else if(i == j){
            REP(k, 0, K) dp[j][k] = dp[j-1][k];
        }else{
            REP(k, 0, K){
                if(dp[j-1][k]){
                    // not use j
                    dp[j][k] = true;
                    // use j
                    if(k + a[j] < K){
                        dp[j][k+a[j]] = true;
                    }
                }
            }
        }
    }
    REP(k, K-a[i], K){
        if(dp[N][k]){
            return true;
        }
    }
    REP(j, 1, N+1){
        REP(k, 0, K){
            if(dp[j][k]) eprintf("i=%d,j=%d,k=%d: true\n",i,j,k);
        }
    }
    return false;
}

// returning i means a[1],a[2],...,a[i-1] is not necessary and the others are necessary.
int minNecessaryNumber(){
    int l = 1, r = N;
    while(r - l >= 1){
        eprintf("l=%d,r=%d\n",l,r);
        int i = (l + r) / 2;
        eprintf("i=%d\n",i);
        if(isNecessary(i)){
            if(i == 1) return 1;
            else if(!isNecessary(i-1)) return i;
            else r = i;
        }
        else{
            l = i + 1;
        }
    }
    if(isNecessary(r)) return r;
    else return r+1;
}

int solve() {
    sort(a+1,a+N+1);
    return minNecessaryNumber() - 1;
}

int main() {
    // to shorten execution time for iostream
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> K;
    REP(i,1,N+1){
        cin >> a[i];
    }
    cout << solve() << "\n";
    return 0;
}


Measured memory_bytes: 24832
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int n;
    cin>>n;
    int b=0;
    vector<int> a(n);
    REP(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    REP(i,n) b+=a[i];
    if(b%10!=0){
        cout<<b;
        return 0;
    }else{
        REP(i,n){
            if(a[i]%10!=0){
                cout<<b-a[i];
                return 0;
            }
        }
    }
    cout<<0;
    return 0;
}


Measured memory_bytes: 256