akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")

#include <bits/stdc++.h>
using namespace std;
 
#define len(x) (int)((x).size())
#define endl '\n'
#define int long long
#define x first 
#define y second
#define dbg(x) cout << #x << " = " << x << endl;

void solve(); signed main() {
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(10);
    solve();
    return 0;
}
 
const int MOD = 998244353, MAXN = 1e6 + 10, INF = 1e18 + 10, BASE = 37;

void solve() {
    int x, y, z;
    cin >> x >> y >> z;

    swap(x, y);
    swap(x, z);

    cout << x << " " << y << " " << z << endl;
}

Measured memory_bytes: 256
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: u64,
        a: u64,
        b: u64,
        c: u64,
        d: u64,
        e: u64,
    }

    println!("{}", (n as f64 / a.min(b.min(c.min(d.min(e)))) as f64).ceil() as u64 + 4);
}


Measured memory_bytes: 2692
N = int(input())
A_list = list(map(int, input().split()))

if A_list[0] > 1:
    print(-1)
    exit()
elif A_list[0] == 1:
    if N == 0:
        print(1)
    else:
        print(-1)
    exit()


sumA = sum(A_list)
node = 1
count = 1
for i in range(len(A_list) - 1):
    temp = min([node * 2, sumA])
    count += temp
    node = temp - A_list[i + 1]

    if node < 0:
        print(-1)
        exit()

    sumA -= A_list[i + 1]

print(count)

Measured memory_bytes: 20148
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define f(i,x,n) for(ll i=x;i<n;i++)
#define fl(i,x,n) for(ll i=n;i>=x;i--)
#define mod (ll)1e9+7
#define print(x) cout<<x<<endl
#define vec vector<ll>
#define pai pair<ll, ll>
#define itr(it) :: iterator it
#define MAX (ll)1e16
#define MIN (ll)-1e16
#define X first
#define Y second
#define up upper_bound
#define lo lower_bound
using namespace std;
       ///////////   ///     ///   ///      ///   ////////////  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///////////   ///      ///   ////////////  ////////////
               ///   ///     ///   ///      ///   ///      ///  ///      ///
               ///   ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///     ///   ////////////   ////////////  ///      ///
ll minn( ll a , ll b) 
{
    if(a>b)
        return b;
    return a;
}
ll maxx2( ll a , ll b)
{
    if(a>b)
        return a;
    return b;
}
ll maxx(ll a,ll b,ll c)
{
  return maxx2(a,maxx2(b,c));
}
ll gcdd(ll a, ll b)
{
    if(b==0)
        return a;
    else
        return gcdd(b,a%b);
}
ll dsum(ll n)
{
    ll sum=0;
    while(n>0)
    {
        sum+=n%10;
        n/=10;
    }
    return sum;
}
ll poww(ll a,ll b)
{
    if(b<=0)
        return 1;
    if(b==1)
        return a;
    if(b==2)
        return (a*a);
    else
        return poww(poww(a,b/2),2)*(poww(a,b%2));
}
ll sumsq(ll x,ll y,ll z)
{
    return (x-y)*(x-y)+(y-z)*(y-z)+(z-x)*(z-x);
} 
signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    IOS;
    ll t;
    cin>>t;
    cout<<t+t*t+t*t*t<<endl;
    return 0;
}

Measured memory_bytes: 3636
// In god we trust
 
#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>
#include <signal.h>
#include <thread>
 
#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define INF 1000000000 
#define LINF 1000000000000000000
#define int long long
using namespace std;
using namespace std::chrono;
 

signed main(){
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL);
  
  int n, k;
  cin >> n >> k;
  int a[n];
  
  for (int i = 0; i < n; i++){
    cin >> a[i];
    a[i]--;
    a[i] %= k;
  }

  int p_s[n];
  p_s[0] = a[0];
  int ans = 0;
  unordered_map<int, int> m;
  m[a[0]] = 1;
  for (int i = 1; i < n; i++){
    if (i >= k)
      m[p_s[i - k]]--;
    
    p_s[i] = (p_s[i - 1] + a[i]) % k;
    if (m.find(p_s[i]) != m.end())
      ans += m[p_s[i]];
    
    if (m.find(p_s[i]) != m.end())
      m[p_s[i]]++;
    else
      m[p_s[i]] = 1;
  }
  for (int i = 0; i < min(k - 1, n); i++){
    if (!p_s[i])
      ans++;
  }
  cout << ans << endl;

  
  
}


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

int main(int argc, char** argv) {
  int N;
  std::cin >> N;
  std::vector<int> P(N);
  std::vector<int> Q(N);
  for (auto& e : P) std::cin >> e;
  for (auto& e : Q) std::cin >> e;

  std::vector<long long> fac(N+1, 1);
  long long sum_factorial {1};
  for (auto i = 1;i < N+1;++i) {
    sum_factorial *= i;
    fac[i] = sum_factorial;
  }

  long long P_num {};
  for (auto i = 0;i < N;++i) {
    int num {1};
    for (auto j = i+1;j < N;++j) {
      if (P[i] > P[j]) ++num;
    }
    P_num += fac[N  - i - 1]*(num - 1); 
  }
  long long Q_num {};
  for (auto i = 0;i < N;++i) {
    int num {1};
    for (auto j = i+1;j < N;++j) {
      if (Q[i] > Q[j]) ++num;
    }
    Q_num += fac[N  - i - 1]*(num - 1); 
  }
  std::cout << ((Q_num < P_num)?(P_num-Q_num):(Q_num-P_num)) << '\n';
}


Measured memory_bytes: 888
n, m = map(int, input().split())
divisors = []
for i in range(1,m+1):
    if i * i > m:
        break
    if i * i == m:
        divisors.append(i)
        break
    if m % i == 0:
        divisors.append(i)
        divisors.append(m // i)
ans = filter(lambda d: d <= m//n, divisors)
print(max(ans))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

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

int main() {
	i64 n, m; scanf("%lld%lld", &n, &m); std::vector<i64> a(n);
	for(int i = 0; i < n; i++) scanf("%lld", &a[i]);

	i64 B = 1;
	for(int i = 0; i < n; i++) {
		B = B / std::__gcd(B, a[i] / 2) * (a[i] / 2);
		if(B > m) {
			printf("0\n");
			return 0;
		}
	}
	
	for(int i = 0; i < n; i++) {
		i64 cnt = B / (a[i] / 2);
		if(cnt % 2) continue;
		printf("0\n");
		return 0;
	}

	i64 ans = (m - B) / (2 * B) + 1;
	printf("%lld\n", ans);
	return 0;
}


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

int main() {
  int n,cnt = 1;
  cin >> n;
  vector<int>height(n);
  for (int i = 0; i < n; i++) {
    cin >> height.at(i);
  }
  for (int i = 1; i < n; i++) {
    bool check = 1;
    for (int j = 0; j < i; j++) {
      if (height.at(i) < height.at(j)) {
        check = 0;
      }
    }
    if (check == 1) cnt ++;
  }
  cout << cnt;
}

Measured memory_bytes: 256
//# define FLAG
///delet....................................
# include   <bits/stdc++.h>
using namespace std;
# define    VI                      vector<int>
# define    pb                      push_back
# define    mp                      make_pair
# define    IOS                     ios::sync_with_stdio(false)
# define    mem(a,b)                memset(a,b,sizeof(a))
# define    FO(i,n,a)               for(int i=n; i>=a; --i)
# define    FOR(i,a,n)              for(int i=a; i<=n; ++i)
# define    pi                      acos(-1.0)
# define    MAX                     0x7fffffffffffff
# define    INF                     0x3f3f3f3f
# define    MOD                     1000000007
# define    eps                     0.00000001
# define    hr                      putchar('\n')
# define    bug                     puts("H")
# pragma    comment(linker,"/STACK:1024000000,1024000000")
typedef     unsigned long long      ULL;
typedef     long long               LL;
inline char gtc() {
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
# define    Template                int
inline Template read() {
    int flag=1;
    char ch=gtc();
    if(ch==EOF)return EOF;   ///EOFµÄÖµÊÇ-1
    Template sum=0;
    while(!((ch>='0'&&ch<='9')||ch=='-'))ch=gtc();
    if(ch=='-')flag=-1,ch=gtc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-'0',ch=gtc();
    return sum*flag;
}
inline void out(Template x) {
    if(x<0)putchar('-'),x=-x;
    if(x>9)out(x/10);
    putchar(x%10+'0');
}
///coding...................................

int main() {
    IOS;
#ifdef FLAG
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif
    int n,num=0;
    int a,b;
    cin>>n;
    while(n--)cin>>a>>b,num+=b-a+1;
    cout<<num<<endl;
    return 0;
}











///delete FLAG..............................




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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}


struct ModX{
	using ull=uint64_t;
	static const ull mod=(1ll<<61)-1;
	static const ull MASK30=(1ll<<30)-1;
	static const ull MASK31=(1ll<<31)-1;

	ull a;

	ModX& s(ull vv){
		a=vv<mod?vv:vv-mod;
		return *this;
	}
	ModX(ull a=0):a(a%mod){}
	
	ModX& operator+=(const ModX& x){return s(a+x.a);}
	ModX& operator-=(const ModX& x){return s(a+mod-x.a);}
	ModX& operator*=(const ModX& x){
		const ull au=a>>31;
		const ull ad=a&MASK31;
		const ull bu=x.a>>31;
		const ull bd=x.a&MASK31;
		const ull mid=ad*bu+au*bd;
		const ull midu=mid>>30;
		const ull midd=mid&MASK30;
		const ull z=au*bu*2+midu+(midd<<31)+ad*bd;
		return s((z&mod)+(z>>61));
	}

	ModX operator+(const ModX &x)const{return ModX(*this)+=x;}
	ModX operator-(const ModX &x)const{return ModX(*this)-=x;}
	ModX operator*(const ModX &x)const{return ModX(*this)*=x;}

	bool operator==(const ModX &x)const{return a==x.a;}
	bool operator!=(const ModX &x)const{return a!=x.a;}
	bool operator<(const ModX &x)const{return a<x.a;}

	ModX operator-()const{return ModX()-*this;}
};

istream& operator>>(istream& in,const ModX& a){
	return (in>>a.a);
}

ostream& operator<<(ostream& out,const ModX& a){
	return (out<<a.a);
}
using xint=ModX;
const xint base(119);
const int RHSIZE=1111111;
xint basepow[RHSIZE];
struct RHInit{
	RHInit(){
		basepow[0]=1;
		for(int i=1;i<RHSIZE;i++)basepow[i]=basepow[i-1]*base;
	}
}RHInitDummy;

signed main(){
	int N;string S;cin>>N>>S;

	vector<xint>H(N+1);
	rep(i,N)H[i+1]=H[i]*base+S[i];

	int lb=0,ub=N;
	while(ub-lb>1){
		int mid=(ub+lb)/2;
		
		set<xint>s;
		bool ok=false;
		for(int i=0;i+mid<=N;i++){
			if(i>=mid){
				xint hs=H[i]-H[i-mid]*basepow[mid];
				s.insert(hs);
			}
			xint hs=H[i+mid]-H[i]*basepow[mid];
			if(s.find(hs)!=s.end())ok=true;
		}
		if(ok)lb=mid;
		else ub=mid;
	}
	cout<<lb<<endl;
	return 0;
}

Measured memory_bytes: 9216
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n,a,b;
	std::cin >> n >> a >> b;
	int sum = n/(a+b)*a + std::min(n-n/(a+b)*(a+b),a);
	print(sum);
	return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;

namespace Contest
{
    class Program
    {
        public void Solve()
        {
            var sc = new Scanner();

            var S = sc.Next();
            int ans = 0;
            for (int left = 0; left < S.Length; left++)
            {
                if (C(S[left]))
                {

                    int right;
                    for (right = left + 1; right < S.Length; right++)
                    {
                        if (!C(S[right])) break;
                    }

                    ans = Math.Max(ans, right - left);
                    left = right;
                }
            }
            Console.WriteLine(ans);
        }

        bool C(char c) => c == 'A' || c == 'T' || c == 'G' || c == 'C';

        static void Main(string[] args) => new Program().Solve();
    }

    class Scanner
    {
        private char _separator = ' ';
        private StreamReader _stream = new StreamReader(Console.OpenStandardInput());
        private int _pos = 0;
        private string[] _line = new string[0];
        public string Next()
        {
            if (_pos >= _line.Length)
            {
                _line = _stream.ReadLine().Split(_separator);
                _pos = 0;
            }
            return _line[_pos++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public string[] Array()
        {
            if (_pos >= _line.Length)
                _line = _stream.ReadLine().Split(_separator);
            _pos = _line.Length;
            return _line;
        }
        public int[] IntArray()
        {
            var arr = Array();
            var res = new int[arr.Length];
            for (int i = 0; i < arr.Length; i++)
            {
                res[i] = int.Parse(arr[i]);
            }
            return res;
        }
        public long[] LongArray()
        {
            var arr = Array();
            var res = new long[arr.Length];
            for (int i = 0; i < arr.Length; i++)
            {
                res[i] = long.Parse(arr[i]);
            }
            return res;
        }
        public double[] DoubleArray()
        {
            var arr = Array();
            var res = new double[arr.Length];
            for (int i = 0; i < arr.Length; i++)
            {
                res[i] = double.Parse(arr[i]);
            }
            return res;
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 998244353;
const ll SQ = 330;

ll F[N], I[N];
ll mul(ll a, ll b) {
	return (a * b) % Mod;
}
ll sum(ll a, ll b) {
	return (a + b + Mod) % Mod;
}
ll Pow(ll a, ll b) {
	ll res = 1;
	for (; b; b >>= 1, a = mul(a, a))
		if (b & 1)
			res = mul(res, a);
	return res;
}
ll inv(ll x) {
	return Pow(x, Mod - 2);
}
ll C(ll r, ll n) {
	if (r < 0 || r > n)
		return 0;
	return mul(F[n], mul(I[r], I[n - r]));
}
int main () {
	ios::sync_with_stdio(0), cin.tie(0);
	F[0] = 1;
	for (int i = 1; i < N; i ++)
		F[i] = mul(i, F[i - 1]);
	I[N - 1] = inv(F[N - 1]);
	for (int i = N - 2; ~i; i --)
		I[i] = mul(i + 1, I[i + 1]);
	ll n, m, k;
	cin >> n >> m >> k;
	ll ans = 0;
	for (int x = n - k; x <= n; x ++){
		if (x == 1) {
			ans = sum(ans, m);
			continue;
		}
		ll res = C(x - 1, n - 1);
		res = mul(res, m);
		res = mul(res, Pow(m - 1, x - 1));
		ans = sum(ans, res);
	}
	cout << ans;
}

Measured memory_bytes: 6780
#include<bits/stdc++.h>
#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 rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main(void) {
    ll h, w;
    cin >> h >> w;


    ll ans = 0;

    if (h == 1 || w == 1) {
        cout << 1 << endl;
        return 0;
    }

    ll a = (w + 1) / 2;
    ll b = (h + 1) / 2;
    if (h % 2 == 0 && w % 2 == 1) {
        ans = a * (h / 2) + (a - 1) * (h / 2);
    }
    else if (h % 2 == 1 && w % 2 == 1) {
        ans = a * (h / 2 + 1) + (a - 1) * (h / 2);
    }
    else {
        ans = h * a;
    }

    cout << ans << endl;
    return 0;
}


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

int n;
int li[105];
int main(){
	cin >> n;
	int tot = 0;
	for(int i=1;i<=n;i++) cin >> li[i];
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			tot+=li[i]*li[j];
		}
	}
	cout << tot << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;
typedef tree<
        pair<int, int>, // change type
        null_type,
        less<pair<int, int> >, // change type
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;

typedef long long ll;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)(x).size()
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
const double PI = 3.14159265358979323846;
const double eps = (1e-8);


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("facebook.txt", "w", stdout);
#endif
    int x, t;
    cin >> t >> x;
    cout << fixed << setprecision(6) <<  1.0 * t / x;
    return  0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

#include <set>
#include <unordered_map>
#include <stack>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T>bool chmaxj(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; }
void YesNo(bool y) { cout << (y ? "Yes" : "No") << endl; } //true==yes


#define INF 21474836

//////////////////////////////////////////////////////////////

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}

int main() {

	int K;
	cin >> K;
	long long ans = 0;

	int gcdslot[205][205] = { -1 };
	rep(i, 204)rep(j, 204)gcdslot[i][j] = -1;

	rep(i, K) {
		rep(j, K) {
			int gcd12 = gcd(i + 1, j + 1);
			rep(k, K) {
				if (gcdslot[gcd12][k + 1] == -1) {
					gcdslot[gcd12][k + 1] = gcd(gcd12, k + 1);
					gcdslot[k + 1][gcd12] = gcdslot[gcd12][k + 1];
				}
				ans += gcdslot[gcd12][k + 1];
			}
		}
	}

	cout << ans << endl;

}


Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
string a,b;
int s1,s2;
int main()
{
    cin>>a>>b;
    for(int i=1;i<=a.size()+b.size();i++)
        if(i&1) cout<<a[s1++];
        else cout<<b[s2++];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int gcd(int a, int b){
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


// int factrial(int n){
//   if(n == 0) return 1;
//   return n*factrial(n-1);
// }

// int divisor(int a){
//   int cnt = 0;
//   for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
//   return cnt;
// }

// int comb(int n, int k){
//   return fact(n) / (fact(n-k)*fact(k));
// }

int answer(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

ll b[200010];
int main(){
  int D,N;
  cin >> D >> N;
  int ans = pow(100,D);
  if(N != 100) ans *= N;
  else ans *= (N+1);

  cout << ans << endl;
}






Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int inf = 1000000000; //10^9
const ll MOD = 1e9 + 7;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
int n, k;
vector<int> d;
vector<vector<int>> a;

void input() {
    cin >> n >> k;
    d.resize(k); //resizeは要素の数変える
    a.resize(k, vector<int>());
    rep(i, k) {
        cin >> d[i];
        a[i].resize(d[i]);
        rep(j, d[i]) {
            cin >> a[i][j];
        }
    }
}

void solve() {
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        bool have = false;
        for(auto v : a) {
            for(auto p : v) {
                if(p == i) have = true;
            }
        }
        if(!have) ans++;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3692
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    min_i = i
    for j in range(i+1, N):
        if A[j] < A[min_i]:
            min_i = j
    if i != min_i:
        ans += 1
        A[i], A[min_i] = A[min_i], A[i]
print(*A)
print(ans)



Measured memory_bytes: 5608
#include <bits/stdc++.h>
        using namespace std;
        #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
        #define M_PI 3.14159265358979323846
        #define data data_
        #define ff first
        #define ss second
        #define pb push_back
        #define ld long double
        #define int long long
        #define print(t) cout << "Case #" << t << ": ";
        int32_t main()
        {
            tani_nachi_ke  
            
            
            int n;
            cin >> n;
            int a[n];
            for(int i = 0; i < n; i++)
                cin >> a[i];
            sort(a, a+n);
            int ans = 0;
            ans += a[n-1];
            int cur = n-2;
            int i = n-2;
            while(cur > 0)
            {
                if(cur >= 2)
                {
                    cur-=2;
                    ans += 2*a[i];
                    i--;
                }
                else
                {
                    cur-=1;
                    ans += a[i];
                    i--;
                }
            }
            cout << ans << '\n';




           return 0;
        }
          

Measured memory_bytes: 5216
#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
const int ma = 1e5;
vector< int > used(ma), vs(ma);
vector< vector< int > > to(ma);
void dfs( int v )
{
    if( used[v] ) return;
    used[v] = 1;
    for( int u : to[v] )dfs( u );
    vs.emplace_back( v ) ;
}
main()
{
    int m,n;
    scanf( "%d %d", &n, &m );
    for( int i = 0; i < m;i++ )
    {
        int a,b;cin >> a >> b;--a,--b;
        to[a].emplace_back(b);
    }
    for( int i = 0; i < n;i++ ) dfs(i);
    vector< int > dp(n,0);
    int ans = 0;
    for( int v : vs )
    {
        for( int u : to[v] )
        {
            dp[v] = max( dp[v], dp[u] + 1 );
        }
        ans = max( ans, dp[v] );
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 9336
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}

/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*最大公約数*/
unsigned long long GCD(long long L,long long R){
    if(L>R){
        long long temp=R;
        R = L;
        L = temp;
    }
    unsigned long long pp=0,ppt=0;
    unsigned long long ans=0;
    if(R%L==0){
        ans = L;
    }else{
        while(true){
            ppt = pp;
            pp=R%L;
            if(pp == 0){
                ans = ppt;
                break;
            }
            R = L;
            L = pp;
        }
    }    
    return ans;    
}

/*最小公倍数*/
unsigned long long LCM(long long L,long long R){
    unsigned long long ans;
    unsigned long long gcd = GCD(L,R);
    ans = (L/gcd)*R;
    return ans;
}

/*Combination set*/
#define mod 1000000007
#define maxcomb 3000/*大きいものを求めるときはここを変える*/
vector<long long> fc(maxcomb+1);
vector<long long> ifc(maxcomb+1);
long long modpow(long long x,long long n){
    long long ans = 1;
    while(n > 0){
        if(n & 1) {
            ans = ans*x%mod;
        }
        x = x*x%mod;
        n >>= 1;
    }
    return ans;
}
void Conb(){
    fc[0]= 1;
    ifc[0]=1;
    for(long long i=0;i<maxcomb;i++){
        fc[i+1] = fc[i]*(i+1)%mod;//n!(mod)
        ifc[i+1] = ifc[i]*modpow(i+1,mod-2)%mod;//k!^{M-2} (mod)
    }
}
unsigned long long Combination(long long L,long long R){
    unsigned long long up=1,ans;
    Conb();
    if(L==0&&R==0){
        return 1;
    }else if(L<R||L<0){
        return 0;
    }else{
        long long t = ifc[L-R]*ifc[R]%mod;
        ans = t*fc[L]%mod;
    }
    return ans;
}
/*Combination set ここまで*/

/*ここから*/
int main() {
    int x;
    cin >> x;
    if(x==0){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3684
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))

f = 0
for a1 in range(min(c1)+1):
    b1 = c1[0]-a1
    b2 = c1[1]-a1
    b3 = c1[2]-a1

    a2_1 = c2[0]-b1
    a2_2 = c2[1]-b2
    a2_3 = c2[2]-b3
    if not (a2_1==a2_2 and a2_2==a2_3):
        continue

    a3_1 = c3[0]-b1
    a3_2 = c3[1]-b2
    a3_3 = c3[2]-b3
    if not (a3_1==a3_2 and a3_2==a3_3):
        continue

    print("Yes")
    f=1
    break

if not f:
    print("No")

Measured memory_bytes: 9156
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
//		Scanner scan= new Scanner(System.in);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		int N = Integer.parseInt(st.nextToken());
		int D = Integer.parseInt(st.nextToken());
		
//		int[] x = new int[N];
//		int[] y = new int[N];
		int count = 0;
		for (int i = 0; i < N; i++) {
			st = new StringTokenizer(br.readLine());
			int x = Integer.parseInt(st.nextToken());
			int y = Integer.parseInt(st.nextToken());
			
			if (Math.sqrt(Math.pow(x,2) + Math.pow(y,2)) <= D) {
				count++;
			}
		}
		System.out.println(count);
		
	}

}


Measured memory_bytes: 45736
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,X,Y; cin>>n>>m>>X>>Y;
  vector<int>x(n),y(m);
  for(int i=0;i<n;i++) cin>>x.at(i);
  for(int i=0;i<m;i++) cin>>y.at(i);
  int s=0;
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  if(X>=Y) cout<<"War"<<endl;
  else{
    for(int i=X+1;i<=Y;i++){
      if(i>x.at(n-1)&&i<=y.at(0))
        s=1;
    }
    if(s==0) cout<<"War"<<endl;
    else cout<<"No War"<<endl;
  }
}

Measured memory_bytes: 256
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

fn main() {
    // 入力
    let N = get!(i64);
    let p = get!(i64; N);

    // 最も高い品物を半額にすればよい
    let ans: i64 = p.iter().sum::<i64>() - p.iter().max().unwrap() / 2;

    // 出力
    println!("{}", ans);
}


Measured memory_bytes: 4352
#coding;utf-8
n = int(input())
#nが奇数の場合は0
if n % 2 != 0:
    print(0)
    exit()
#偶数の場合は、2と5で割り切れる数を数える
else:
    n //= 10
    ans = n
    while n > 0:
        n //= 5
        ans += n
    print(ans)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
intt gcd(intt a, intt b) {return b ? gcd(b, a % b) : a;}
intt lcm(intt a, intt b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = ((res%mod) * (a%mod))%mod;
      a = ((a%mod) * (a%mod))%mod;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return n*fact(n-1);
}
void go()
{
#ifndef ONLINE_JUDGE
  freopen("inn.txt","r",stdin);
  freopen("ouut.txt","w",stdout);
  #endif
}
///////////U L R D
int dx[4]={0,-1,1,0};
int dy[4]={1,0,0,-1};

template <typename T1, typename T2>
struct less_second {
    typedef pair<T1, T2> type;
    bool operator ()(type const& a, type const& b) const {
        return a.second > b.second;
    }
};

int main() 
{ 
    fast_io
    go();
    int n;cin>>n;
    if(n%1000==0)
      cout << "0" <<"\n";
    else
    {
      int temp=n%1000;
      cout << 1000-temp <<"\n";
    }
}















Measured memory_bytes: 3640
using System;
using System.Linq;

namespace AtCoder
{
    class Program2
    {

        static void Main(string[] args)
        {
            int N = Int32.Parse(Console.ReadLine());
            var duraciones = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();

            int[] subordinados = new int[N];

            for(int i=0;i<N-1;i++)
            {
                subordinados[duraciones[i]-1]++;
            }
            for (int i = 0; i < N; i++)
            {
                Console.WriteLine(subordinados[i].ToString());
            }
        }
    }
}

Measured memory_bytes: 43704
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]int, 0)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		m[nextInt(sc)]++
	}
	// nが奇数の場合はm[0] == 1, nが奇数の場合はm[1]==2かつ
	// m[k] (k!=0)についてm[k]==2でなければならない
	mod := int(1e9 + 7)
	ans := 1
	ok := true
	if (n%2 == 0 && m[1] != 2) || (n%2 != 0 && m[0] != 1) {
		ok = false
	} else {
		for k, v := range m {
			if k == 0 {
				continue
			} else if v == 2 {
				ans = (ans * 2) % mod
			} else {
				ok = false
				break
			}
		}
	}
	if ok {
		fmt.Println(ans)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 6528
#include <stdio.h>

int main(void)
{
	int n,a,max=0,min=1000,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(a>max)max=a;
		if(min>a)min=a;
	}
	printf("%d",max-min);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define Set(a,b) memset(a,b,sizeof(a))
template<class T>inline void init(T&x){
	x=0;char ch=getchar();bool t=0;
	for(;ch>'9'||ch<'0';ch=getchar()) if(ch=='-') t=1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+(ch-48);
	if(t) x=-x;return;
}typedef long long ll;
const int N=2e5+10;
const int INF=1e9;
int n;
struct ball{int x,y;inline bool operator <(const ball b)const{return x<b.x;}}A[N];
int main()
{
	init(n);ll ans=0;
	int lmin=INF,rmin=INF,lmax=0,rmax=0;
	for(int i=1;i<=n;++i) {
		int x,y;init(x),init(y);
		if(x>y) swap(x,y);
		A[i].x=x,A[i].y=y;
		lmin=min(lmin,A[i].x);
		lmax=max(lmax,A[i].x);
		rmin=min(rmin,A[i].y);
		rmax=max(rmax,A[i].y);
	}ans=(ll)(rmax-rmin)*(lmax-lmin);
	sort(A+1,A+1+n);rmin=lmin;
	int mi,mx;mi=mx=A[1].y;
	int mind=INF;
	for(int i=2;i<=n;++i) {
		mi=min(mi,A[i].y);mx=max(mx,A[i].y);
		if(i<n) mind=min(mind,max(mx,A[n].x)-min(mi,A[i+1].x));
		else    mind=min(mind,mx-mi);
	}
	ans=min(ans,(ll)mind*(rmax-rmin));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
string in;
void init(){
in = "";
}
bool input(){
return !!(cin>>in);
}
string solve(){
string ans("");
for(int i=0;i<in.size();i++){
if(in[i]=='@'){
int tmp = in[i+1]-'0';
for(int j=0;j<tmp;j++){
ans += in[i+2];
}
i+=2;
}else{
ans += in[i];
}
}
return ans;
}
int main(){
while(init(),input()){
cout<<solve()<<endl;
}
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    int n = (x - z) / (y + z);
    cout << n << endl;
    return 0;
}

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

#define fread_siz 1024

inline int get_c(void)
{
	static char buf[fread_siz];
	static char *head = buf + fread_siz;
	static char *tail = buf + fread_siz;

	if (head == tail)
		fread(head = buf, 1, fread_siz, stdin);

	return *head++;
}

inline int get_i(void)
{
	register int ret = 0;
	register int neg = false;
	register int bit = get_c();

	for (; bit < 48; bit = get_c())
		if (bit == '-')neg ^= true;

	for (; bit > 47; bit = get_c())
		ret = ret * 10 + bit - 48;

	return neg ? -ret : ret;
}

template <class T>
inline T min(T a, T b)
{
	return a < b ? a : b;
}

const int inf = 2e9;
const int maxn = 20005;

int n, m;
int s, t;

int edges;
int hd[maxn];
int to[maxn];
int nt[maxn];
int fl[maxn];

inline void add(int u, int v, int f)
{
	nt[edges] = hd[u]; to[edges] = v; fl[edges] = f; hd[u] = edges++;
	nt[edges] = hd[v]; to[edges] = u; fl[edges] = 0; hd[v] = edges++;
}

int dep[maxn];

inline bool bfs(void)
{
	static int que[maxn];
	static int head, tail;
	
	memset(dep, 0, sizeof(dep));
	head = 0, tail = 0;
	que[tail++] = s;
	dep[s] = 1;
	
	while (head != tail)
	{
		int u = que[head++], v;
		for (int i = hd[u]; ~i; i = nt[i])
			if (!dep[v = to[i]] && fl[i])
				dep[v] = dep[u] + 1, que[tail++] = v;
	}
	
	return dep[t];
}

inline int dfs(int u, int f)
{
	if (u == t || !f)
		return f;
	
	int used = 0, flow, v;
	
	for (int i = hd[u]; ~i; i = nt[i])
		if (dep[v = to[i]] == dep[u] + 1 && fl[i])
		{
			flow = dfs(v, min(f - used, fl[i]));
			
			used += flow;
			fl[i] -= flow;
			fl[i^1] += flow;
			
			if (used == f)
				return f;
		}
		
	if (!used)
		dep[u] = 0;
		
	return used;
}

inline int dinic(void)
{
	int maxFlow = 0, newFlow;
	
	while (bfs())
		while (newFlow = dfs(s, inf))
			maxFlow += newFlow;
			
	return maxFlow;
}

signed main(void)
{
	n = get_i();
	m = get_i();
	
	memset(hd, -1, sizeof(hd));
	
	for (int i = 1; i <= m; ++i)
	{
		int u = get_i();
		int v = get_i();
		int f = get_i();
		add(u, v, f);
	}
	
	s = 0, t = n - 1;
	
	printf("%d\n", dinic());
}

Measured memory_bytes: 3364
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n+1];
		long tot=0;
		long []sum=new long[n+1];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
			tot+=arr[i];
		}
		for(int i=0;i<n;i++) {
			sum[i]+=2*arr[i];

		}
		long []ans=new long[n+1];
		func2(n,tot,sum,ans);
		for(int i=0;i<n;i++) {
			System.out.print(ans[i]+" ");
		}
		
	}
	// TLE
	public static void func(int n,long tot, long []sum, long []ans) {
 		for(int i=0;i<n;i++) {
			long x=0;
			for(int j=(i+1)%n;j!=i;j=(j+2)%n) {
				x+=sum[j];
			}
			ans[i]=tot-x;
		}
	}
	public static void func2(int n,long tot, long []sum, long []ans) {
		long x=0;
		for(int i=n-2;i>0;i-=2) {
			x+=sum[i];
		}
		long y=tot-x;
		ans[0]=y;
		long temp=ans[0];
		for(int i=0;i<n-1;i++) {
			ans[i+1]=sum[i]-temp;
			temp=ans[i+1];
		}
	}
}


Measured memory_bytes: 65204
#include <iostream>

int main(void){
    using namespace std;
    static int s[2001][1001];
    int n, k;
    int x, y;
    char c;
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> k;
    for(int i=0; i<n; i++){
        cin >> x >> y >> c;
        y %= 2*k;
        if(c=='W'){
            x += k;
        }
        if(y>=k){
            y-=k;
            x+=k;
        }
        x %= 2*k;
        s[x+1][y+1]++;
    }
    for(int x=0; x<2*k; x++){
        for(int y=0; y<k; y++){
            s[x+1][y+1] += s[x][y+1] + s[x+1][y] - s[x][y];
        }
    }
    int max = 0;
    for(int x=0; x<k; x++){
        for(int y=0; y<k; y++){
            int t = s[0][0] - s[0][y]
                - s[x][0] + 2*s[x][y] - s[x][k]
                + s[x+k][0] - 2*s[x+k][y] + s[x+k][k] 
                - s[2*k][0] + s[2*k][y];
            t = t<n/2 ? n-t : t;
            max = t>max ? t : max;
        }
    }
    cout << max;
    return 0;
}


Measured memory_bytes: 8064
#include<stdio.h>

#define N 100000

int main(){
    int A[N];
    int n;
    int b;
  
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&b);
        A[b-1]=i+1;
    }
    for(int i=0;i<n;i++){
        printf("%d ",A[i]);
    }
    printf("\n");

}


Measured memory_bytes: 1152
#include <iostream>
using namespace std;
typedef long long int ll;
int main(){
    ll a,b,k;
    cin>>a>>b>>k;
    ll diff=0;
    if(a <= k){
        diff = k-a;
        a = 0;
    }else{
        a = a-k;
    }
    if(b <= diff){
        b = 0;
    }else{
        b = b-diff;
    }

    cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
const int mod=1e9+7;

int n,a[N],b[N],c[N];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for (int i=1;i<=n;i++){
		cin >> a[i];
		if (a[i]>a[i-1]){
			c[i]++;
		}
	}
	for (int i=1;i<=n;i++){
		cin >> b[i];
	}
	int no=a[n]!=b[1];
	for (int i=n;i;i--){
		if (c[i]&&b[i]<a[i]) no=1;
		if (b[i]>b[i+1]){
			c[i]++;
			if (a[i]<b[i]) no=1;
		}
	}
	int ans=!no;
	for (int i=1;i<=n;i++){
		if (!c[i]){
			ans=1ll*ans*
			min(a[i],b[i])%mod;
		}
	}
	cout << ans << "\n";
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    ll a, b, k;
    cin >> a >> b >> k;

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

Measured memory_bytes: 256
use strict;
use warnings;

my ($n, $a, $b);
{
  my $in = <STDIN>;
  ($n, $a, $b) = split(" ", $in);
}
my $MOD = 1e9 + 7;
my $modpow = sub {
  my ($a, $n, $MOD) = @_;
  my $res = 1;
  while ($n > 0) {
    $res = $res * $a % $MOD if $n & 1;
    $a = $a * $a % $MOD;
    $n >>= 1;
  }
  return $res;
};
my $modinv = sub {
  my ($a, $MOD) = @_;
  return $modpow->($a, $MOD - 2, $MOD);
};
my $comb = sub {
  my ($n, $k) = @_;
  my $a = 1;
  my $b = 1;
  for (my $i=0; $i<$k; $i++) {
    $a *= $n - $i;
    $a %= $MOD;
    $b *= $i + 1;
    $b %= $MOD;
  }
  $a * $modinv->($b, $MOD) % $MOD;
};

my $ans = $modpow->(2, $n, $MOD) - 1;
$ans += $MOD - $comb->($n, $a, $MOD);
$ans += $MOD - $comb->($n, $b, $MOD);
print $ans % $MOD, "\n";

Measured memory_bytes: 768
#include <stdio.h>
#include <string.h>
#include <algorithm>

#define MAX(a, b)	((a) > (b) ? (a) : (b))
#define MIN(a, b)	((a) < (b) ? (a) : (b))
#define ABS(a)		((a) < (0) ? (-(a)) : (a))

void setIO(const char * in = NULL, const char * out = NULL);

int main(){
	
	//setIO("file");
	
	
	long long H, W;	scanf("%lld %lld", &H, &W);
	
	long long a[3];
	
	long long ans = H * W;
	
	for(long long i = 0; i <= H; ++i){
		a[0] = i * W;
		int n = W >> 1;
		a[1] = n * (H - i);
		a[2] = (W - n) * (H - i);
		
		std::sort(a, a + 3);	
		
		ans = MIN(ans, a[2] - a[0]);
		
		a[0] = i * W;
		n = (H - i) >> 1;
		a[1] = n * W;
		a[2] = ((H - i) - n) * W;
		
		std::sort(a, a + 3);	
		
		ans = MIN(ans, a[2] - a[0]);
	}
	
	for(int i = 0; i <= W; ++i){
		a[0] = i * H;
		int n = H >> 1;
		a[1] = n * (W - i);
		a[2] = (H - n) * (W - i);
		
		std::sort(a, a + 3);
		
		
		ans = MIN(ans, a[2] - a[0]);
		
		a[0] = i * H;
		n = (W - i) >> 1;
		a[1] = n * H;
		a[2] = ((W - i) - n) * H;
		
		std::sort(a, a + 3);	
		
		ans = MIN(ans, a[2] - a[0]);
	}
	
	printf("%lld", ans);
	
return 0;	
}

void setIO(const char * in, const char * out){
	if(in != NULL)	freopen(in, "r", stdin);
	if(out != NULL)	freopen(out, "w", stdout);
}


Measured memory_bytes: 128
from math import factorial
def combination(n, r):
    return factorial(n)//(factorial(n-r) * factorial(r))

def answer(n,k):
    ans = 0
    if k>1:
        if n=='':
            return 0
        # 先頭が0の時
        if n[0]=='0':
            ans += answer(n[1:],k)
        else:
            # 先頭以外で3つ使う
            if len(n)>k:
                ans += combination(len(n)-1,k)*9**k
            # 先頭で一つ使うが、先頭はNの先頭より小さい
            if len(n)>k-1:
                ans += (int(n[0])-1)*combination(len(n)-1,k-1)*9**(k-1)
            # 先頭で、Nの先頭と同じ数を使う
            ans += answer(n[1:],k-1)
    else:
        if n=='':
            return 0
        if n[0]=='0':
            ans += answer(n[1:],k)
        else:
            if len(n)>1:
                ans += combination(len(n)-1,1)*9
            ans += int(n[0])
    return ans

n = input()
k = int(input())

print(answer(n,k) if len(n)>=k else 0)

Measured memory_bytes: 38384
#include <cassert>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
using namespace std;
typedef long long ll;

int nNode, nEdge;

struct E {
  int a, b;
  ll c;
};

E es[200000+10];
vector<E> g[100000+10];

ll dist[100000+10];
bool visited[100000+10];

int main(void) {
  int nNode, nEdge;
  scanf("%d%d", &nNode, &nEdge);
  REP(iEdge, nEdge) {
    int l, r, d;
    scanf("%d%d%d", &l, &r, &d);
    --l;
    --r;
    es[iEdge].a = r;
    es[iEdge].b = l;
    es[iEdge].c = -d;
    g[r].push_back(es[iEdge]);
    es[iEdge].a = l;
    es[iEdge].b = r;
    es[iEdge].c = d;
    g[l].push_back(es[iEdge]);
  }

  REP(s, nNode) {
    if(visited[s]) {
      continue;
    }
    queue<int> q;
    q.push(s);
    dist[s] = 0;
    visited[s] = true;
    while(!q.empty()) {
      int u = q.front(); q.pop();
      REP(i, g[u].size()) {
        const E& e = g[u][i];
        int v = e.b;
        if(!visited[v]) {
          q.push(v);
          dist[v] = dist[u] + e.c;
          visited[v] = true;
        }
      }
    }
  }
  bool ok = true;
  REP(iEdge, nEdge) {
    if(dist[es[iEdge].a] + es[iEdge].c != dist[es[iEdge].b]) {
      ok = false;
      break;
    }
  }
  puts(ok ? "Yes" : "No");
  
  return 0;
}


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

int main()
{
  int a, b;
  cin >> a >> b;
  if ((a==1 && b==2) || (b==1 && a==2)) cout << 3 << endl;
  else if ((a==2 && b==3) || (b==2 && a==3)) cout << 1 << endl;
  else cout << 2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
 int n,i,sum=0,max;
  
  scanf("%d",&n);
  
  int a[100]={0};
  for(i=0;i<n;i++){
    scanf("%d ",&a[i]);
  }
  max=a[0];
  for(i=0;i<n;i++){
  if(max<=a[i+1]){
   sum++;
    max=a[i+1];
  }
  }
  
  printf("%d",sum+1);
  
  return 0;
  }
 

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <map>
#include <utility>
#include <list>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

#define LL long long



int main() {
    string s;
    cin >> s;

    int y = atoi(s.substr(0, 4).c_str());
    int m = atoi(s.substr(5, 2).c_str());
    int d = atoi(s.substr(7, 2).c_str());

    if (y <= 2019 && m <= 4 && d <= 30) {
        cout << "Heisei" << endl;
    } else {
        cout << "TBD" << endl;
    }

    return 0;
}


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

#define Fast            ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define LL              long long
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define all(a)          a.begin(),a.end()
#define MEM(a,x)        memset(a,x,sizeof(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)

int main()
{
    int n;
    cin >> n;
    int A[n],B[n],C[n];
    REP(i,n) cin >> A[i] >> B[i] >> C[i];
    LL dp[n][3];
    for(int i=0;i<n;i++){
        if(i==0){
            dp[i][0]=A[i];
            dp[i][1]=B[i];
            dp[i][2]=C[i];
        }
        else{
            dp[i][0]=max(dp[i-1][1],dp[i-1][2])+A[i];
            dp[i][1]=max(dp[i-1][0],dp[i-1][2])+B[i];
            dp[i][2]=max(dp[i-1][1],dp[i-1][0])+C[i];
        }
    }
    cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 3712
#include <stdio.h>

int main(int argc, const char * argv[])
{
    int inputN, inputM, evenSum;
    scanf("%d %d",&inputN, &inputM);
    
    // Count numbers of choices for even pairs written on balls
    evenSum = inputN * (inputN - 1) / 2 + inputM * (inputM - 1) / 2;
    printf("%d \n", evenSum);
    
    return 0;
}


Measured memory_bytes: 128