akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll minn=9999999999999;
ll n,s;
ll f(ll b,ll n)
{
	if(n<b)
		return n;
	else
		return f(b,n/b)+(n%b);
}
int main()
{
	ll be=minn;
	scanf("%lld %lld",&n,&s);
	if(n==s)
	{
		printf("%lld\n",n+1);
		return 0;
	}
	else if(s>n)
	{
		printf("-1\n");
		return 0;
	}
	ll maxn=sqrt(n)+1;
	for(ll i=2; i<=maxn; i++)
	{
		if(f(i,n)==s)
		{
			minn=i;
			break;
		}
	}
	ll del=n-s;
	for(ll i=1; i<=sqrt(del); i++)
	{
		if(del%i==0)
		{
			ll tem=del/i+1;
			if(f(tem,n)==s)
				minn=min(minn,tem);
		}
	}
	if(minn!=be)//zz
		printf("%lld\n",minn);
	else
		printf("-1\n");
	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
m=[abs(0-A[0])]*(N+1)
for i in range(1,N):
    m[i]=abs(A[i]-A[i-1])
m[-1]=abs(0-A[-1])
a=sum(m)
A.append(0)
for i in range(N):
    print(a+abs(A[i-1]-A[i+1])-(abs(A[i-1]-A[i])+abs(A[i]-A[i+1])))

Measured memory_bytes: 20640
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

ll x[1000100], sum[1000100];

int
main(void){  
  ios_base::sync_with_stdio(false);

  ll n, m;  
  cin >> n >> m;
  REP(i, m) cin >> x[i];
  
  if(m == 1 || n >= m){cout << "0" << endl; return 0;}
  
  sort(x, x+m);
  vector<ll> diff;
  
  REP(i, m-1){
    diff.push_back(x[i+1]-x[i]);
    sum[i+1] = sum[i] + diff[i];
  }
  
  //REP(i, m) cout << sum[i] << endl;
  //REP(i, diff.size()) cout << "d:" << diff[i] << endl;
  
  sort(diff.begin(), diff.end(), greater<ll>());

  ll mns = 0LL;
  REP(i, n-1) mns += diff[i];
  //cout << mns << endl;
  cout << sum[m-1] - mns << endl;
  
  return 0;
}


Measured memory_bytes: 6008
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using dl=long double;

int main()
{
    ll n,d;
    cin>>n>>d;
    ll ans=0;
    for(int i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        ll k =x*x+y*y;

        if(k<=d*d)ans++;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3628
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
c = input()
print(alphabet[alphabet.index(c)+1])

Measured memory_bytes: 2940
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    int sum = 0, ans = 0;
    rep(i, n) {
        ans += sum * a[i];
        ans %= mod;
        sum += a[i];
        sum %= mod;
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 4744
#include<stdio.h>
int main()
{
  int A,B;
  
  scanf("%d %d",&A,&B);
  
  
  if(A<=9 && A>=1 && B<=9 && B>=1){
    printf("%d",A*B);
  }
  
  else{
    printf("-1");
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {    
        Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();
      int m=sc.nextInt();
      int ans[]=new int[m];
      int k=sc.nextInt();
      for(int i=0;i<m;i++)ans[i]=sc.nextInt();
      int aaa=0;
      for(int i=0;i<n;i++){
      	int po=0;
        for(int j=0;j<m;j++){
        po+=ans[j]*sc.nextInt();
        }
        if(po+k>0)aaa++;
      }
      System.out.println(aaa);
    }
}


Measured memory_bytes: 24276
import sys 
from collections import deque
N = int(input())
A = list(map(int, input().split()))


if N == 1:
    print(A[0])
    sys.exit()

mae = deque()
usiro = deque()

#0の時に前 1の時に後ろ
Flag = 0

for i in reversed(range(0,N,1)):
    
    if Flag == 0: # 前の時
        mae.append(str(A[i]))
        mae.append(" ")
        Flag = 1
    else:
        usiro.insert(0,str(A[i]))
        usiro.appendleft(" ")
        Flag = 0

moziretu = (mae + usiro)
del moziretu[((len(moziretu))//2)]
moziretu = ''.join(moziretu)
print(moziretu)
  
  




Measured memory_bytes: 41300
n = int(input())
l = [list() for _ in range(n)]
for _ in range(n-1):
  a,b = map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

def dfs(p):
  dep = [None]*n
  dep[p] = 0
  q = [p]
  while q:
    v = q.pop()
    for x in l[v]:
      if dep[x] is None:
        dep[x] = dep[v] + 1
        q.append(x)
  return dep
      
dep = dfs(0)
p = dep.index(max(dep))
dep = dfs(p)
q = max(dep)-1
print("First" if q%3 else "Second") 

Measured memory_bytes: 55088
N = int(input())
s1 = input()
s2 = input()

MOD = 10 ** 9 + 7

ans = 1
i = 0
if s1[0] == s2[0]:
    ans *= 3
    i += 1
elif s1[0] == s1[1] and s2[0] == s2[1]:
    ans *= 3 * 2
    i += 2

t = (s1[0] == s2[0])  # 直前が縦
while i < N:
    if t:
        ans *= 2
        ans %= MOD
    else:
        if i + 1 < N:
            if s1[i] == s1[i + 1] and s2[i] == s2[i + 1]:
                ans *= 3
                ans %= MOD
    t = (s1[i] == s2[i])
    i += 1 if t else 2

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); ++i)
using namespace std;
typedef long long ll;

int main()
{
    string s;
    cin >> s;
    rep(i, s.length())
    {
        cout << 'x';
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;

int a,n;
int main()
{
  cin >> n  ;
  cin >> a  ;
  if(a >= n % 500) cout<< "Yes";
  else cout<< "No";
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll A,B,C; cin >> A >> B >> C;
    ll k = min(A+B+1,C);
    cout << k + B << endl; 
}


Measured memory_bytes: 256
import java.util.*;

public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		
      	int[] numlist  = new int[5];
      	int k;
      
      	for(int i=0;i<5;i++){
        	numlist[i] = sc.nextInt(); 
        }
      	k = sc.nextInt();
      	if((numlist[4] - numlist[0])>k){
        	System.out.println(":("); 
        }else{
         	System.out.println("Yay!") ;
        }
      	
    }
}

Measured memory_bytes: 22740
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();

		int result = Integer.MAX_VALUE;
		for (int i = 0; i <= x; i++) {
			int sum = 0;
			sum += i * a;
			int rx = x - i;
			if (rx > y) {
				sum += c * 2 * rx;
			} else {
				int diff = y - rx;
				sum += Math.min(c * 2 * rx + diff * b, c * 2 * y);
			}
			result = Math.min(sum, result);
		}
		System.out.println(result);
		sc.close();
	}
}

Measured memory_bytes: 35648
#include <bits/stdc++.h>
#define int long long
using namespace std;

class Combination{
public:
  typedef long long ll;
  ll N;
  ll mod;
  vector<ll> fac;
  vector<ll> finv;
  vector<ll> inv;
  
  
  Combination(ll N = 1e6,ll mod = 1e9 + 7): N(N), mod(mod), fac(N+1), finv(N+1), inv(N+1){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i <= N; 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;
    }
  }

  function<ll(ll,ll)> get = [&](ll n,ll r){
    if( n < r ) return 0LL;
    if( n < 0 || r < 0) return 0LL;
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod;
  };
  //auto nCr = (new Combination())->get;
};


signed main(){
  
  Combination C = Combination();
  
  int N, K;
  cin>>N>>K;
  
  for(int i=1;i<=K;i++){
    
    int Bulcnt = K - i;
    
    int A = C.get(Bulcnt+i-1,i-1);
    
    int Redcnt = (N-K)-(i-1);
    
    if( Redcnt >= 0 ){
      cout<<A*C.get(i+Redcnt,Redcnt)%C.mod<<endl;
    }
    else{
      cout<<0<<endl;
    }
    
  }
  
  return 0;
}


Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    int n;
    int k;
    cin>>n>>k;
    vi a(n);
    REP(i,0,n){
        cin>>a[i];
    }
    vi within(n,0);
    vi across(n,0);
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(a[j]<a[i]){
                within[i]++;
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(a[j]<a[i]){
                across[i]++;
            }
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        ans=(ans+((within[i])*(k))%mod)%mod;
    }
    for(int i=0;i<n;i++){
        int pro=(k)*(k-1)/2;
        pro=pro%mod;
        ans=(ans+(pro*across[i])%mod)%mod;
    }
    cout<<ans<<"\n";



    return 0;
}

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

typedef long long int ll;
typedef vector<int> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<int, int> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define in insert
#define mp(a, b) make_pair(a, b)
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define INF INT_MAX
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
	while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
	int k, a, b;
	cin>>k>>a>>b;
	int diff = b/k - (a-1)/k;
	if(diff)
		cout<<"OK"<<endl;
	else
		cout<<"NG"<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	int t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 3628
main(m,d){for(;scanf("%d%d",&m,&d)*m;printf("%sday\n","Wednes\0Thurs\0 Fri\0   Satur\0 Sun\0   Mon\0   Tues"+7*(((m<3?0:2)+((m+9)%12*13+47)/5+d)%7)));}

Measured memory_bytes: 596
S = input()

# S = 'AaCa'
# print( S[1], S[-1], S[3:-2])

b = True
b = b and (S[0]=='A')
b = b and ( S[2:-1].count('C')==1 )

b = b and ( 'a' <= S[1] <= 'z')
b = b and ( 'a' <= S[-1] <= 'z')

for c in S[3:]:
  b = b and ( ('a' <= c <= 'z') or (c=='C') )

print( "AC" if b else "WA" )


Measured memory_bytes: 8988
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    println(problem143a(a, b))
}

fun problem143a(a: Int, b: Int): Int {
    val ans = a - b * 2
    return if (ans < 0) 0 else ans
}

Measured memory_bytes: 31400
/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

int N, A, B;
int finalAns;

int main()
{
	scanf("%d %d %d", &N, &A, &B);
	finalAns = min(N * A, B);
	printf("%d\n", finalAns);
	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 20020
#define ll long long
using namespace std;
inline int read(){
  int x=0,f=1;char ch=getchar();
  while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
  while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
  return f?x:-x;
}
int p[N], a[N], b[N];
int main(int argc, char const *argv[]) {
  int n = read();
  for (int i = 1; i <= n; ++ i) {
    p[i] = read();
    a[i] = i           * N;
    b[i] = (n - i + 1) * N;
  }

  for (int i = 1; i <= n; ++ i) {
    a[p[i]] += i;
  }


  for (int i = 1; i <= n; ++ i) {
    printf("%d ", a[i]);
  } puts("");
  for (int i = 1; i <= n; ++ i) {
    printf("%d ", b[i]);
  } puts("");

  return 0;
}

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

int main(void){
    int n;
    std::cin >> n;
    std::vector<int> num(1000005,0);
    
    rep(i,n-1){
        int t;
        std::cin >> t;
        num[t]++;
    }
    repi(i,1,n+1){
        std::cout << num[i] << std::endl;
    }
    
}

Measured memory_bytes: 7220
int pr[200000],p[100000];
main(i,j,k){
  for(k=1,i=2;i<200000;i++)
    if(!pr[i])
      for(p[k++]=i,j=i*2;j<200000;j+=i)pr[j]=1;
  for(k=1;k<10001;k++)
    p[k]+=p[k-1];
  for(;scanf("%d",&i),i;printf("%d\n",p[i]));
  return 0;
}

Measured memory_bytes: 1456
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    for(long long i=n;i>=1;i--)
    {
        double d=sqrt(i);
        if(d-floor(d)==0)
        {
            cout<<i<<"\n";
            break;
        }
    }
    
    return 0;
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    if(s <= "2019/04/30"){
        cout << "Heisei" << endl;
    }
    else{
        cout << "TBD" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef vector<int>vi;
typedef pair<int,int>pi;
typedef vector<pi>vpi;
typedef vector<vi>vvi;
#define double long double
#define pow powl
#define sqrt sqrtl
#define cbrt cbrtl
#define floor floorl
#define ceil ceill
#define pb push_back
#define ep emplace_back
#define PB pop_back
#define pf push_front
#define ef emplace_front
#define PF pop_front
#define mp make_pair
#define ub(a,b) upper_bound(all(a),b)-a.begin()
#define lb(a,b) lower_bound(all(a),b)-a.begin()
#define bs(a,b) binary_search(all(a),b)
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) FOR(i,0,n-1) cin>>a[i]
#define in1(a,n) FOR(i,1,n) cin>>a[i]
#define ff first
#define ss second
#define out(a,n) FOR(i,0,n-1) cout<<a[i]<<" ";cout<<endl;
#define out1(a,n) FOR(i,1,n) cout<<a[i]<<" ";cout<<endl;
#define clr(a) a.clear()
#define pow2(a) (1LL<<a)
#define all(a) a.begin(),a.end()
#define all1(a) a.begin()+1,a.end()
#define rall(a) a.rbegin(),a.rend()
#define rall1(a) a.rbegin(),a.rend()
#define sz(a) ((int)a.size())
#define FOR(i,a,b) for(auto i=a;i<=b;i++)
#define NFOR(i,a,b) for(auto i=a;i>=b;i--)
const int mod=1e9+7;

inline int add(int a,int b){return (a%mod + b%mod)%mod;}
inline int sub(int a ,int b){return (a%mod - b%mod + mod)%mod;}
inline int mul(int a,int b){return (a%mod * b%mod)%mod;}
inline int power(int a,int b,int MOD){int res=1;while(b){if(b&1){res*=a;res%=MOD;}a=a*a;a%=MOD;b>>=1;}return res;}

#define trace(x) cout<<#x<<" :: "<<x<<endl;
#define trace2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define trace3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define trace4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
vector<int>forbidden;
bool check(int n)
{
	  while(n>0)
	  {
             if(bs(forbidden,n%10))
             	return false;
             n/=10;
	  }
	  return true;
}
signed main()
{
     SPEED;
     int x,n;
     cin>>x>>n;
     while(n--)
     {
     	   int x;
     	   cin>>x;
     	   forbidden.pb(x);
     }
     sort(all(forbidden));
     for(;;x++)
     {
     	  if(check(x))
     	  {
     	  	  cout<<x<<endl;
     	  	  break;
     	  }
     }
     time();
     return 0;
}

Measured memory_bytes: 256
n = int(input().rstrip())
if n==1:
    print(0)
else:
    MOD = 1_000_000_007
    a = 1
    b = 1
    c = 1
    for i in range(n):
        a = (a*10)%MOD
        b = (b*9)%MOD
        c = (c*8)%MOD
    print((a-b-b+c+MOD+MOD)%MOD)

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
const int INF = 2*1e9;
// int recur(vector<int>&A,vector<int>&dp,int i){
//   if(i>=A.size())
//     return 0;
  
// //   if(dp[i]!=INF)
// //     return dp[i];
    
// //   if(i+1<A.size()){
// //     int cost1 = abs(A[i]-A[i+1]) + recur(A,dp,i+1);
// //     dp[i]=min(dp[i],cost1);
// // 	}
// //   if(i+2<A.size()){
// //     int cost2 = abs(A[i]-A[i+2]) + recur(A,dp,i+2);
// //     dp[i]=min(dp[i],cost2);
// //   }
  
//   return min(abs(A[i]-A[i+1]) + recur(A,dp,i+1),abs(A[i]-A[i+2]) + recur(A,dp,i+2)) ;
// }
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> A(n);
  int a;
  for(int i=0;i<n;i++){
    cin>>a;
    A[i]=a;
  }
  
  vector<int> dp(n,INF);
  dp[0]=0;
  for(int i=0;i<n;i++){
      for(int   j=i+1;j<=(i+k);j++){
          if(j<n)
          dp[j] = min(dp[j],dp[i]+abs(A[i]-A[j]));
          
      }
  }
  
    cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
    int n,i;
    cin>>n;
    long long a[88];
    a[0]=2;
    a[1]=1;
    for(i=2;i<=n;i++){
        a[i]=a[i-1]+a[i-2];
    }
    cout<<a[n];

    return 0;
}


Measured memory_bytes: 3600
#include <stdio.h>
#define LEN 100005

struct process {
    char name[100];
    int ntime;
};
struct process A[LEN];
int head,tail;


void enqueue(struct process x)
{
    A[tail] = x;
    tail = (tail + 1) % LEN;
}

struct process dequeue()
{
    struct process x = A[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a, int b)
{
    return a < b ? a : b;
}

int main() {
    struct process y;
    int n,q,i,c,t=0;

    scanf("%d %d", &n,&q);
    for ( i = 0; i < n; ++i) {
        scanf("%s",A[i].name);
        scanf("%d",&A[i].ntime);
    }
    head = 0; tail = n;
    while (head != tail) {
        y = dequeue();
        c = min(q,y.ntime);
        y.ntime -= c;
        t += c;
        if (y.ntime > 0) enqueue(y);
        else printf("%s %d\n",y.name,t);
    }
    return 0;
}


Measured memory_bytes: 11852
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
  int n; ll k; cin >> n >> k;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  //sort(all(A), greater<ll>());

  ll ng = 0, ok = INF;
  while(ok - ng > 1){
      ll mid = (ng + ok) / 2;
      ll cnt = 0;
      rep(i, n){
          ll tmp = A[i] / mid;
          if(A[i] == mid)continue;
          ll num = ceil(A[i] /(double)(tmp + 1));
          //if(mid==5)cout <<"num:" << num << ln;
          //if(num > mid)tmp++;
          //if(mid==5)cout << "tmp:" << tmp << ln;
          cnt += tmp;
      }
      //cout << "mid:" << mid << " cnt:" << cnt << ln;
      if(cnt <= k)ok = mid;
      else ng = mid;
  }
  cout << ok << ln;
}
    


Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
typedef  long long     ll ;
typedef  unsigned long long ull;
const double EPS= (1e-9);
using namespace std;
int getBit(int num, int idx) {return ((num >> idx) & 1) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(int num, int idx) {return num ^ (1<<idx);}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
const int N=100000+9,mod=1000000000+7;
ll cnt[N],fres[N];
void go(int n){

   for(int i=1;i*i<=n;i++){

       if(n%i==0){
         cnt[i]++;
         if(n/i!=i) cnt[n/i]++;
       }

   }
}
ll power(ll b,ll p){

   if(p==0) return 1;
   if((p&(1ll))){
     return b%mod*power((b*b)%mod,p/2)%mod;
   }
   else{
    return  power((b*b)%mod,p/2);
   }
}
int main(){

    int n,k;
    cin>>n>>k;
    for(int i=1;i<=k;i++){
        go(i);
    }
    ll ans=0;
    for(ll i=k;i>=1;i--){
        fres[i]=power(cnt[i],n);
         for(ll j=i*2;j<=k;j+=i){
            fres[i]=((fres[i]-fres[j])+mod)%mod;
         }
         ans+= (1ll*fres[i]*i)%mod;
         if(ans>=mod) ans-=mod;

    }
    cout<<ans<<"\n";
}



















Measured memory_bytes: 5208
#include <algorithm>
#include <iostream>

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

using namespace std;

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int nums[3] = { a, b, c };

    sort(nums, nums + SIZE_OF_ARRAY(nums));
    int sum = nums[2] * 10 + nums[1] + nums[0];

    cout << sum << endl;
}

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

int main() {
	int a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
	if(a+b>2*c){
		if(x>y){
			if(a>2*c){
				cout<<x*2*c<<endl;
			}else{
				cout<<y*2*c+(x-y)*a<<endl;
			}
		}else{
			if(b>2*c){
				cout<<y*2*c<<endl;
			}else{
				cout<<x*2*c+(y-x)*b<<endl;
			}
		}
	}else{
		cout<<a*x+b*y<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	boolean isprime[] = new boolean[100001];
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Main main =new Main();
		main.sieve();
		int primeCount[]=new int[100001];
		int count =0;
		for(int i=0;i<=100000;i++) {
			if(main.isprime[i]==true&&main.isprime[(i+1)/2]==true) {
				count ++;
			}
			primeCount[i] =count;
		}
		int Q= sc.nextInt();
		for (int i=0;i<Q;i++) {
			int l= sc.nextInt();
			int r =sc.nextInt();
			if (l==r) {
				if (main.isprime[l]==true&&main.isprime[(l+1)/2]==true) {
					System.out.println(1);
				} else {
					System.out.println(0);
				}
			} else {
				int c =primeCount[r]-primeCount[l];
				if (main.isprime[l]==true&&main.isprime[(l+1)/2]==true) {
					c++;
				}
				System.out.println(c);
			}
		}
	}

	public void  sieve() {
		for (int i=0;i<=100000;i++) {
			isprime[i]=true;
		}
		isprime[0] =false;
		isprime[1] =false;
		for (int i=2;i<=100000;i++) {
			if (isprime[i]==true) {
				for(int j=2*i;j<=100000;j+=i) {
					isprime[j] =false;
				}
			}
		}
	}
}

Measured memory_bytes: 64140
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

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

typedef long long ll;

vector<ll> fact(200001), inv(200001);
ll MOD = 1e9 + 7;

ll mod_pow(ll x, ll n, ll mod) {
	if (n == 0) return 1;
	ll res = mod_pow(x * x % mod, n / 2, mod);
	if (n & 1) res = res * x % mod;
	
	return res;
}

// nCrを求める
ll ncr(ll n, ll r) {
	return fact[n] * inv[r] % MOD * inv[n - r] % MOD;
}

int main() {
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	
	// 20^5以下階乗の逆元を求める
	fact[0] = 1;
	FOR(i, 1, 200001) fact[i] = fact[i - 1] * i % MOD;
	inv[200000] = mod_pow(fact[200000], MOD - 2, MOD);
	for (int i = 200000; i > 0; i--) inv[i - 1] = inv[i] * i % MOD;
	
	ll ans = 0;
	
	REP(i, h - a) {
		ans += ncr(i + b - 1, b - 1) * ncr(h - i - 1 + w - b - 1, w - b - 1);
		ans %= MOD;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
const int N=100010,M=4000010,P=1e9+7;
const int inf=0x3f3f3f3f;
const int INF=0xcfcfcfcf;
const double eps=1e-9,pi=asin(1)*2;
inline ll read();
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
inline int ADD(int a,int b) { return a+b>=P?a+b-P:a+b; }
inline int MINUS(int a,int b) { return a-b<0?a-b+P:a-b; }
#define plus(a,b) a=ADD(a,b)
#define minus(a,b) a=MINUS(a,b)
#define mul(a,b) a=(1ll*a*(b))%P
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(x,y) make_pair(x,y)

inline int gcd(int x,int y) { return y?gcd(y,x%y):x; }
int head[N],ver[M],nxt[M],du[N];
int n,m,tot=1;
int a[N];
inline void add(int x,int y)
{
	ver[++tot]=y,nxt[tot]=head[x],head[x]=tot,du[y]++;
}

bool G[2010][2010];
bool visit[N];
inline void dfs(int x)
{
	visit[x]=true;
	for(int y=1;y<=n;y++)
	{
		if(visit[y]||!G[x][y]) continue;
		add(x,y);
		dfs(y);
	}
}
priority_queue<int> q;

#ifdef FILE
const int READ_SIZE=1<<20;
char buf[READ_SIZE],*p1=buf,*p2=buf;
#define getchar() p1==p2&&(p2=(p1=buf)+fread(buf,1,READ_SIZE,stdin),p1==p2)?EOF:*p1++
#endif
inline ll read()
{
	ll s=0;
	bool flag=false;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') flag=true;
	for(;'0'<=ch&&ch<='9';ch=getchar()) s=(s<<3)+(s<<1)+(ch^'0');
	if(flag) return -s;
	return s;
}

int main()
{
#ifdef FILE
	freopen(FILE ".in","r",stdin);
	freopen(FILE ".out","w",stdout);
#endif
	n=read();
	for(int i=1;i<=n;i++) a[i]=read();
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(gcd(a[i],a[j])>1)
				G[i][j]=G[j][i]=true;
	for(int i=1;i<=n;i++)
		if(!visit[i]) dfs(i);
	
	while(q.size()) q.pop();
	for(int i=1;i<=n;i++)
		if(!du[i]) q.push(i);
	
	while(q.size())
	{
		int x=q.top();q.pop();
		printf("%d ",a[x]);
		for(int i=head[x];i;i=nxt[i])
		{
			int y=ver[i];
			du[y]--;
			if(!du[y]) q.push(y);
		}
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 8576
#include <stdio.h>
        #include <stdlib.h>
         
        int main(void)
        {
            int a, b, max = 0;
            int n;
            scanf("%d%d%d", &n, &a, &b);
            long long h[n];
            for (int i = 0; i < n; ++i){
                 scanf("%lld", &h[i]);
                 if (max < h[i])
                    max = h[i];
            }
         
            int del = a - b, l = 0, r = max/b + 1;
            long long t;
            while (r - l > 1){
                t = (l+r)/2;
                long long ch = t;
                for (int i = 0; i < n; ++i){
                    if (t*b < h[i]){
                        ch -= (h[i] - t*b)/del + ((h[i] - t*b)%del? 1:0);
                    }
                }
                if (ch < 0)
                    l = t;
                else
                    r = t;
            }
            printf("%d\n", r);
            return 0;
        }

Measured memory_bytes: 896
program ears
  implicit none
  integer(8), parameter :: infty = 100000000000000000_8
  integer :: l, i, j
  integer(8) :: a, dp(0:200000,5), x, y, c(5)
  a = 0
  dp = infty
  dp(0,1) = 0_8
  read(*,*) l
  do i = 1, l
    read(*,*) a
    x = 1_8-mod(a,2_8)
    y = mod(a,2_8)
    if (a.eq.0_8) then
      x = 1_8
      y = 2_8
    end if
    c = (/a,y,x,y,a/)
    do j = 1, 5
      dp(i,j) = min(dp(i,j),minval(dp(i-1,1:j))+c(j))
    end do
  end do
  write(*,'(i0)') minval(dp(l,1:5))
  stop
end program ears

Measured memory_bytes: 8064
from itertools import product
h, w, m = map(int, input().split())


row = [set()for _ in range(h)]
col = [set()for _ in range(w)]
for _ in range(m):
    x, y = map(lambda x: int(x)-1, input().split())
    row[x].add(y)
    col[y].add(x)

crow = 0
ic = []
for i, x in enumerate(row):
    if crow < len(x):
        crow = len(x)
        ic = [i]
    elif crow == len(x):
        ic.append(i)

ccol = 0
jc = []
for j, x in enumerate(col):
    if ccol < len(x):
        ccol = len(x)
        jc = [j]
    elif ccol == len(x):
        jc.append(j)


ans = crow+ccol
for i, j in product(ic, jc):
    if j not in row[i]:
        print(ans)
        break
else:
    print(ans-1)


Measured memory_bytes: 271204
main = do
    (i1,i2) <- getTwoInt
    putStrLn $ mycompare i1 i2

mycompare a b
    | a < b = "a < b"
    | a > b = "a > b"
    | a == b = "a == b"

getTwoInt = do
    l <- getLine
    let ss = split ' ' l
    let (i1:i2:[]) = (map read ss) :: [Int]
    return (i1,i2)

split d = _split d []
_split d cs "" = cs
_split d cs s = _split d (cs ++ [token d s]) (drop (length(token d s) + 1) s)
 
token d = _token d ""
_token d t "" = t
_token d t (x:xs) = if (x == d) then t else _token d (t ++ [x]) xs


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <stack>
#include <queue>

int main()
{
  int n, q;
  std::cin >> n >> q;
  std::vector<std::vector<int>> vv(n);
  for (int i = 0; i < n-1; i++)
  {
    int a, b;
    std::cin >> a >> b;
    vv[a-1].push_back(b-1);
    vv[b-1].push_back(a-1);
  }
  std::vector<long long> score(n, 0);
  for (int i = 0; i < q; i++)
  {
    int p, x;
    std::cin >> p >> x;
    score[p-1] += x;
  }


  std::stack<int> stack;
  std::vector<bool> visited_nodes(n, false);
  int parent = -1;
  stack.push(0);
  while(!stack.empty())
  {
    int visited = stack.top(); stack.pop();
    visited_nodes[visited] = true;
    int current_score = score[visited];
    for(const auto& v: vv[visited]){
      if(visited_nodes[v])
      {
        continue;
      }
      score[v]+=current_score;
      stack.push(v);
    }
  }
  for(const auto& s: score)
  {
    std::cout << s<<" " << std::endl;
  }

}


Measured memory_bytes: 16500
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    String w = sc.next();
    int c[] = new int[26];
    int f = 0;
    for(int j=0; j<26; j++) {
      c[j] = 0;
    }
    
    if(w.length() % 2 == 1) {
      System.out.println("No");
    } else {
      for(int i=0; i<w.length(); i++){
        switch(w.substring(i,i+1)) {
          case "a":
            c[0]++;
            break;
          case "b":
            c[1]++;
            break;
          case "c":
            c[2]++;
            break;
          case "d":
            c[3]++;
            break;
          case "e":
            c[4]++;
            break;
          case "f":
            c[5]++;
            break;
          case "g":
            c[6]++;
            break;
          case "h":
            c[7]++;
            break;
          case "i":
            c[8]++;
            break;
          case "j":
            c[9]++;
            break;
          case "k":
            c[10]++;
            break;
          case "l":
            c[11]++;
            break;
          case "m":
            c[12]++;
            break;
          case "n":
            c[13]++;
            break;
          case "o":
            c[14]++;
            break;
          case "p":
            c[15]++;
            break;
          case "q":
            c[16]++;
            break;
          case "r":
            c[17]++;
            break;
          case "s":
            c[18]++;
            break;
          case "t":
            c[19]++;
            break;
          case "u":
            c[20]++;
            break;
          case "v":
            c[21]++;
            break;
          case "w":
            c[22]++;
            break;
          case "x":
            c[23]++;
            break;
          case "y":
            c[24]++;
            break;
          case "z":
            c[25]++;
            break;
        }
      }
      for(int j=0; j<26; j++) {
        if(c[j] % 2 != 0) {
          f = 1;
        }
      }
      if(f==0) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
}

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

using namespace std;

#define MOD 1000000007

#define ll long long

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

#define FORd(i, a, b) for (int i=a; i<(b); --i) 

ll a,b,c,d;

void solve(){

    ll ans=max(max(max(a*c, a*d), b*c), d*b);

    

    cout << ans << "\n";

}

int main(){

    ios::sync_with_stdio(false);

    cin.tie(0);

    cin >> a>>b>>c>>d;

    solve();

    return 0; 

}

Measured memory_bytes: 3652
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/25 07:27:05 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	ll	n;
	cin >> n;
	vector<ll>	VA(n);
	vector<ll>	VB(n);
	rep(i, n)
	{
		ll	x, y;
		cin >> x >> y;
		// VA.at(i) = x % y;
		VA.at(i) = x;
		VB.at(i) = y;
	}
	ll	cnt;
	cnt = 0;
	ll	adder;
	adder = 0;
	rrep(i, n - 1)
	{
		if ((VA.at(i) + adder) % VB.at(i) == 0)
			continue;
		adder += VB.at(i) * ((VA.at(i) + adder) / VB.at(i) + 1) - (VA.at(i) + adder);
	}
	cout << adder << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}

	// ll	v;
	// v = VB.at(0);
	// if (VA.at(0) % v != 0)
	// {
	// 	rep(i, n)
	// 		VA.at(i) += v - (VA.at(0) % v);
	// 	cnt += v - (VA.at(0) % v);
	// }
	// ll	maxdif;
	// maxdif = 0;
	// for (int i = 1; i < n; i++)
	// {
	// 	if (VA.at(i) != 0)
	// 		maxdif = max(maxdif, VB.at(i) - VA.at(i));
	// }
	// if (maxdif > 0)
	// 	cnt += v * ((maxdif + (v - 1)) / v);

Measured memory_bytes: 1792
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  ll a,b,k;
  cin >> a >> b >> k;
 
  if(a >= k){
    cout << a-k << " " << b << endl;
    return 0;
  }
  else if((a+b) >= k){
    cout << 0 << " " << b - (k - a) << endl;
    return 0;
  }
  else{
    cout << 0 << " " << 0 << endl;
    return 0;
  }

  
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int mod=1000000007;
const int INF=1001001001;

vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
struct edge{
  int to;
  int h;
};
vector<vector<edge>>g;
vector<int>ans;
void dfs(int now,int bhid,int bp){
  int k=1;
  for(int i=0;i<g[now].size();i++){
    int np=g[now][i].to;int nh=g[now][i].h;
    if(np==bp){continue;}
    if(k==bhid){k++;}
    ans[nh]=k;k++;
    dfs(np,ans[nh],now);
  }
}

int main() {
  int N;
  cin>>N;
  g.resize(N);
  ans.resize(N-1);
  for(int i=0;i<N-1;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].emplace_back((edge){b,i});
    g[b].emplace_back((edge){a,i});
  }
  dfs(0,-1,-1);
  int m=0;
  for(int i=0;i<N-1;i++){
    chmax(m,ans[i]);
  }
  cout<<m<<endl;
  for(int i=0;i<N-1;i++){
    cout<<ans[i]<<endl;
  }
  return 0;  
}

Measured memory_bytes: 11024
//
//  main.cpp
//  B
//
//  Created by 黄道煜 on 2018/6/24.
//  Copyright © 2018年 黄道煜. All rights reserved.
//

#include <cstdio>
#include <iostream>
#define LL long long
using namespace std;

LL k, n, d=1;

int s(LL x)
{
    int sum=0;
    while(x) sum+=x%10, x/=10;
    return sum;
}

int main()
{
    scanf("%lld", &k);
    for(int i=1; i<=k; i++)
    {
        if((n+d*10)*s(n+d)<(n+d)*s(n+d*10)) d*=10;
        n+=d;
        printf("%lld\n", n);
    }
    return 0;
}


Measured memory_bytes: 256
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

struct UnionFind
{
  vector< int > data;

  UnionFind(int sz)
  {
    data.assign(sz, -1);
  }

  bool unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x == y) return(false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return(true);
  }

  int find(int k)
  {
    if(data[k] < 0) return(k);
    return(data[k] = find(data[k]));
  }

  int size(int k)
  {
    return(-data[find(k)]);
  }

  bool same(int x, int y)
  {
      return find(x) == find(y);
  }
};

int main()
{
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];
    REP(i, N) cin >> C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    LL ans = 0;
    REP(i, N)
    {
        LL a;
        {
            vector<int>::iterator it = lower_bound(A.begin(), A.end(), B[i]);
            a = it - A.begin();
        }
        LL c;
        {
            vector<int>::iterator it = upper_bound(C.begin(), C.end(), B[i]);
            c = C.end() - it;
        }
        ans += (a * c);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

printList [a] = print a
printList (a:as) = putStr ( show a ) >> putChar ' ' >> printList as

main = do
	s <- getLine
	t <- getLine
	let
		ss = filter ( ( == length t ) . length ) $ map ( take $ length t ) $ tails s
	print $ minimum $ map ( solve t ) ss

solve s t = length $ filter id $ zipWith (/=) s t

Measured memory_bytes: 4912
#include <iostream>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main() {
	int N, M;
	map<string, int> m;

	cin >> N;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		m[s]++;
	}
	cin >> M;
	for (int i = 0; i < M; i++) {
		string s;
		cin >> s;
		m[s]--;
	}
	int ans = 0;
	for (pair<string,int> mp: m) {
		ans = max(ans, mp.second);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
for t in range(int(input())):
    n, k = map(int, input().split())
    X = list(map(int, input().split()))
    mid = [X[i] - X[i - 1] for i in range(1, n)]
    mid.sort()
    ans = [0, sum(mid[:n-k])][k<n]
    print(ans)


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

using namespace std;

typedef long long ll;

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

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

int main(void) {
    int r;
    cin >> r;

    cout << r * r << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int X, Y, Z, A, B, C, N, dx[1009], dy[1009], dz[1009]; long long ret[1009];
int main() {
	cin >> X >> Y >> Z >> A >> B >> C >> N;
	for (int i = 0; i < X; i++) dx[abs(A - i) % N]++;
	for (int i = 0; i < Y; i++) dy[abs(B - i) % N]++;
	for (int i = 0; i < Z; i++) dz[abs(C - i) % N]++;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			int c = (i + j) % N;
			for (int k = 0; k < N; k++) {
				ret[c] += 1LL * dx[i] * dy[j] * dz[k];
				if (++c >= N) c = 0;
			}
		}
	}
	for (int i = 0; i < N; i++) {
		if (i) cout << ' ';
		cout << ret[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3068
#include<iostream>
#include<set>
#include<vector>
#include<string>

using namespace std;

typedef long long int llint;

string S;

llint sum[2019];

llint mod_pow(llint x, llint n) {
	llint res = 1;
	while (n > 0) {
		if (n & 1) { res = res * x; }
		x = x * x;
		n >>= 1;
	}
	return res;
}

llint func(llint n) {
	//if (n <= 1) { return 0; }
	llint res = 1;
	//while (n > 0) {
	//	res *= n;
	//	n--;
	//}
	return n * (n - 1) / 2;
}

int main() {
	cin >> S;
	//cout << 10095 % 2019 << endl;
	int N = (int)S.size();
	vector<llint> a(N);

	a[N - 1] = S[N - 1] - '0';
	sum[a[N - 1]]++;
	//cout << a[N - 1] << endl;
	llint ans = 0;
	llint now = 10;
	for (int i = 1; i < N; i++) {
		llint v = now;
		a[N - 1 - i] = ((S[N - 1 - i] - '0') * v + a[N - i]) % 2019;
		now = (now * 10) % 2019;
		sum[a[N - 1 - i]]++;
		//cout << a[N - 1 - i] << endl;
	}

	for (int i = 0; i < 2019; i++) {
		//if(sum[i] != 0)
		//cout << "sum[" << i << "=" << sum[i] << endl;
		ans += func(sum[i]);
	}

	cout << ans + sum[0] << endl;
}

Measured memory_bytes: 5212