akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

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

const long long INF = LLONG_MAX/3;

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; }
inline void Yes (bool condition) { if(condition) { cout << "Yes" << endl; } else { cout << "No" << endl;} }

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=998244353;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; 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;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

signed main(){
	int n,x;
	cin>>n>>x;
	int s=n*3;
	s+=x*3+(n-x)*3;
	int a,b;
	a=n-x;
	b=x;
	while(b>0){
		if(a<b)swap(a,b);
		//cout<<a<<" "<<b<<endl;
		s+=b*3*(a/b)*2;
		int l=a%b;
		a=b;
		b=l;
	}
	cout<<s/2-n*3<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N , T; cin >> N >> T;
    vector<ll> A;
    rep(i,N){
        ll inp; cin >> inp;
        A.pb(inp);
    }
    
    vector<pair<pair<ll,ll>, pair<ll,ll> > > ss;
    
    ll a = 1000000000,b = 1000000000;
    ll acnt = 1, bcnt = 1;
    rep(i,A.size()){
        if(A[i] < a){
            ss.pb(mp(mp(a,acnt), mp(b,bcnt)));
            a = A[i]; b = A[i];
            acnt = 1; bcnt = 1;
        }
        else if(A[i] == a) acnt ++;
        else if(A[i] > b) b = A[i];
        else if(A[i] == b) bcnt ++;
        
        if(i == A.size()-1)ss.pb(mp(mp(a,acnt), mp(b,bcnt)));
    }
    
    ll ans = 0;
    ll max_ans = 0;
    rep(i,ss.size()){
        a = ss[i].first.first;
        acnt = ss[i].first.second;
        b = ss[i].second.first;
        bcnt = ss[i].second.second;
        
        if(a == b) continue;
        if((b-a) > max_ans){
            max_ans = (b-a);
            ans = min(acnt, bcnt);
        }
        else if((b-a) == max_ans){ans += min(acnt,bcnt);}
        
    }
    cout << ans << endl;
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 3188
#ruby
#PriorityQueue

class PriorityQueue < Array
	#attr :step

	def initialize
		@size = 0
		#@step = 0
	end

	def enqueue(e)
		#@step = 0
		self[@size] = e
		idx = @size
		while idx > 0
			if self[idx] > self[(idx-1)/2]
				self[(idx-1)/2],self[idx] = self[idx],self[(idx-1)/2]
				#@step += 1
			else
				break
			end
			idx = (idx-1)/2
		end
		@size += 1
	end

	def dequeue
		#@step = 0
		prio = self[0]
		self[0] = self[@size-1]
		@size -= 1
		idx = 0
		while true
			if idx*2+1 > @size-1
				break
			end
			if (idx+1)*2 > @size-1
				if self[idx] < self[idx*2+1]
					self[idx],self[idx*2+1] = self[idx*2+1],self[idx]
					idx = idx*2+1
					#@step += 1
				else
					break
				end
			else
				if self[idx*2+1] < self[(idx+1)*2]
					if self[idx] < self[(idx+1)*2]
						self[idx],self[(idx+1)*2] = self[(idx+1)*2],self[idx]
						idx = (idx+1)*2
						#@step += 1
					else
						break
					end
				else
					if self[idx] < self[idx*2+1]
						self[idx],self[idx*2+1] = self[idx*2+1],self[idx]
						idx = idx*2+1
						#@step += 1
					else
						break
					end
				end
			end
		end
		prio
	end
end

#abc141 D

n,m = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)

pq = PriorityQueue.new
total = 0

a.each do |e|
  pq.enqueue e
  total += e
end

m.times do
  x = pq.dequeue
  total -= (x/2)+(x%2)
  pq.enqueue x/2
end

p total

Measured memory_bytes: 10588
#include <bits/stdc++.h>
using namespace std;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
typedef long long ll;
typedef unsigned long long ull;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(ll i = (a); i < (ll) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define MOD 1000000007
ll binaryNum[62];
void decToBinary(ll n)
{
    forn(i,62) binaryNum[i]=0;

    int i = 0;
    while (n > 0) {
        binaryNum[i] = n % 2;
        n = n / 2;
        i++;
    }
}
ll result (ll pot, ll num)
{
    ll loqueda=num;
    while(pot>1)
    {
        loqueda=(2*loqueda)%MOD;
        pot=pot/2;
    }
    return loqueda;
}
int main() {
    FIN;
    int n;
    ll cuantos[62];
    forn(i,62) cuantos[i]=0;
    ll x;
    cin >> n;
    forn(i,n)
    {
        cin >> x;
        decToBinary(x);
        forn(i,62) cuantos[i]+=binaryNum[i];
    }
    ll resp=0, prod, pot=1;
    forn(i,62)
    {
        prod=result(pot,((cuantos[i]*(n-cuantos[i]))%MOD));
        resp=(resp+prod)%MOD;
        pot*=ll(2);
    }
    cout << resp << endl;


    return 0;
}


Measured memory_bytes: 256
a, b, k = map(int, input().split())
Takahashi = True
while k > 0:
    k -= 1
    if Takahashi == True:
        Takahashi = False
        if a % 2 == 1:
            a -= 1
        a /= 2
        b += a
    else:
        Takahashi = True
        if b % 2 == 1:
            b -= 1
        b /= 2
        a += b
print(int(a), int(b))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define N 200100
#define pii pair<int,int>
#define rep(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define inf 1e9
void solve(){
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<n;i++){
		cout<<s[i]<<t[i];
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

int main (void) {
  const int max_input = 200000;
  vector<int> num_2017like(max_input, 0);
  vector<bool> is_prime(max_input + 1, true);
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i * i < max_input; i++) {
    if (is_prime[i]) {
      for (int j = i * 2; j < max_input; j += i)
        is_prime[j] = false;
    }
  }

  for (int i = 1; i < max_input; i++) {
    if (i % 2 == 0) {
      num_2017like[i] = num_2017like[i - 1];
    } else {
      num_2017like[i] = (is_prime[i] && is_prime[(i + 1) / 2]) ? num_2017like[i - 1] + 1: num_2017like[i - 1];
    }
  }
  int q;
  cin >> q;
  REP(i, q) {
    int l, r;
    cin >> l >> r;
    cout << num_2017like[r] - num_2017like[l - 1] << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;
 
template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)
 
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;
  

int main() {
    int N;
    long A[210];
    cin >> N;
    rep(i,N){
        cin >> A[i];
    }

    long res = 0;
    bool flg = true;
    while (flg)
    {
        rep(i,N){
            if (A[i]%2 != 0) flg = false;
            A[i] /= 2;
        }
        if (flg == true) res += 1;
    }
    
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }
        int dp[] = new int[n];
        dp[1] = Math.abs(h[0] - h[1]);
        for (int i = 2; i < n; i++) {
            dp[i] = Math.min(dp[i - 1] + Math.abs(h[i] - h[i - 1]), dp[i - 2] + Math.abs(h[i] - h[i - 2]));
        }
        System.out.println(dp[n - 1]);
    }

}


Measured memory_bytes: 59128
#include<bits/stdc++.h>
using namespace std;
int a[10001],ans=0,bns=0,n;
int main()
{
    cin>>n;
    for(int i=1;i<=2*n;i++)
        cin>>a[i];
    sort(a+1,a+1+2*n);
    for(int i=1;i<=2*n;i+=2)
        bns+=a[i];
    cout<<bns<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;
const int maxn = 3e5+5;

int main(){
	ll n; cin >> n;
	ll sum = 0, x = 0;
	for(ll i = 1; i <= n; i++){
		if(i % 3 == 0 || i % 5 == 0) x += i;
		sum += i;
	}
	cout << sum - x << endl;
}

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

int main(){
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    vector<int> x;
    vector<int> y;

    for(int i=0;i<N;i++){
        int temp;
        cin >> temp;
        x.push_back(temp);
    }
    for(int i=0;i<M;i++){
        int temp;
        cin >> temp;
        y.push_back(temp);
    }

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    if(x[x.size()-1] >= Y){
        cout << "War" << endl;
        return 0;
    }
    if(y[0] <= X){
        cout << "War" << endl;
        return 0;
    }
    if(x[x.size()-1] >= y[0]){
        cout << "War" << endl;
        return 0;
    }

    cout << "No War" << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma region includes, macros
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>

using namespace std;

typedef int64_t i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
    i64 from, to, cost;
    edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
    edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

// 多重vectorを可変引数テンプレートで http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}
//

#pragma endregion

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<int>> mas(h, vector<int>(w, 0));
    queue<P> que;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            char c;
            cin >> c;
            if (c == '#') {
                mas[i][j] = 0;
                que.push(P(i, j));
            }
            else {
                mas[i][j] = -1;
            }
        }
    }
    int ans = 0;
    while (!que.empty()) {
        auto t = que.front();
        que.pop();
        int x = t.first;
        int y = t.second;
        for (int k = 0; k < 4; ++k) {
            int nx = t.first + dx[k];
            int ny = t.second + dy[k];
            if (nx < 0 || ny < 0 || nx >= h || ny >= w) {
                continue;
            }
            if (mas[nx][ny] == -1) {
                mas[nx][ny] = mas[x][y] + 1;
                ans = max(ans, mas[nx][ny]);
                que.push(P(nx, ny));
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 20532
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n,m;cin>>n>>m;
    vector<ll>s(m),c(m);
    rep(i,m)cin>>s[i]>>c[i];
    vector<char>ss(n,'a');
    bool f=1;
    rep(i,m){
        s[i]--;
        if(ss[s[i]]=='a'){
            ss[s[i]]=c[i]+'0';
        }else{
            if(ss[s[i]]-'0'!=c[i])f=0;
        }
        if(s[i]==0&&n>1&&c[i]==0)f=0;
    }
    if(!f)cout<<-1<<endl;
    else{
        rep(i,n){
            if(ss[i]=='a'){
                if(n==1)cout<<0<<endl;
                else if(i==0){
                    cout<<1;
                }else cout<<0;
            }else cout<<ss[i];
        }
        cout<<endl;
    }
}

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

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

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string a;
	cin >> a;
	int remainder[2019] = { };
	remainder[0]++;
	int mult = 1;
	int ans = 0;
	int imp = 0;
	for (int i = a.length() - 1; i >= 0; i--) {
		imp = (imp + ((a[i] - '0') * mult)) % 2019;
		//	cout << imp << endl;
		ans += remainder[imp];
		remainder[imp]++;
		mult = (mult * 10) % 2019;
	}
	cout << ans << "\n";
}



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

int main()
{
    int n;
    cin >> n;
    vector<int> id(n);
    rep(i, n-1) {
        int a;
        cin >> a;
        a--;
        id[a]++;
    }
    rep(i, n) {
        cout << id[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3960
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int ans = 1;
    for(int i = 0;i < s.length();i++)
    {
        if((i+1) % 2 ==0 && s[i] == 'R')
        {
                cout << "No" << endl;
                return 0;
        }
        if((i+1) % 2 == 1 && s[i] == 'L') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll LL_MAX=LLONG_MAX;

struct In{
    template<typename T>
    operator T(){
        T x;
        cin >> x;
        return x;
    }
};
In in;

template <typename T,typename U>
void forin(T* x,U n){
    for (U i=0;i<n;i++) cin >> x[i];
}

template <typename T>
int div1(T x) {
    return x%1000000007;
}

template <typename T>
void out(T x){
    cout << x << endl;
}

template <typename T>
T gcd(T x,T y){
    if (y == 0) return x;
    return gcd(y,x%y);
}

template <typename T>
T lcm(T x,T y){
    return x*y/gcd(x,y);
}

int main(){
    int n=in,a[n],h;
    ll ans=0;
    forin(a,n);
    h=a[0];
    for (int i=1;i<n;i++){
        if (a[i]<h) ans+=(h-a[i]);
        else if (a[i]>h) h=a[i];
    }
    out(ans);
} 

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

 
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
 int t=1;
    // cin>>t;
  while(t--){
    int n;
    cin>>n;
    int sum =0;
    while(n>sum){
        sum+=1000;
    }

    cout<<sum-n;
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll p = 1e9 + 7;
#define DEBUG(x) cout << (x) << '\n'
#define fi first
#define se second

int n, k, t, e[MAXN];
bool must_negtive(int a[]){
    sort(a, a + n);
    if(n == k){
        int x = 0;
        for(int i = 0; i < n; i++) x += a[i] < 0;
        return x & 1;
    }
    int x = 0;
    for(int i = 0; i < k; i++) x += a[i] < 0;
    return (x & 1) && a[n-1] < 0;
}
void run(){
    vector<ll> a, b;
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> t, e[i] = t;
        if(t >= 0) a.push_back(t);
        else b.push_back(t);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end(), greater<ll>());
    if(must_negtive(e)){
        sort(e, e + n, [&](const int& x, const int& y){
             return abs(x) < abs(y);
             });
        ll ans = 1;
        for(int i = 0; i < k; i++)
            ans = ans * abs(e[i]) % p;
        cout << (p - ans) % p;
        return;
    }
//    cout << a.size() << ' ' << b.size() << '\n';
    int y = min(k / 2 * 2, (int) b.size() / 2 * 2);
    int x = k - y;
//    cout << x << ' ' << y << '\n';
    y = b.size() - y, x = a.size() - x;
    while(y < b.size() && x - 2 >= 0 && a[x-2]*a[x-1] >= b[y]*b[y+1]) x -= 2, y += 2;
    ll ans = 1;
    for(int i = x; i < a.size(); i++) ans = ans * a[i] % p;
    for(int i = y; i < b.size(); i += 2) ans = ans * (b[i] * b[i+1] % p) % p;
    cout << ans;
}
int main(){
#ifdef Irene
    freopen("in.txt", "r", stdin);
#endif // Irene
    ios::sync_with_stdio(false);

    run(); return 0;
}


Measured memory_bytes: 5996
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdio>
#include<iomanip>

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)

const long long MOD = 1000000007;
const int MAX = 666667;
long long fac[MAX], facinv[MAX], inv[MAX];

void facinit(){
    fac[0] = fac[1] = 1;
    facinv[0] = facinv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        facinv[i] = facinv[i - 1] * inv[i] % MOD;
    }   
}

long long Combi(long long a, long long b){
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * (facinv[b] * facinv[a - b] % MOD) % MOD;
}

int main(){
    facinit();

    int X, Y; cin >> X >> Y;

    if( (2*Y-X) % 3 == 0 && (2*X-Y) % 3 == 0 ){
        int a = (2*Y-X)/3; int b = (2*X-Y)/3;
        cout << Combi(a+b, min(a,b)) << endl;
    }
    else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n;
    cin >> n;
    int flag[9] = {};
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        if(a >= 3200) a = 3200;
        flag[a/400]++;
    }

    int mi = 0;
    for(int i = 0; i < 8; i++) if(flag[i]) mi++;
    cout << max(mi,1) << ' ' << mi + flag[8] << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}

int main()
{
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b,cout<<max(a-2*b,0)<<'\n';	
	cout<<flush;
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int x,y;
  while(1){
    scanf("%d %d",&x,&y);
    if(x == 0 && y == 0){
      break;
    }
    if(x>=y){
      printf("%d %d\n",y,x);
    }else{
      printf("%d %d\n",x,y);
    }
  }
}

Measured memory_bytes: 1028
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

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

    //作る時はParentの値を全て-1にする
    //こうするとずべてバラバラになる
    UnionFind(int N){
      Parent = vector<int>(N,-1);
    }

    //Aがどのグループに属しているのか調べる
    int root(int A){
      if(Parent[A]<0) return A;
      return Parent[A] = root(Parent[A]);
    }

    //自分のいるグループの頂点数を調べる
    int size(int A){
      return -Parent[root(A)];//親を取ってきたい
    }

    //AとBをくっつける
    bool connect(int A,int B){
      //AとBを直すつつなぐのではなく、root(A)にroot(B)をくっつける)
      A = root(A);
      B = root(B);
      if(A==B){
        //すでにくっついているからくっつけない
        return false;
      }
      //大きい方(A)に小さい方(B)をくっつけたい
      //大小が逆だったらひっくり返しちゃう
      if(size(A)<size(B)) swap(A,B);

      //Aのサイズを更新する
      Parent[A] += Parent[B];
      //Bの親をAに変更する
      Parent[B] = A;

      return true;
    }
  };


int main(){
  ll N , M; cin >> N >> M;
  vector<P> a(M); rep(i,M) cin >> a[i].fi >> a[i].sc;
  rep(i,M) { a[i].fi--; a[i].sc--;}

  UnionFind Uni(N);
  vector<ll> ans(M);
  ans[M - 1] = N *(N - 1) / 2;

  for(ll i = M - 1; i > 0; i--){
    // 後ろからつなげていく
    if(Uni.root(a[i].fi) == Uni.root(a[i].sc) ){
      Uni.connect(a[i].fi , a[i].sc);
      ans[i - 1] = ans[i];
    }
    else{
      ans[i - 1] = ans[i] - Uni.size(a[i].fi) * Uni.size(a[i].sc);
      Uni.connect(a[i].fi , a[i].sc);
    }
  }

  rep(i,M) cout << ans[i] << endl;

}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i, n)         for(int i=0; i<n; i++)
#define fo(i, k, n)     for(int i=k; i<n; i++)
#define forr(i, a, b)   for(int i=a; i<=b; i++)
#define rf(i,n)         for(int i=n;i>=0;i--)
typedef unsigned long long ull;
typedef pair<int ,int> pr;
#define MAX 100005
#define INF 1000000009
#define   sq(n)         (n*n)
#define p(n) cout<<n<<endl
#define pb push_back
#define py cout<<"YES"<<endl;
#define pn cout<<"NO"<<endl;
ll mod =1e9+7;
#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
ll lcm ( ll a, ll b )
{
    return ( a / __gcd ( a, b ) ) * b;
}


ll modpow(ll a,ll n, ll mod)
{
    ll res = 1;
    while(n>0)
    {
        if (n%2==1)
        {
            res = res * a % mod;
        }
        a = a * a % mod;
        n/=2;
    }
    return res;
}

int bin_ser(int *a,int n,int x)
{
    int l=0;
    int h=n-1;
    while(l<=h)
    {
        int mid=l+((h-l)/2);
        if(a[mid]==x)
        {
          return mid;
        }
        else if(a[mid]<x)
        {
            l=mid+1;
        }
        else
        {
            h=mid-1;
        }
    }
}

int main()
{
    __FastIO;

        int n;
        cin>>n;
        vector<int >v(n);
        f(i,n)
        {
            cin>>v[i];
        }
        int m=0;
        ll p=0;
        f(i,n)
        {
            m=max(m,v[i]);
            p+=m-v[i];
        }
        p(p);

    return 0;
}




Measured memory_bytes: 3956
///Nahid Hasan Raju
#include <bits/stdc++.h>
#define ll long long
#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
using namespace std;

#define P(XX) cout<<XX<<endl
#define P1(XX) cerr<<"db1: "<<XX<<endl
#define P2(XX,YY) cerr<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cerr<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
//#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define pb push_back
#define pll pair<ll,ll>
#define pii pair<int,int>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007ll
#define MX 2000006  ///200005

ll m, n;
ll a[MX], b[MX], rp[MX];
string s,s1;
map<ll,int>mp;

ll rep(ll n)
{
    if(rp[n]==n)return n;
    return rp[n]=rep(rp[n]);
}


int main()
{
    int test=1, tc=0, i, j;
    #ifndef ONLINE_JUDGE
    //Fin;
    test=3;
    #endif
    ll k, ans, t, kk;
    //scanf("%d", &test);
    //rp[1]=1;
    while(test--)
    {
        j=k=ans=0;
        cin>>n>>m;
        for(i=1;i<=n;i++)rp[i]=i;
        for(i=1;i<=m;i++)
        {
            cin>>j>>k;
            rp[rep(j)]=rep(k);
        }
        MS(a,0);
        for(i=1;i<=n;i++)
        {
           //P2(i,rep(i));
           k=rep(i);
           //P1(k);
            a[k]++;
        }
        for(i=1;i<=n;i++)
        {
            //P1(a[i]);
            ans=max(ans, a[i]);
        }
            ///*** Union DF
        P(ans);
        return 0;

        if(t)puts("YES");
        else puts("NO");

        printf("%lld\n", ans);
        for(i=0;i<ans;i++)
        {
            printf("%lld", b[i]);
        }
    }
    return 0;
}



Measured memory_bytes: 26984
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] arr = reader.readLine().split(" ");
        int a = Integer.parseInt(arr[0]);
        int b = Integer.parseInt(arr[1]);
        String ans = "";
        if (a < b) {
            for (int i = 0; i < b; i++) {
                ans += a;
            }
        } else {
            for (int i = 0; i < a; i++) {
                ans += b;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 20820
#include<iostream>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<iomanip>


using namespace std;

int main() {
	int L, N;
	cin >> L >> N;

	int value = 0;
	int weight;
	int point;
	for(int i=0; i<N; i++) {
		cin >> point >> weight;
		value += point * weight;
	}

	if(value == 0) {
		cout << '0' << endl;
		return 0;
	}

	for(int i= -L; i<L; i++) {
		if(i==0) i++;
		for(int j=1; j<50000; j++) {
			if(i*j + value == 0) {
				cout << '1' << endl << i << ' ' << j << endl;
				return 0;
			}
		}
	}
	return 0;
}

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

using ll = long long;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define mp make_pair
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll temp = gcd(a, b); return temp ? (a / temp * b) : 0; }
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

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; }

inline tuple<ll, ll> rotate45(tuple<ll, ll> point) { ll x = get<0>(point), y = get<1>(point); return tuple<ll, ll>(x + y, x - y); }
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; }
void out_sequence(vector<ll> &out) { REP(i, (int)out.size()) { cout << out[i]; if (i == (int)out.size() - 1) cout << endl; else cout << " "; } }



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

	string s; cin >> s;
	ll K; cin >> K;
	ll cnt = 0;
	REP(i, s.size()) {
		if (s[i] != '1') {
			if (cnt >= K) cout << 1 << endl;
	else			cout << s[i] << endl;
			return 0;
		}
		cnt++;
	}
	cout << 1 << endl;
	

	return 0;
}

//*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	//int t;
	// cin>>t;
	 int n;
	// while(t--) {
	 	cin>>n;
		 if(n%1000) {
			for(int i=1000; i<n+1000; i+=1000) {
				  if(n<i) {
					cout<<i-n<<endl;
					break;
				  }
			}
		 }else {
		 	cout<<0<<endl;
		 }
	 //}
   return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main(void){
    int a[3][3];
    int i, j, n;
    int flag = 0;
    int sum = 0, sum2 = 0;
    for(i = 0; i < 3; i++){
        for(j = 0; j < 3; j++){
            scanf("%d", &a[i][j]);
        }
    }

    scanf("%d", &n);
    int b[n];
    for(i = 0; i < n; i++){
        scanf("%d", &b[i]);
        for (j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(a[j][k] == b[i]){
                    a[j][k] = 0;
                }
            }
        }
    }

    for(i = 0; i < 3; i++){
        sum = 0, sum2 = 0;
        for(j = 0; j < 3; j++){
            sum += a[i][j];
            sum2 += a[j][i];
        }
        if(sum == 0 || sum2 == 0){
            flag = 1;
        }
    }

    if(a[0][0] + a[1][1] + a[2][2] == 0 || a[2][0] + a[1][1] + a[0][2] == 0) flag = 1;

    if(flag == 1){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<string , string> pss;
map <pss , ll> m;

int n;
string s;
int main(){
	cin >> n;
	cin >> s;
	int tot = (1 << n);
	for(int i = 0 ; i < tot ; ++ i){
		pss cur;
		cur.first = "";
		cur.second = "";
		for(int j = 0 ; j < n ; ++ j)
			if((1 << j) & i)
				cur.first += s[j];
		for(int j = n - 1 ; j >= 0 ; -- j)
			if(!((1 << j) & i))
				cur.second += s[j];
//		cout << i << " " << cur.first << " " << cur.second << endl;
		m[cur] ++;
	}
	ll ans = 0;
	for(int i = 0 ; i < tot ; ++ i){
		pss cur;
		cur.first = "";
		cur.second = "";
		for(int j = 0 ; j < n ; ++ j)
			if((1 << j) & i)
				cur.second += s[j + n];
		for(int j = n - 1 ; j >= 0 ; -- j)
			if(!((1 << j) & i))
				cur.first += s[j + n];
//		cout << "match : " << i << " " << cur.first << " " << cur.second << " " << m[cur] << endl;
		ans += m[cur];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 91904
// A

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};

int main(){
  int N,t[50];
  string s[50],X; 
  cin>>N;
  for (int i(0);i<N;i++) cin>>s[i]>>t[i];
  cin>>X;
  bool flag = false;
  int ans(0);
  for (int i(0);i<N;i++){
    if (flag == true){
      ans += t[i];
    }
    if (X == s[i]){
      flag = true;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
//package Dynamic;
import java.io.*;
import java.util.*;
class Main 
{
    static public void main(String[] args) throws IOException 
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        //int t=Integer.parseInt(br.readLine());
        //long n=Long.parseLong(br.readLine());
        StringTokenizer st=new StringTokenizer(br.readLine());
        int c=0;
        long l=Long.parseLong(st.nextToken());
        long r=Long.parseLong(st.nextToken());
        long aa=l%2019;
        long bb=r%2019;
        
        long val=l;
        long cc=l%2019;
        long min=99999l;
        //long m=99999;
        for(long xx=l+1;xx<=r;xx++)
        {
        	min=Math.min(min,((l*xx)%2019l));
        	if(min==0)
        	{
        		System.out.println("0");
        		System.exit(0);
        	}
        }
        for(long x=l+1;x<r;x++)
        {
        	for(long xx=x+1;xx<=r;xx++)
            {
            	min=Math.min(min,((x*xx)%2019l));
            	if(min==0)
            	{
            		System.out.println("0");
            		System.exit(0);
            	}
            }
        }
        System.out.println(min);
        
        
        //long d=Long.parseLong(br.readLine());
//        while(st.hasMoreTokens())
//        {
//        	long aa=Long.parseLong(st.nextToken());
//        	
//        }
        //System.out.println((min*min2)%2019);
    }
}

Measured memory_bytes: 22612
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

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

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int k, n; cin >> k >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int now = a[n-1]-k;

    int ans = 0;
    rep(i,n) {
        ans = max(ans,a[i]-now);
        now = a[i];
    }
    cout << (k-ans) << endl;
    return 0;
}



























Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;
static const int INF = (int)1e8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOREQ(i,k,n) for (int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FIND(m,w) ((m).find(w)!=(m).end())

int main(void){
  int m,n;
  while(cin>>m>>n,m){
    vector<string> word(n);
    REP(i,n){
      cin>>word[i];
    }
    vector<int> member(m);
    REP(i,m)member[i] = i+1;
    int idx = 0;
    REP(i,n){
      if(member.size()==1) break;

      int number = i+1;
      string answord;
      if(number%15==0){
        answord = "FizzBuzz";
      }else if(number%5==0){
        answord = "Buzz";
      }else if(number%3==0){
        answord = "Fizz";
      }else{
        stringstream ss;
        ss<<number;
        answord = ss.str();
      }

      if(answord==word[i]){
        idx = (idx+1)%member.size();
      }else{
        member.erase(member.begin()+idx);
        if(idx==member.size())idx = 0;
      }
    }

    REP(i,member.size()){
      if(i)cout<<" ";
      cout<<member[i];
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1244
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string S;
  cin >> S;
  ll ans = 700;
  if (S[0] == 'o') ans += 100;
  if (S[1] == 'o') ans += 100;
  if (S[2] == 'o') ans += 100;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int  N, D, X;
    cin >> N >> D >> X;
    vector<int> a(N);
    for(int i=0;i<N;i++) cin >> a[i];
    int cnt=0;
    for(int i=0;i<N;i++){
        int c=1;
        for(int j=1;c<=D;j++){
            cnt++;
            c=j*a[i]+1;
        }
    }
    cout << cnt+X <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
const int N = 16777217;
 
int n;
char data[16777217];
 
int conv(char c){
  switch(c){
  case 'A':
    return 1;
    break;
  case 'C':
    return 2;
    break;
  case 'G':
    return 3;
    break;
  case 'T':
    return 4;
    break;
  }
}
 
int hash(char str[10]){
  int res = 0, size = strlen(str), r = 1, i;
  for(i=size-1;i>=0;i--){
    res += r * conv(str[i]);
    r *= 4;
  }
  return res;
}
 
void insertElm(int d){
  data[d] = 1;
}
 
char findElm(int d){
  return data[d];
}
 
main(){
  char ope[13], str[13];
  int i;
  memset(data, 0, 16777217);
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%s", ope);
    scanf("%s", str);
    if(!strcmp(ope, "insert")) insertElm(hash(str));
    else printf("%s\n", (findElm(hash(str)) ? "yes" : "no"));
  }
  return 0;
}

Measured memory_bytes: 16980
package main

import (
	"fmt"
)

//const pi = math.Pi

func main() {
	var s string
	fmt.Scan(&s)
	ans := 0
	for i := 0; i < len(s)/2; i++ {
		if s[i] != s[len(s)-1-i] {
			ans++
		}
	}

	fmt.Println(ans)
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef long long LL;
LL fun(LL x,LL n){
   LL res=1;
   while(n>0){
        if(n & 1)
           res=(res*x);
       x=(x*x);
       n >>= 1;
   }
   return res;
}
ll a[200]={0,2 ,3 ,5 ,7 ,11 ,13 ,17 ,19 ,23 ,29 ,31 ,37 ,41 ,43 ,47 ,53 ,59 ,61 ,67 ,71 ,73 ,79 ,83 ,89 ,97 ,101 ,103 ,107 ,109 ,113 ,127 ,131 ,137 ,139 ,149 ,151 ,157 ,163 ,167 ,173 ,179 ,181 ,191 ,193 ,197 ,199 ,211 ,223 ,227 ,229 ,233 ,239 ,241 ,251 ,257 ,263 ,269 ,271 ,277 ,281 ,283 ,293 ,307 ,311 ,313 ,317 ,331 ,337 ,347 ,349 ,353 ,359 ,367 ,373 ,379 ,383 ,389 ,397 ,401 ,409 ,419 ,421 ,431 ,433 ,439 ,443 ,449 ,457 ,461 ,463 ,467 ,479 ,487 ,491 ,499 ,503 ,509 ,521 ,523 ,541 ,547 ,557 ,563 ,569 ,571 ,577 ,587 ,593 ,599 ,601 ,607 ,613 ,617 ,619 ,631 ,641 ,643 ,647 ,653 ,659 ,661 ,673 ,677 ,683 ,691 ,701 ,709 ,719 ,727 ,733 ,739 ,743 ,751 ,757 ,761 ,769 ,773 ,787 ,797 ,809 ,811 ,821 ,823 ,827 ,829 ,839 ,853 ,857 ,859 ,863 ,877 ,881 ,883 ,887 ,907 ,911 ,919 ,929 ,937 ,941 ,947 ,953 ,967 ,971 ,977 ,983 ,991 ,997 ,1001};
int main(){
    ll n;
    ll mod=1e9+7;
    ll ans=1;
    cin>>n;
    ll b[1010];
    int pos=0;
    while(1){
        if(a[pos]<=n){
           pos++;
        }
        else break;
    }
    for(int i=1; i<=pos-1; i++){
        ll sum=0;
        for(int j=1; j<=n; j++){
            if(fun(a[i],j)<=n){
                sum+=(n/fun(a[i],j));
            }else break;
        }
        ans=ans*(sum+1);
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
/*#include <iostream>
#include <bits/stdc++.h>
#define fast_cin ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define ll long long int
using namespace std;

vector<ll> dp(100005,0);
int m=1e9+7;
bool cmp(pair<int,int>&a,pair<int,int>&b)
{
    if(a.second==b.second)
        return a.first<b.first;
    else
        return a.second<b.second;
}

bool cmp_(pair<int,pair<int,int> >&a,pair<int,pair<int,int> >&b)
{
   return a.second.first<b.second.first;
}

void factorial()
{
    dp[1]=1;
    for(int i=2;i<=100000;i++)
    {
        dp[i]=((dp[i-1]%m)*(i%m))%m;
    }
}

int main()
{
    fast_cin;
    int t;
    cin>>t;
    int tc=0;
    while(t--)
    {
      int n,w;
      cin>>n>>w;
      vector<int> val,wt;
      for(int i=0;i<n;i++)
      {
          int u;
          cin>>u;
          val.pb(u);
      }
      for(int i=0;i<n;i++)
      {
          int u;
          cin>>u;
          wt.pb(u);
      }
      int ans=0;
      for(int i=0;i<n;i++)
      {
          int netwt=w;
          int j=i;
          while(j<n)
          {

          }
      }
    cout<<ans<<endl;
    }
    return 0;
}*/
#include <iostream>
#include <bits/stdc++.h>
#define fast_cin ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define ll long long int
using namespace std;

vector<ll> dp(100005,0);
int m=1e9+7;
bool cmp(pair<int,int>&a,pair<int,int>&b)
{
    if(a.second==b.second)
        return a.first<b.first;
    else
        return a.second<b.second;
}

bool cmp_(pair<int,pair<int,int> >&a,pair<int,pair<int,int> >&b)
{
   return a.second.first<b.second.first;
}

void factorial()
{
    dp[1]=1;
    for(int i=2;i<=100000;i++)
    {
        dp[i]=((dp[i-1]%m)*(i%m))%m;
    }
}
void binary(int n)
{
    // array to store binary number
    int binaryNum[32];

    // counter for binary array
    int i = 0;
    while (n > 0) {

        // storing remainder in binary array
        binaryNum[i] = n % 2;
        n = n / 2;
        i++;
    }

    // printing binary array in reverse order
    for (int j = i - 1; j >= 0; j--)
        cout << binaryNum[j];
}
int main()
{
    fast_cin;
    int t;
    t=1;
    int tc=0;
    ll x=10000009;
    while(t--)
    {
        int n;
        cin>>n;
        int dp[n][3]={0};
        vector<int> a;
        vector<int> b;
        vector<int> c;
        for(int i=0;i<n;i++)
        {
            int x,y,z;
            cin>>x>>y>>z;
            a.pb(x);
            b.pb(y);
            c.pb(z);
        }
        dp[0][0]=a[0];
        dp[0][1]=b[0];
        dp[0][2]=c[0];
        for(int i=1;i<n;i++)
        {
            dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
            dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
            dp[i][2]=c[i]+max(dp[i-1][1],dp[i-1][0]);
        }
        cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    }
    return 0;
}


Measured memory_bytes: 6440
import java.util.Scanner;

//Period
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int p = sc.nextInt();
			int q = sc.nextInt();
			int[] a = new int[q];
			StringBuilder sb = new StringBuilder();
			int k = 1;
			int r = p%q;
			int s = -1;
			int t = -1;
			a[r] = k++;
			r*=10;
			sb.append(r/q);
			r%=q;
			while(true){
				if(r==0)break;
				if(a[r]>0){
					s = a[r];
					t = k;
					break;
				}
				a[r] = k++;
				r *= 10;
				sb.append(r/q);
				r %= q;
			}
			System.out.println(sb);
			if(s!=-1){
				for(int i=0;i<t-1;i++){
					if(s-1<=i)System.out.print("^");
					else System.out.print(" ");
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 0
/**
 * @author Video Vocabulary
 * @date 2020-07-11 18:00:43
 */
#include <bits/stdc++.h>

using namespace std;

void solve() {

}

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

    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for (int i=l; i<=r; i++) {
        if (i%d==0) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3644
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    h,a = map(int, input().split())
    print(ceil(h/a))

if __name__ == '__main__':
    main()

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

int main()
{
  string s;
  for(;cin>>s;)
    {
      int ans=-1;
      for(int i=0;i<10;i++)
	{
	  int t[3]={0,0,0};
	  int j=0;
	  for(int x=0;x<3;x++)
	    {
	      if(i==0)
		{
		  if(s[j]=='X' && (j!=s.size()-1 && s[j+1]!='+' && s[j+1]!='='))
		    {
		      t[2]=-1;
		      break;
		    }
		}

	      for(;s[j]!='+' &&s[j]!='='&&j<s.size();j++)
		{
		  t[x]*=10;
		  if(s[j]=='X')
		    t[x]+=i;
		  else
		    t[x]+=s[j]-'0';
		}
	      j++;
	    }
	  if(t[0]+t[1]==t[2])
	    {
	      ans=i;
	      break;
	    }
	}
      if(ans==-1)
	cout<<"NA"<<endl;
      else
	cout<<ans<<endl;
    }
}

Measured memory_bytes: 1184