akhauriyash/Code-Regression huggingface dataset:
/******************************************
* AUTHOR : RAJAGOPALAN *
* NICK : ARNO *
* INSTITUTION : VIT *
******************************************/
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
	if (!y)
		return x;
	return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m, a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

vector<string> split(char d,string s)
{
	stringstream ss(s);
	string t;
	vector<string> words;
	while(getline(ss,t,d))
	{
		words.pb(t);
	}

	return words;
}

int main(int argc, char *argv[])
{
#ifdef LOCAL
	auto start = chrono::high_resolution_clock::now();
#endif
	
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	double r;
	cin>>r;
	double circum=2*pi*r;
	cout<<circum;


#ifdef LOCAL
	auto end = chrono::high_resolution_clock::now();
	double time_taken =
		chrono::duration_cast<chrono::nanoseconds>(end - start).count();

	time_taken *= 1e-9;

	cerr << "\nTime taken by program is : " << fixed
		 << time_taken << setprecision(9);
	cerr << " sec" << endl;
#endif
	return 0;
}

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

#define max 5

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}
int int_sort( const void * a , const void * b ) {
  return strcmp(( char * )a , ( char * )b );
}

int main()
{
    int n, up, dow;
    char s[max];

    
    scanf("%d", &n);
    
    up=n/100;
    dow=n-up*100;
    
    if (up<=12&&up>=1&&dow<=12&&dow>=1) {
        printf("AMBIGUOUS");
    } else if (up<=12&&up>=1) {
        printf("MMYY");
    } else if (dow<=12&&dow>=1) {
        printf("YYMM");
    } else {
        printf("NA");
    }
    
    return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int main(){
	int n;
	cin>>n;
	set<string> s;
	string t;
	while(n--){
		cin>>t;
		s.insert(t);
	}
	cout<<s.size()<<endl;
	return 0;
}

Measured memory_bytes: 19180
#include <cmath>
#include <cstdint>
#include <iostream>

using namespace std;

int main() {
  int64_t A, B, N;
  cin >> A >> B >> N;
  
  int64_t minus = N % B;
  int64_t x = N - minus -1;
  if (x < 0) x = N;
  int64_t res = floor(A * x / B) - A * floor(x / B);
  
  cout << res << endl;
  
  return 0;
}


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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  string s; cin >> s;
  string t = s;
  reverse(t.begin(), t.end());
  
  for (int i = 0; i < (int) s.size(); ++i){
    if (s[i] == 'b'){
      if (t[i] == 'd') continue;
      else {
        cout << "No" << '\n'; return 0;
      }
    }
    else if (s[i] == 'd'){
      if (t[i] == 'b') continue;
      else {
        cout << "No" << '\n'; return 0;
      }    
    }
    else if (s[i] == 'p'){
      if (t[i] == 'q') continue;
      else {
        cout << "No" << '\n'; return 0;
      }    
    }
    else if (s[i] == 'q'){
      if (t[i] == 'p') continue;
      else {
        cout << "No" << '\n'; return 0;
      }    
    }
  }
  cout << "Yes" << '\n';
  
  return 0;
}

Measured memory_bytes: 512
// #pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma vector temporal
// #pragma simd
// #pragma GCC diagnostic ignored "-W"

#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<sstream>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<utility>
#include<functional>
#include<complex>
#include<climits>

// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vint vector<int>
#define SS stringstream
#define PQ priority_queue
#define MS(x,v) memset((x),(v),sizeof(x))
#define RZUNI(x) sort(x.begin(),x.end()), x.resize(unique(x.begin(),x.end())-x.begin())
#define FLH fflush(stdout)
#define CPPinput ios_base::sync_with_stdio(0); cin.tie(0)
#define FIN(fname) freopen(fname,"r",stdin)
#define FOUT(fname) freopen(fname,"w",stdout)

#define tm Ovuvuevuevue
#define y1 Enyetuenwuevue
#define left Ugbemugbem
#define ws Osas
#define dec tetteterette
#define exp expexpexpexp
#define expl explexplexpl

#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl

#ifdef WEAK
#include"/home/edison/Coding/cpp/template/debug.cpp"
#define DEB(...) printf(__VA_ARGS__),fflush(stdout)
#define WHR() printf("%s: Line %d",__PRETTY_FUNCTION__,__LINE__),fflush(stdout)
#define LOG(...) printf("%s: Line %d ",__PRETTY_FUNCTION__,__LINE__),printf(__VA_ARGS__),fflush(stdout)
#define DEBUG 1
#define exit(x) cout<<"exit code "<<x<<endl, exit(0)
#else
#define PDE(...) ;
#define DEB(...) ;
#define WHR() ;
#define LOG(...) ;
#define DEBUG 0
#endif

#define lowbit(x) ((x)&(-(x)))

#if __cplusplus >= 201103L
#include<unordered_map>
#include<unordered_set>
#include<tuple>
#endif

void JIZZ(string output=""){cout<<output; exit(0);}

const ld PI=3.14159265358979323846264338327950288;
const ld eps=1e-13;
const ll mod=1e9+7;

int main(){
    CPPinput;
    string s,t; cin>>s>>t;
    int cnt=1000;
    while(s!=t && cnt--){
        s=s.substr(1,s.size())+s.substr(0,1);
    }
    if(s==t)Yes;
    else No;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

template<typename T> int least_bit(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return __builtin_ffs(n) - 1;
  if (sizeof(T) == 8) return __builtin_ffsll(n) - 1;
}

// n must be greater than 0.
template<typename T> int least_bit_fast(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return __builtin_ctz(n);
  if (sizeof(T) == 8) return __builtin_ctzll(n);
}

template<typename T> int most_bit(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return n ? 31 - __builtin_clz(n) : -1;
  if (sizeof(T) == 8) return n ? 63 - __builtin_clzll(n) : -1;
}

template<typename T> int count_bit(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return __builtin_popcount(n);
  if (sizeof(T) == 8) return __builtin_popcountll(n);
}

int main() {
  int64_t x, y;
  cin >> x >> y;
  cout << most_bit(y / x) + 1 << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
 
int main() {
  vector<char> s(4);
  rep(i,4) cin >> s.at(i);
  sort(s.begin(), s.end());
  char a = s.at(0);
  char b = s.at(1);
  char c = s.at(2);
  char d = s.at(3);
  if(a == b && c == d && b != c){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int m, d;
  cin >> m >> d;
  
  int ans = 0;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= d; j++)
      if (i == (j / 10 >= 2 ? j / 10 : 1000) * (j % 10 >= 2 ? j % 10 : 1000)) ans++;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	t = zeros(Int,n)
	for i in 1:n
		t[i] = readline() |> parseInt
	end
	println(lcm(t))
end

main()

Measured memory_bytes: 111688
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb push_back
#define mkp make_pair
#define p_q priority_queue
#define INF 200000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  string S; cin >> S;
  int r = 0, l = 0, rpos;
  int ans[100000] = {};

  REP(i, S.size()){
    if(S[i] == 'R'){
      l = 0;
      r++;
      rpos = i;
      if(S[i+1] == 'L'){
        ans[i] += (r+1)/2;
        ans[i+1] += r/2;
      }
    } else {
      r = 0;
      l++;
      if(l % 2 == 0) ans[rpos]++;
      else ans[rpos+1]++;
    }
  }

  REP(i, S.size()){
    cout << ans[i] << ' ';
  }
  cout << endl;
}

Measured memory_bytes: 1488
#include <iostream>
using namespace std;
int main(){
	int n;
	int c = 0;
	int k = 0;
	bool ra[8]={0};
	cin >> n;
	for(int i=0;i<n;i++){
		int s;
		cin >> s;
		int r = s/400;
		if(r >= 8){
			k++;
		}else{
			if(!ra[r]){
				ra[r] = true;
				c++;
			}
		}
	}
	cout << max(1,c) << ' ' << c+k;
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> ii;

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

    for (int i = 0; i <= 50000; i++) {
        int x = i * 108 / 100;
        if (x == n) {
            printf("%d\n", i);
            return 0;
        }
    }

    printf(":(\n");

    return 0;
}


Measured memory_bytes: 256
'use strict';
process.stdin.on('data', function(chunk) {
    var inputs = chunk.toString().trim().split('\n');
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i] === '0') {
            break;
        }
        console.log('Case ' + (i + 1) + ': ' + inputs[i]);
    }
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 20872
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

constexpr int64 MOD = 1000000007;

int N;
int64 arr[303030];

int main() {
    cin >> N;
    for (int j = 0; j < 3*N; ++j) {
        cin >> arr[j];
    }
    sort(arr, arr+3*N);

    int64 ans = 0;
    for (int j = 0; j < N; ++j) {
        ans += arr[3*N-2-2*j];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[100005],b[100005];
priority_queue<ll>que;
ll sum_minus,sum_plus;
int ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++) scanf("%lld",&b[i]);
	for(int i=1;i<=n;i++){
		if(a[i] < b[i]){
			sum_minus += b[i]-a[i];
			ans++;
		}
		else if(a[i] > b[i]){
			sum_plus += a[i]-b[i];
			que.push(a[i]-b[i]);
		}
	}
	if(sum_minus > sum_plus){
		//can not construct C_i
		puts("-1");
		return 0;
	}
	if(sum_minus == 0){
		//already OK
		puts("0");
		return 0;
	}
	while(!que.empty()){
		ll x = que.top(); que.pop();
		sum_minus -= x;
		ans++;
		if(sum_minus <= 0){
			printf("%d\n",ans);
			return 0;
		}
	}
	assert(0);
}

Measured memory_bytes: 2428
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int main()
{
    long long n,flag=0; cin>>n;
    long long d1[1000];
    long long d2[1000];
    for(long long i=0;i<n;i++)
    {
        cin>>d1[i]>>d2[i];
    }
    for(long long i=0;i<n-2;i++)
    {
        if(d1[i]==d2[i] && d1[i+1]==d2[i+1] && d1[i+2]==d2[i+2])
        {
            flag=1; break;
        }
    }
    if(flag==1)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

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

using namespace std;
int main(){
    int a[5];
    int ans=0;
    int mins = 100;
    for(int i=0;i<5;i++){
        int in;
        cin>>in;
        a[i]=in;
        if(in%10>0){
            ans+=in/10*10+10;
            mins = min(mins,in%10);
        } else{
            ans+=in/10*10;
        }
        
    }
    if(mins==100){
        cout<<ans<<endl;
    }else{
    cout<<ans-(10-mins)<<endl;
    }
}

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

bool judge(int X){
  int Y = X;
  int count = 0;
  while(X > 0){
    count += X % 10;
    X -= X % 10;
    X /= 10;
  }
  if(Y % count == 0) {
    return true;
  }else{
    return false;
  }
}

int main(){
  int X;
  cin >> X;
  if(judge(X)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,i,d =0;
    cin>>a>>b;
    if(a>b)
    {
        for(i = b; i<a; i++)
        {
            if(abs(a-i) == abs(b-i))
                d = i;
        }

    }
    else
    {
        for(i = a; i<b; i++)
        {
            if(abs(a-i) == abs(b-i))
                d = i;
        }

    }
    if(d == 0)
    {
        cout<< "IMPOSSIBLE"<<endl;
    }
    else
        cout<< d<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

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

    int A,B,C,K; cin >> A >> B >> C >> K;
    if(K<A) cout << K << endl;
    else if(K<=A+B) cout << A << endl;
    else cout << A-(K-A-B) << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int MOD=998244353;
int n,cnt;
int lzy[2000004];
int dat[2000004],L[2000004],R[2000004];
int q,pow0[200004],sp[200004];
int built(int l,int r){
	int id=++cnt;
	if(l<r)L[id]=built(l,(l+r)/2),R[id]=built((l+r)/2+1,r);
	return id;
}
void push(int id,int x,int len){
	lzy[id]=x;
	dat[id]=1ll*x*sp[len]%MOD;
}
void upd(int l,int r,int id,int a,int b,int x){
	if(r<a||b<l)return;
	if(a<=l&&r<=b){
		push(id,x,r-l);
		return;
	}
	if(lzy[id]>0)push(L[id],lzy[id],(l+r)/2-l),push(R[id],lzy[id],r-(l+r)/2-1),lzy[id]=0;
	upd(l,(l+r)/2,L[id],a,b,x),upd((l+r)/2+1,r,R[id],a,b,x);
	dat[id]=(1ll*dat[L[id]]*pow0[r-(l+r)/2]%MOD+dat[R[id]])%MOD;
}
int main(){
	pow0[0]=1,sp[0]=1;
	for(int i=1;i<200004;i++)pow0[i]=1ll*pow0[i-1]*10%MOD,sp[i]=(sp[i-1]+pow0[i])%MOD;
	cin>>n>>q;
	built(1,n);
	upd(1,n,1,1,n,1);
	while(q--){
		int l,r,d;cin>>l>>r>>d;
		upd(1,n,1,l,r,d);
		cout<<dat[1]<<"\n";
	}
}

Measured memory_bytes: 11468
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b;cin >> n >> a >> b;
    if(abs(a-b)%2==0){
        cout << abs(a-b)/2 << endl;
    }
    else{
        cout << min(a+(b-a)/2,n-b+1+(n-(a+n-b))/2) << endl;
    }
}

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

int main(void){
    double x1,x2,y1,y2;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    double d = pow(x1 - x2, 2) + pow(y1 - y2, 2);
    d = sqrt(d);
    
    cout << fixed << setprecision(8) << d;
    cout << endl;
    
}



Measured memory_bytes: 3288
H, W = map(int, input().split())
grid = [list(map(int, input().split())) for _ in range(H)]
N = 0
A = []
for h in range(H):
  if h % 2 == 0:
    for w in range(W):
      if grid[h][w] % 2:
        if w != W-1:
          grid[h][w] -= 1
          grid[h][w+1] += 1
          A.append([h+1, w+1, h+1, w+2])
          N += 1
        else:
          if h == H-1:
            continue
          grid[h][w] -= 1
          grid[h+1][w] += 1
          A.append([h+1, w+1, h+2, w+1])
          N += 1
          
  else:
    for w in range(W-1, -1, -1):
      if grid[h][w] % 2:
        if w != 0:
          grid[h][w] -= 1
          grid[h][w-1] += 1
          A.append([h+1, w+1, h+1, w])
          N += 1
        else:
          if h == H-1:
            continue
          grid[h][w] -= 1
          grid[h+1][w] += 1
          A.append([h+1, w+1, h+2, w+1])
          N += 1
print(N)
for a in A:
  print(" ".join(map(str, a)))

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

using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n+1,0);
    for(int i=1;i<=n;i++) cin >> a[i];
    vector<bool> vis(n+1,0);
    vis[1]=1;
    vector<int> v={1};
    while(vis[a[v.back()]]==0)
    {
        v.push_back(a[v.back()]);
        vis[v.back()]=1;
    }
    if(k<(int)v.size()) cout << v[k] << endl;
    else
    {
        int pos=0;
        for(int i=0;;i++)
        {
            if(v[i]==a[v.back()])
            {
                pos=i;
                break;
            }
        }
        ll x=v.size()-pos;
        cout << v[pos+((k-pos)%x)] << endl;
    }
    return 0;
}


Measured memory_bytes: 5100
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
using namespace std;
using ll=long long;
#define MOD  1000000007

int main(int argc, char const *argv[]) {
  string s,t,u;
  std::cin >> s >> t >> u;
  std::cout << s[0] << t[0] << u[0] << '\n';
  return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  s=S()
  a=s[:2]
  b=s[2:]
  if a=='00' and int(b)>12:
    print('NA')
  elif int(a)>12 and b=='00':
    print('NA')
  elif a=='00' and b=='00':
    print('NA')
  elif a=='00' and int(b)<=12:
    print('YYMM')
  elif int(a)<=12 and b=='00':
    print('MMYY')
  elif int(a)>12 and int(b)>12:
    print('NA')
  elif int(a)<=12 and int(b)>12:
    print('MMYY')
  elif int(a)>12 and int(b)<=12:
    print('YYMM')
  else:
    print('AMBIGUOUS')

main()
# print(main())


Measured memory_bytes: 7704
#include <iostream>

using namespace std;

void printArr(int a[], int len) {


	for (int i = 0; i < len; i++)
	{
		if (i == 0) cout << a[0];
		else cout << " " << a[i];
	}
	cout << endl;
}

//5 2 4 6 1 3

void insertionSort(int a[], int len) {
	printArr(a, len);
	for (int i = 1; i < len; i++)
	{
		int key = a[i];
		int j = i - 1;
		while (a[j] > key && j >= 0) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = key;
		printArr(a, len);
	}
}




int main() {

	int n;
	cin >> n;

	int arr[100] = { 0 };

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

	insertionSort(arr, n);
//	printArr(arr, n);


	return 0;
}



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

//#define N 244140625 // 5^12
//#define N 48828125 // 5^11
#define N 16777216 // 4^12
#define TRUE 1
#define FALSE 0

char H[N];

void init(){
  int i;
  for(i=0; i<N; i++){
    H[i] = FALSE;
  }
}

int getNum(char c){
  switch (c) {
    case 'A': return 1;
    case 'C': return 2;
    case 'G': return 3;
    case 'T': return 4;
  }
  return 0;
}

// convert character string to Quintuple
int convertCtoI(char *str){
  long long i, sum=0, p=1;
  for(i=0; i<strlen(str); i++){
    sum += p * getNum(str[i]);
    p *= 5;
  }
  return sum;
}

void insert(char *str){
  H[convertCtoI(str)]= TRUE;
}

int find(char *str){
  if(H[convertCtoI(str)])  return 1;
  else return 0;
}

int main(){
  int i,n;
  char str[13], command[7];

  init();

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%s %s",command, str);
    if(!strcmp(command, "insert")){
      insert(str);
    }
    else if(!strcmp(command, "find")){
      if(find(str)){
        printf("yes\n");
      }
      else printf("no\n");
    }
  }

  return 0;
}



Measured memory_bytes: 18108
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
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; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int dp[101][101][101];

struct P {
  int a,e,r;
  void in() {
    cin >> a >> e >> r;
  }
  bool operator<(const P &rhs) const {
    return r < rhs.r;
  }
} p[100];

int main() {
  int d,n;
  while(cin>>d>>n,d||n) {
    REP(i,n) {
      p[i].in();
    }
    sort(p,p+n);
    memset(dp,0x3f,sizeof(dp));
    dp[0][0][0] = 0;
    REP(i,n) {
      for (int j=0; j <= 100; ++j) {
        REP(k,d+1) {
          chmin(dp[i+1][j][k], dp[i][j][k]);
          if (j>=p[i].r) {
            chmin(dp[i+1][min(100,j+p[i].e)][min(d,k+p[i].a)], dp[i+1][j][k] + 1);
            // REP(l,100) {
            //   chmin(dp[i+1][min(100,j+p[i].e*l)][min(d,k+p[i].a*l)], dp[i][j][k] + l);
            // }
          }
        }
      }
    }
    int ans = INF;
    REP(i,101) chmin(ans, dp[n][i][d]);
    if (ans == INF) puts("NA");
    else cout << ans << endl;
  }
}

Measured memory_bytes: 5216
n=int(input())

def div(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

ans=0
for i in range(1,n+1,2):
    if len(div(i)) == 8:
        ans+=1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<double> p(n);
  rep(i, n) cin >> p[i];
  vector<vector<double>> dp(n+1, vector<double>(n+1));
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    rep(j, n+1) {
      dp[i][j] = dp[i-1][j]*(1-p[i-1]);
      if (j)
        dp[i][j] += dp[i-1][j-1]*p[i-1];
    }
  }
  double ans = 0;
  for (int i = (n+1)/2; i <= n; i++)
    ans += dp[n][i];
  cout << fixed << setprecision(9) << ans << endl;
  return 0;
}

Measured memory_bytes: 70784
N,C,K = map(int,input().split())
T = sorted(int(input()) for _ in [0]*N)
ans = 0
b = []
for t in T:
    if b and (len(b)==C or b[0]<t-K) :
        ans += 1
        b = []
    b.append(t)
if b:ans += 1
print(ans)

Measured memory_bytes: 7852
//cara pikir 
//pake recursive tapi gak 3 x
// C++ program for implementation of Ford Fulkerson algorithm 
#include <iostream> 
#include <limits.h> 
#include <string.h> 
#include <queue> 
#include <iostream> 
#include <set> 
#include <iterator> 
#include <algorithm>

using namespace std; 

int main(){
vector<int>ans{-1,-1,-1};
int num,total;
cin>>num>>total;
for (int i=0;i<num+1;i++){
  for(int j=0;j<num+1;j++){
    int z=num-i-j;
    if(z<0)
    continue;
    if(10000*i+5000*j+1000*z==total)
    {ans={i,j,z};
    cout<<ans[0]<< " " <<ans[1]<<" " <<ans[2];
    return 0;


    }
  }
}

cout<<ans[0]<< " " <<ans[1]<<" " <<ans[2];
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> pl;
const ll INF=100000000000000001;
const double PI=3.141592653589;


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

  int c=0;
  for(int i=1;i<n-1;i++){
    if((p[i-1]<p[i]&&p[i]<p[i+1])||(p[i-1]>p[i]&&p[i]>p[i+1]))
    c++;
  }
  cout<<c<<endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
long long s3,s2,s1,ans,x,e,h,w,a,b;
int main(){	
	cin>>h>>w;
	if(h%3==0||w%3==0) {cout<<0;return 0;}
	ans=h*w;
	for(int i=h/3;i<=h/2;i++)
	{   
	    b=h;
	    a=w;
		s1=i*w;
        b-=i;
        a/=2;
	    s2=a*b;
	    s3=h*w-s1-s2;
	    e=min(min(s2,s3),s1);
	    x=max(max(s2,s3),s1);
	    ans=min(x-e,ans);                                                
    	a=w;
	    b/=2;
	    s2=a*b;
	    s3=h*w-s1-s2;
	    e=min(min(s2,s3),s1);
		x=max(max(s2,s3),s1);
	    ans=min(ans,x-e);
	}
	for(int i=w/3;i<=w/2;i++)
	{
	    a=w;
	    b=h;
		s1=i*h;
		a-=i;
		b/=2;
	    s2=a*b;
	    s3=h*w-s1-s2;
	    e=min(min(s2,s3),s1);
	    x=max(max(s2,s3),s1);
	    ans=min(x-e,ans);
	    b=h;
	    a/=2;
	    s2=a*b;
	    s3=h*w-s1-s2;
	    e=min(min(s2,s3),s1);
	    x=max(max(s2,s3),s1);
	    ans=min(ans,x-e);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

trait ToU8 {
    fn to_u8(&self) -> Option<u8>;
}

impl ToU8 for char {
    fn to_u8(&self) -> Option<u8> {
        let num = (*self) as u8 - b'0';
        if num > 9u8 {
            None
        } else {
            Some(num)
        }
    }
}

const MOD: usize = 1_000_000_007;

fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();

    let mut dp = vec![vec![0; 13]; 100_001];

    dp[0][0] = 1;

    for (i, &c) in s.iter().enumerate() {
        
        for j in 0..10 {
            if let Some(c) = c.to_u8() {
                if c as usize != j {
                    continue;
                }
            }
            for ki in 0..13 {
                dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki];
            }
        }

        for j in 0..13 {
            dp[i+1][j] %= MOD;
        }
    }

    let res = dp[s.len()][5];
    println!("{:?}", res);
}


Measured memory_bytes: 18812
<?php
fscanf(STDIN, '%d %d %d %d %d', $a, $b, $c, $x, $y);

$avgab = ($a + $b) / 2;
$lab = max($a, $b);
$sab = min($a, $b);
$sxy = min($x, $y);
$remxy = max($x, $y) - $sxy;

if ($x > $y) {
    $remab = $a;
} else {
    $remab = $b;
}

$sum = 0;
if ($avgab >= $c) {
    $sum += $c * $sxy * 2;
} else {
    $sum += $a * $sxy;
    $sum += $b * $sxy;
}

if ($remab > $c * 2) {
    $sum += $c * $remxy * 2;
} else {
    $sum += $remab * $remxy;
}

echo $sum . PHP_EOL;

Measured memory_bytes: 4604
N, A, B = map(int, input().split())
S = input()
cnt_all, cnt_b = 0, 0
for i in range(N):
	if S[i] == "a":
		if cnt_all < A + B:
			print("Yes")
			cnt_all += 1
		else:
			print("No")
	elif S[i] == "b":
		if cnt_all < A + B and cnt_b < B:
			print("Yes")
			cnt_all += 1
			cnt_b += 1
		else:
			print("No")
	else:
		print("No")


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

int main(void){
  int A[5][4][11],n;

  for(int i=1;i<=4;i++)
    for(int j=1;j<=3;j++)
      for(int k=1;k<=10;k++)A[i][j][k]=0;

  cin>>n;
  for(int i=0;i<n;i++){
    int b,f,r,v;
    cin>>b>>f>>r>>v;
    A[b][f][r]+=v;
  }

  for(int i=1;i<=4;i++){
    if(1<i)cout<<"####################\n";
      for(int k=1;k<=3;k++){
        for(int j=1;j<=10;j++){
          cout<<" "<<A[i][k][j];
        }
        cout<<endl;
      }
  }
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
 
using namespace std;
 
 
#define mod(cans) cans%10**9+7
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define cin_pl(n,x) rep(i,n){cin>>x[i];}
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define prians(Answer) cout<<Answer<<"\n"
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > matrix;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef greater<int> gi;
typedef vector<unsigned> vu;


ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
bool is_prime(const unsigned n){
    switch(n){
        case 0:
        case 1: return false;
        case 2: return true;
    }
 
 
    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }
 
    return true;
}

int main()
{
    int n,k;cin>>n>>k;
    n%k==0?cout<<0:cout<<1;

}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;

void solve() {
  int N;
  cin >> N;
  vi A(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int m = 0;
  for (int j = 0; j < N; j++) {
    int k = j % N;
    if (j % 2 == 0) {
      m += A[k];
    } else {
      m -= A[k];
    }
  }
  cout << m << ' ';
  for (int i = 1; i < N; i++) {
    m = 2 * A[i - 1] - m;
    cout << m << ' ';
  }
  cout << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);

  solve();

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iomanip>
#define faster       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define f(i,a,b) for(ll i=a;i<b;i++)
#define r(i,a,b) for(ll i=a;i>b;i--)
using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1000000000000000000;

int main(){
  ll n; cin>>n;

  bool tr=false;
      ll ans=1;

  f(i,0,n){

    ll a; cin>>a;
    if(a==0){
      cout << 0 << endl;
      return 0;
    }
      
      if(tr || (INF/ans<a)){
        tr=true;
      }

      ans*=a;
    
  }

if(tr){
  cout << -1  << endl;
}else{
  cout << ans << endl;
}

return 0;

}


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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

ll ans;
string s;
ll n;
ll num[256];

int main(){
	ios::sync_with_stdio(0);
	cin >> s;
	n = sz(s);
	rep(i,0,(int)n){
		++num[s[i]];
	}
	ans = 1;
	rep(i,0,256)
		rep(j,i+1,256)
			ans += num[i]*num[j];
	cout << ans << endl;
}

Measured memory_bytes: 720
import java.util.Map;
import java.util.HashMap;
import java.util.Objects;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = Long.parseLong(sc.nextLine());
        sc.close();
        long res = 0;
        Map<Map<Long, Long>, Long> pairMap = new HashMap<>();

        for (long i = 1; i <= N; i++) {
            Map<Long, Long> map = getFandLPair(i);
            Long count = pairMap.get(map);
            if (Objects.isNull(count)) {
                pairMap.put(map, 1L);
            } else {
                count++;
                pairMap.put(map, count);

            }
        }

        for (long i = 1; i <= N; i++) {
            Map<Long, Long> pMap = getFandLPair(i);
            Long key = pMap.keySet().iterator().next();
            Map<Long, Long> gMap = new HashMap<Long, Long>();
            gMap.put(pMap.get(key), key);
            Long count = pairMap.get(gMap);
            if (Objects.isNull(count)) {
                continue;
            }
            res += count;
        }

        System.out.println(res);
    }

    public static Map<Long, Long> getFandLPair(Long x) {
        Map<Long, Long> ret = new HashMap<>();
        String Z = x.toString();
        Long a = Long.parseLong(String.valueOf(Z.charAt(0)));
        Long b = Long.parseLong(String.valueOf(Z.charAt(Z.length() - 1)));
        ret.put(a, b);
        return ret;
    }

}

Measured memory_bytes: 127176
program ABC173B
    implicit none
    integer(8)::N,C(4),i
    character(3)::S
    read*,N
    C=0
    do i=1,N
        read*,S
        if(len_trim(S)==2)then
            if(S(1:2)=="AC")C(1)=C(1)+1
            if(S(1:2)=="WA")C(2)=C(2)+1
            if(S(1:2)=="RE")C(4)=C(4)+1
        else
            C(3)=C(3)+1
        end if
    end do
    print'(A,i0)',"AC x ",C(1)
    print'(A,i0)',"WA x ",C(2)
    print'(A,i0)',"TLE x ",C(3)
    print'(A,i0)',"RE x ",C(4)
end program ABC173B

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define UB upper_bound
#define LB lower_bound
#define PB push_back
#define mp make_pair
#define F first
#define S second
#define be(a) (a).begin(),(a).end()
#define deb(x) cout<< #x <<" "<<endl;
#define deb2(x, y) cout<< #x <<" "<< x <<endl<< #y <<" "<<y<<endl
#define fo(i, n) for(long long i=0; i<n; i++)
#define Fo(i, n, k) for(long long i=k; i<n; i++)
#define mod 1000000007
#define int long long

typedef long long ll;

void fileIO()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
 
typedef vector<pair<int, int>> vll;
typedef unordered_map<int, int> ump;



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

int val = 0;

vector<vector<int>> dp(3001, vector<int>(3001, val));

// int optimal(vector<int> a, int i, int j)
// {
//     int &ans = dp[i][j];
//     if(ans != val) return ans;
//     if(i==j) ans = a[i];
//     else if(i+1 == j) ans = max(a[i], a[j]);
//     else
//     {
//         ans =  max(a[i] + min(optimal(a, i+2, j), optimal(a, i+1, j-1)), 
//                    a[j] + min(optimal(a, i+1, j-1), optimal(a, i, j-2)));
//     }

//     return ans;  

// }



int32_t main()
{
    IOS;
    fileIO();
    int T;
    T = 1;
    //cin>>T;

    while(T--)
    {
        int n;
        cin>>n;
        vector<int> a(n);
        int sum = 0;
        for(int i = 0; i<n; i++)
        {
            cin>>a[i];
            sum += a[i];
        }

        for(int i = 0; i<n; i++) dp[i][i] = a[i];
        for(int i = 0; i<n-1; i++) dp[i][i+1] = max(a[i], a[i+1]);

        for(int gap = 2; gap<n; gap++)
        {
            for(int i = 0; i+gap<n; i++)
            {
                int j = i+gap;
                dp[i][j] = max(a[i] + min(dp[i+2][j], dp[i+1][j-1]), a[j] + min(dp[i+1][j-1], dp[i][j-2]));
            }
        }


        int X = dp[0][n-1];
        int Y = sum - X;

        cout<<X-Y<<"\n";


    }
    
    return 0;
}



Measured memory_bytes: 74044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

ll myCeil(ll a, ll b){

	if(a%b==0) return a/b;
	else return a/b + 1;
}

int mainsolve(){

	ll n,k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];

	auto isOK = [&](ll x){
		ll cnt = 0;
		rep(i,n){
			ll tmp = myCeil(a[i], x) - 1;
			assert(tmp >= 0);
			cnt += tmp;
		}
		return cnt <= k;
	};

	auto bs = [&](){
		ll ng = 0;
		ll ok = 1e9+1;
		ll mid = (ng+ok)/2;

		while(abs(ng-ok) > 1){
			if(isOK(mid)) ok = mid;
			else ng = mid;
			mid = (ng+ok)/2;
		}
		
		return ok;
	};


	cout << bs() << endl;
	
	return 0;
}

int main(){

	return mainsolve();
}

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

using namespace std;

int n, m, s, t, dis[100005][3];
queue< pair<int, int> > q;
vector<int> edge[100005];

int main(void)
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        edge[u].push_back(v);
    }
    scanf("%d%d", &s, &t);
    for (int i = 1; i <= n; ++i)
        for (int j = 0; j <= 2; ++j)
            dis[i][j] = 0x3f3f3f3f;
    dis[s][0] = 0;
    q.push(make_pair(s, 0));
    while (!q.empty()) {
        int x = q.front().first, y = q.front().second;
        q.pop();
        for (int i = 0, _i = edge[x].size(); i < _i; ++i) {
            if (dis[edge[x][i]][(y + 1) % 3] > dis[x][y] + 1) {
                dis[edge[x][i]][(y + 1) % 3] = dis[x][y] + 1;
                q.push(make_pair(edge[x][i], (y + 1) % 3));
            }
        }
    }
    if (dis[t][0] == 0x3f3f3f3f) printf("-1\n");
    else printf("%d\n", dis[t][0] / 3);
    return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef deque<int> DI;
typedef deque<LL> DLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(k);
	string s; cin >> s;
	if(s.length() <= k)	cout << s << endl;
	else	cout << s.substr(0, k) << "..." << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include<vector>
using namespace std;
int main(void){
    int N;
    long long L;
    int Q;
    cin >>N>>L>> Q;
    vector<int> vec(N,L-Q);
    int A;
    for(int i = 0;i < Q;i++){
        cin >> A;
        
        vec[A-1]+=1;
        
        
    }
    
    for(int i = 0;i < vec.size();i++){
        if(vec[i]>0)cout <<"Yes"<<endl;
        else cout <<"No"<<endl;
        
    }
    
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
	#define endl "\n"
	#define ll long long int
	#define vi vector<ll>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<ll,ll>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y) 
	#define mem(a,val) memset(a,val,sizeof(a))
	#define pb push_back
	#define f first
	#define s second
	
	using namespace std;
	
	signed main()
	{

	std::ios::sync_with_stdio(false);
	
	#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
     #endif

	int k; cin>>k;
	string s;
	cin>>s;
	int p = s.length();
	if(p<=k){
		cout<<s;
	}
	else{
		for (int i = 0; i < k; ++i)
		{
			/* code */
			cout<<s[i];
		}
		cout<<"...";
	}
	return 0;
	}


Measured memory_bytes: 3652
Ans = 0

while True:
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    if op == "+":
        Ans = a + b
        print(Ans)
    elif op == "-":
        Ans = a - b
        print(Ans)
    elif op == "*":
        Ans = a*b
        print(Ans)
    elif op == "/":
        Ans = a//b
        print(Ans)
    else: break


Measured memory_bytes: 5592
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] h = new int[n+1];
		int[] ma = new int[n+1];
		int count = 0;
		
		for(int i=1;i<=n;i++) {
			h[i] = scan.nextInt();
			ma[i] = 0;
		}
		
		for(int i=0;i<m;i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();
			ma[a] = Math.max(ma[a], h[b]);
			ma[b] = Math.max(ma[b], h[a]);
		}
		
		for(int i=1;i<=n;i++) {
			if(h[i]>ma[i]) {
				count++;
			}
		}
		System.out.println(count);

	}

}

Measured memory_bytes: 58876