akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int a, b, c;

signed main() {
	cin >> a >> b >> c;
	if (a+b==c || b+c==a || c+a==b) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<string>

using namespace std;

	int dp[3009][3009];
	pair < int , int > cf[3009][3009];

int main(){

	string s,t; cin >> s >> t;
	
	s = "?" + s; t = "?" + t;
	for(int i = 1; i < s.size(); i++){
		
		for(int j = 1; j < t.size(); j++){
			
			if(dp[i-1][j] > dp[i][j]){
				dp[i][j] = dp[i-1][j];
				cf[i][j] = make_pair(i-1,j);
			}
			if(dp[i-1][j-1] > dp[i][j]){
				dp[i][j] = dp[i-1][j-1];
				cf[i][j] = make_pair(i-1,j-1);
			}
			if(dp[i][j-1] > dp[i][j]){
				dp[i][j] = dp[i][j-1];
				cf[i][j] = make_pair(i,j-1);
			}
			if(s[i] == t[j] && dp[i-1][j-1] + 1 > dp[i][j]){
				dp[i][j] = dp[i-1][j-1] + 1;
				cf[i][j] = make_pair(i-1,j-1);
			}
			
		}
		
	} //cout << dp[s.size()-1][t.size()-1];

	string sol = "";
	
	pair < int , int > koor = make_pair(s.size()-1,t.size()-1);
	while(koor.first > 0 && koor.second > 0){
		
		if(dp[koor.first][koor.second] > dp[cf[koor.first][koor.second].first][cf[koor.first][koor.second].second]) sol = s[koor.first] + sol;
		koor = cf[koor.first][koor.second];
		
	} cout << sol;

	return 0;
}

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

char b;

int main(){
  std::cin >> b;
  if(b == 'A'){
    cout << 'T';
  }else if(b == 'T'){
    cout << 'A';
  }else if(b == 'C'){
    cout << 'G';
  }else{
    cout << 'C';
  }

  return 0;
}


Measured memory_bytes: 256
#include<cmath>
#include<bits/stdc++.h>
#define MAX(a,b) (a>b? a:b)
#define MIN(a,b) (a>b? b:a)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repr(i,n) for(lint i=(lint)(n);i>0;--i)
#define reps(i,a,b) for(lint i=a;i<=(lint)(b);i++)
typedef long long lint;
typedef long double ld;
using namespace std;
const ld PI = acos(-1.0);

struct data {
    lint A;
    lint B;
    bool operator<( const data& right ) const {
        return A == right.A ? B < right.B : A < right.A;
    }
};

int main(){
    int N, M;
    cin >> N >> M;
    vector<data> shop(N);
    rep(i,N) cin >> shop[i].A >> shop[i].B;
    sort(shop.begin(),shop.end());
    lint sum = 0;
    rep(i,N) {
        if(M>=shop[i].B) {
            M -= shop[i].B;
            sum += shop[i].A*shop[i].B;
        }
        else {
            sum += shop[i].A*M;
            M = 0;
            break;
        }
    }
    cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1792
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var n=Arr[0]-0;
var x=Arr[1].split(" ").map(Number);
var y=Arr[2].split(" ").map(Number);
var sum1=0;
var sum2=0;
var sum3=0;
var max=0;
for(var i=0;i<n;i++){
   var a=Math.abs(x[i]-y[i]);
   sum1+=a;
   sum2+=Math.pow(a,2);
   sum3+=Math.pow(a,3);
   max=Math.max(max,a);
}
console.log(sum1.toFixed(6));
console.log(Math.sqrt(sum2).toFixed(6));
console.log(Math.pow(sum3,1/3).toFixed(6));
console.log(max.toFixed(6));

Measured memory_bytes: 8508
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> cnt(4);
    for(int i=0; i<n; i++){
        string s; cin >> s;
        if(s == "AC") cnt[0]++;
        else if(s == "WA") cnt[1]++;
        else if(s == "TLE") cnt[2]++;
        else cnt[3]++;
    }
    cout << "AC x " << cnt[0] << endl;
    cout << "WA x " << cnt[1] << endl;
    cout << "TLE x " << cnt[2] << endl;
    cout << "RE x " << cnt[3] << endl;
    return 0;
}

Measured memory_bytes: 3652
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	d := 998244353
	n := intScanner()
	m := intScanner()
	k := intScanner()
	cs := make([]int, n)
	cs[0] = m
	for i := 1; i < n; i++ {
		cs[i] = cs[i-1] * (m - 1) % d
	}
	ans := 0
	fact := make([]int, n+1)
	fact[0] = 1
	inv := make([]int, n+1)
	inv[0] = modinv(1, d)
	for i := 1; i < n+1; i++ {
		fact[i] = fact[i-1] * i % d
		inv[i] = modinv(fact[i], d)
	}
	for i := n - 1 - k; i < n; i++ {
		ans += cs[i] * (fact[n-1] * inv[n-1-i] % d * inv[i] % d) % d
		ans %= d
	}
	fmt.Println(ans)
}
func modinv(a, m int) int {
	b, u, v := m, 1, 0
	for {
		t := a / b
		a -= t * b
		u -= t * v
		a, b, u, v = b, a, v, u
		if b == 0 {
			break
		}
	}
	u %= m
	if u < 0 {
		u += m
	}
	return u
}


Measured memory_bytes: 6656
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> table(H, vector<char>(W));

    for (int i = 0; i < H; i++) {
        string line;
        cin >> line;
        for (int j = 0; j < W; j++) {
            table[i][j] = line[j];
        }
    }

    vector<set<P>> row_ranges(H);
    vector<set<P>> col_ranges(W);

    for (int i = 0; i < H; i++) {
        bool valid = false;
        int start;

        for (int j = 0; j < W; j++) {
            if (table[i][j] == '#') {
                if (valid) {
                    row_ranges[i].insert(P(j - 1, start));
                }
                valid = false;
            } else {
                if (!valid) {
                    valid = true;
                    start = j;
                }
            }
        }

        if (valid) row_ranges[i].insert(P(W - 1, start));
    }

    for (int j = 0; j < W; j++) {
        bool valid = false;
        int start;

        for (int i = 0; i < H; i++) {
            if (table[i][j] == '#') {
                if (valid) {
                    col_ranges[j].insert(P(i - 1, start));
                }
                valid = false;
            } else {
                if (!valid) {
                    valid = true;
                    start = i;
                }
            }
        }

        if (valid) col_ranges[j].insert(P(H - 1, start));
    }

    int ret = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (table[i][j] == '#') continue;
            auto p1 = row_ranges[i].lower_bound({j, -INF});
            auto p2 = col_ranges[j].lower_bound({i, -INF});
            int num = (p1->first - p1->second + 1) + (p2->first - p2->second + 1) - 1;
            ret = max(ret, num);
        }
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 117632
#include <bits/stdc++.h>
using namespace std;
using Int = long long;

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n,ans=0;
    cin>>n;
    int h[n+1]={};
    for (int i = 1; i <= n; i++){
        cin>>h[i];
        if(h[i]>h[i-1])ans+=h[i]-h[i-1];
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int m, f, r;
    while(scanf("%d %d %d", &m, &f, &r) != EOF)
    {
        if (m == -1 && f == -1 && r == -1)
        {
            break;
        }
        if ((m == -1 || f == -1) && r == -1)
        {
            printf("F\n");
        }
        else
        {
            int sum = 0, k = 0;
            if(m >= 0)
            {
                sum += m;
            }
            if(f >= 0)
            {
                sum += f;
            }
            if(sum >= 80)
            {
                printf("A\n");
            }
            else if (sum >= 65 && sum < 80)
            {
                printf("B\n");
            }
            else if ((sum >= 50 && sum < 65) || r >= 50)
            {
                printf("C\n");
            }
            else if (sum >= 30 && sum < 50)
            {
                printf("D\n");
            }
            else
            {
                printf("F\n");
            }
        }
    }
    return 0;
}



Measured memory_bytes: 2600
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>

#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to, weight;

	bool operator < (const Edge& obj) const {
		return weight < obj.weight;
	}
	bool operator > (const Edge& obj) const {
		return weight > obj.weight;
	}
};

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

int divmod(int a,int b, int m) { // a/b(mod m)
	// a/b (mod m)
	// a*b^-1
	// b^-1 * b = 1
	// b^(m-1) = 1 
	// b^(m-2) * b = 1
	// b^-1 = b^(m-2)

	// a/b = a * b^(m-2)

	return (a * 1LL * mod_pow(b,m-2, m)) % m;
}

int comb(int n, int r, int mod) {

	int ret = 1,bo = 1;
	REP(i, r) {
		(ret *= n - i)%=MODU;
		(bo *= r-i)%=MODU;
	}

	return divmod(ret, bo, mod);

}

int main()
{
	int x,t;
	cin >> x >> t;

	cout << max(x-t, 0);
	return 0;
}


Measured memory_bytes: 256
/*Shivam Bhalla */
/* f2016941@pilani.bits-pilani.ac.in */



#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iostream>
#include <string>
#include <cmath>
#include <cassert>
#include <bits/stdc++.h>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
long long maxv = 1e9;

long long N;
int ans=0;

bool isValid(long long val){
  vector<int>arr(11);
  while(val!=0){
    arr[val%10]+=1;
    val=val/10;
  }
  if(arr[3]&&arr[5]&&arr[7])
    return true;
  else
    return false;
}

void dfs(long long val){
  if(val>N)
    return;
  if(isValid(val))
    ++ans;
  dfs(val*10+3);
  dfs(val*10+5);
  dfs(val*10+7);
}

int main() {
  cin>>N;
  dfs(0);
  cout<<ans;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
constexpr unsigned int MAX_N = 100'000;
unsigned int A[MAX_N + 1];
int main(void){
    unsigned int n; scanf("%u", &n);
    A[0] = 0; for(unsigned int i = 1; i <= n; ++i) A[i] = -1;
    for(unsigned int i = 1; i <= n; ++i){
        unsigned int a; scanf("%u", &a);
        unsigned int lower = 0, upper = i;
        while(upper - lower > 1){
            unsigned int mid = (upper + lower) >> 1;
            ((A[mid] < a) ? lower : upper) = mid;
        }
        A[upper] = a;
    }
    unsigned int valid = 0, invalid = n + 1;
    while(invalid - valid > 1){
        unsigned int mid = (invalid + valid) >> 1;
        ((A[mid] == -1) ? invalid : valid) = mid;
    }
    printf("%u\n", valid);
    return 0;
}


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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e5+5;

ll n,m,a[N],par[100005] , sz[100005] , ans[N] , sum;
vector< pair<int,int> > ed;

int findPar(int node)
{
    if (par[node]==node) return node;
    return par[node] = findPar(par[node]);
}

void mergeCom(int node , int node2)
{
    int led = findPar(node) , led2 = findPar(node2);

    if (led==led2) return;
    if (sz[led] > sz[led2])
    {
        sum -= (sz[led]*(sz[led]-1)/2);
        sum -= (sz[led2]*(sz[led2]-1)/2);

        par[led2]=led , sz[led] += sz[led2];

        sum += (sz[led]*(sz[led]-1)/2);
    }
    else
    {
        sum -= (sz[led]*(sz[led]-1)/2);
        sum -= (sz[led2]*(sz[led2]-1)/2);

        par[led]=led2 , sz[led2] += sz[led];

        sum += (sz[led2]*(sz[led2]-1)/2);
    }
}

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

    cin >> n >> m;
    for(int i=1; i<=n; i++)
    {
        par[i] = i;
        sz[i]=1;
    }

    ed.push_back({0,0});
    for(int i=1; i<=m; i++)
    {
        int x,y;
        cin >> x >> y;
        ed.push_back({x,y});
    }


    ll res = 0 , tmp = n*(n-1)/2 , tmp2; //start

    for(int i=m; i>=1; i--)
    {
        ll v = ed[i].f , u = ed[i].s;

        res = (tmp-sum);
        ans[i] = res;

        mergeCom(v,u);
    }

    for(int i=1; i<=m; i++)
        cout << ans[i] << '\n';

    return 0;
}

Measured memory_bytes: 4596
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            while (sc.hasNextInt()) {
                int a = Integer.parseInt(sc.next());
                String s = sc.next();
                String ans = "No";
                int count = 0;
                char c = 'R';
                for(char x:s.toCharArray()){
                  if(x == c){
                    count++;
                  }
                }
                if(count>a-count) ans = "Yes";
                System.out.println(ans);
            }
        }
    }
}

Measured memory_bytes: 21844
import sys
input = sys.stdin.readline

n = int(input())
ll = []
for i in range(n):
  x, l = map(int, input().split())
  ll.append([x-l, x+l])
ll.sort(key=lambda x:x[1])

ans = 0
tmp = -10**9

for l in ll:
  if l[0] >= tmp:
    ans += 1
    tmp = l[1]

print(ans)

Measured memory_bytes: 21292
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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


template< int mod >
struct ModInt {
    int x;

    ModInt() : x(0) {}

    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &p) {
        x = (int) (1LL * x * p.x % mod);
        return *this;
    }

    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }

    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }

    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt< mod >(t);
        return (is);
    }

    static int get_mod() { return mod; }
};


void solve() {
    using  modint = ModInt<int(1e9+7)>;
    int N,M;
    cin >> N >> M;
    // dp[k] k段目にたどりついた時のいどうほうほうの数
    vector<modint> dp(N+1,modint(0));
    set<int> st;

    REP(_,M) {
        int a;
        cin >> a;
        st.insert(a);
    }

    dp[0] = modint(1);
    dp[1] = modint(1);
    if(st.count(1)) dp[1] = 0;

    FOR(i,2,N+1) {
        if(st.count(i)) dp[i] = 0;
        else dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[N] << endl;

}

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

Measured memory_bytes: 8268
from collections import deque
def main():
    S = deque(map(str, input()))
    Q = int(input())
    flag = False
    for _ in range(Q):
        A = tuple(map(str, input().split()))
        if A[0] == "1":
            flag = not(flag)
        else:
            if (A[1] == "1" and not(flag)) or (A[1] == "2" and flag):
                S.appendleft(A[2])
            else:
                S.append(A[2])
    if flag:
        print("".join(S)[::-1])
    else:
        print("".join(S))
if __name__ == "__main__":
    main()

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define pl pair<ll, ll>
#define vll vector<ll>
#define pll vector<pair<ll, ll>>
#define f(i,a, b) for (int i = a; i < b; i++)
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ld float
#define fd(i,a, b) for (ll i = a; i >= b; i--)

 /*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
     typedef tree<ll ,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;*/
bool chk(string ss){

   int sz=ss.size();
   f(i,0,sz/2)if(ss[i]!=ss[sz-1-i])return false;
   return true;

}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  double ff;
  cin>>ff;
  ff=ff/3;
 cout<<fixed<<setprecision(7)<<pow(ff,3)<<endl;



}


Measured memory_bytes: 256
program cookies
  implicit none
  integer(8), parameter :: kmax = 50_8
  integer(8) :: n, a, k, ans, s, t, m, tmp
  read(*,*) n, a
  ans = n
  do k = 2_8, kmax
    s = 1_8
    do
      t = n
      m = 0_8
      do while (t > 0_8)
        t = t/(s+1_8)
        m = m+1_8
      end do
      if (m <= k) exit
      s = s+1_8
    end do
    t = s**k
    m = 0_8
    do while (t < n)
      t = (t/s)*(s+1_8)
      m = m+1_8
    end do
    tmp = (k-1_8)*a+(k-m)*s+m*(s+1_8)
    ans = min(ans,tmp)
  end do
  write(*,'(i0)') ans
end program cookies

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

int main(){
    long long n;
    cin >> n;
    long long min;
    cin >> min;
    for(int i =1; i < 5; i++){
        long long x;
        cin >> x;
        if(x < min) min = x;
    } 
    cout << 4 + (min-1 + n)/min << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

ll N, M, K;
ll mod = 998244353;
ll N_1Cn[212345];

ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

int main() {

	cin >> N >> M >> K;

	ll c = 1;
	rep(i, N) {
		N_1Cn[i] = c;
		c *= N - 1 - i;
		c %= mod;
		c *= modinv(i + 1, mod);
		c %= mod;
	}

	ll ans = 0, sub = M;

	rep(i, N) {
		if (N - 1 - i <= K) ans += sub * N_1Cn[N - 1 - i];
		ans %= mod;
		sub *= M - 1;
		sub %= mod;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5112
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static void solve() {
		int n = in.nextInt();
		out.println(n*(n+1)/2);
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 9556
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	ans := make([]int, 1, len(s))
	for _, r := range s {
		x := string(r)
		if x == "A" || x == "C" || x == "G" || x == "T" {
			ans[len(ans)-1]++
		} else {
			ans = append(ans, 0)
		}
	}
	fmt.Println(max(ans))
}


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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> board(h);
    for (int i = 0; i < h; i++) {
        cin >> board[i];
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (board[i][j] == '#') {
                if (j - 1 >= 0 && board[i][j - 1] == '#' || j + 1 < w && board[i][j + 1] == '#' || i - 1 >= 0 && board[i - 1][j] == '#' || i + 1 < h && board[i + 1][j] == '#') {
                    continue;
                } else {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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


int main() {


	int a, b;

	cin >> a >> b;

	if (a>=b) {
		string s = to_string(b);
		//string S = string(a, s.c_str());
		string out;
		for (int i = 0; i < a; i++) {
			out += s;
		}
		cout <<  out << endl;
	}
	else {
		string s = to_string(a);
		//string S = string(a, s.c_str());
		string out;
		for (int i = 0; i < b; i++) {
			out += s;
		}
		cout << out << endl;
	}
	return 0;
}

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

int main() {
    // insert code here...
  int N;
  cin >> N;
  int bin[N];
  for(int i=0;i<N;i++){
    bin[i]=0;
  }
  
   for(int i=1;i<N;i++){
    int n;
     cin >>n;
     bin[n-1]++;
  }
  
   for(int i=0;i<N;i++){
    cout << bin[i] <<endl;
  }

    
}



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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef long double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main()
{
	long long a,b;
	cin >> a >> b;
	a=__gcd(a,b);
	int ans=0;
	for(long long i=2;i*i<=a;i++)
	{
		if(a%i==0) ans++;
		while(a%i==0) a/=i;
	}
	if(a>1) ans++;
	cout << ans+1 << '\n';
	return 0;
}










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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int A, B, C, K;
    cin >> A >> B >> C >> K;

    int ans = 0;
    ans += min(K, A);
    K -= A;
    if (0 < A) {
        K -= B;
    }

    if (0 < K) {
        ans -= min(K, C);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
using namespace std;
int main(){
  string t,h;
  int n,pt=0,ph=0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> t >> h;
    if(t==h)pt++,ph++;
    else if(t>h) pt+=3;
    else ph+=3;
  }
  cout << pt << " " << ph << endl;
}



Measured memory_bytes: 3168
s = input()
bef = ''
count = 0
lis = []
tmp = 0
for x in s:
  if x == bef or bef =='':
    tmp += 1
  else:
    lis.append(tmp)
    tmp = 1
  bef = x
lis.append(tmp)
  
print(min(sum(lis[0:][::2]), sum(lis[1:][::2])) * 2)

Measured memory_bytes: 46448
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
ll nc2(int x){
  return x*(x-1)/2;
}
int main()	{
  int n;
  cin>>n;
  vector<string> s(n);
  map<string,int>mp;
  rep(i,n){
    cin>>s[i];
    sort(rall(s[i]));
  }
  rep(i,n){
    mp[s[i]]++;
  }
  ll ans=0;
  for(auto x:mp){
    int t=x.sc;
    ans+=(ll)t*(t-1)/2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 18176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    ll W, H;
    while (cin >> W >> H)
    {
        if (W == 0 && H == 0)
        {
            break;
        }
        repi(i, W, 0)
        {
            repi(j, H, 0)
            {
                if (i == 0 || i == W - 1 || j == 0 || j == H - 1)
                {
                    cout << "#";
                }
                else
                {
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, k;
    cin >> n >> k;

    ll ret = 0;
    while(n > 0) {
        n /= k;
        ret++;
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll target = 1;
    ll res = 0;
    rep(i, n) {
        if (target == a[i]) {
            target++;
        }
        else {
            res++;
        }
    }

    if (n == res) {
        put(-1);
    }
    else {
        put(res);
    }
    
}
signed main(){ Main();return 0;}

Measured memory_bytes: 4824
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<math.h>
#include<vector>
#include<deque>
#include<map>
#include<set>
#define ll long long
#define dou(s) atof(s.c_str())
#define lon(s) atoll(s.c_str())
#define str(n) to_string(n)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define fion(n) fixed<<setprecision(n)
#define endl "\n"
#define OR ||
#define AND &&
#define NOT !
#define line(s) getline(cin,s)
#define START int main(){cin.tie(0);ios::sync_with_stdio(false);
#define END }
using namespace std;
struct m{ll f,s;};
START
string s;cin>>s;
ll n=s.size();
vector<m> a(n);
ll k=0;
rep(i,0,n){
  a[i].f=k;
  if(s[i]=='/')k++;
  else if(s[i]!='_')k--;
  a[i].s=k;
}
ll b;
ll ans=0;
vector<ll> l;
ll t;
rep(i,0,n){
  if(s[i]!='_' AND s[i]!='/'){
    b=0;
    rep(j,i+1,n){
      if(a[i].f==a[j].s){
        b=j;
        break;
      }
    }
    if(b>0){
      t=0;
      rep(j,i,b+1){
        t+=2*a[i].f-a[j].f-a[j].s;
      }
      l.push_back(t);
      ans+=t;
      i=b;
    }
  }
}
cout<<ans/2<<endl;
cout<<l.size();
rep(i,0,l.size())cout<<' '<<l[i]/2;
cout<<endl;
END


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[][] a = new int[3][3];
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        a[i][j] = scanner.nextInt();
      }
    }
    int n = scanner.nextInt();
    for (int i = 0; i < n; i++) {
      int b = scanner.nextInt();
      for (int j = 0; j < 3; j++) {
        for (int k = 0; k < 3; k++) {
          if (a[j][k] == b) {
            a[j][k] = 0;
          }
        }
      }
    }
    int count1 = 0;
    int count2 = 0;
    int count3 = 0;
    int count4 = 0;
    for (int i = 0; i < 3; i++) {
      count1 = 0;
      count2 = 0;
      if (a[i][i] == 0) {
        count3++;
      }
      if (a[2 - i][i] == 0) {
        count4++;
      }
      for (int j = 0; j < 3; j++) {
        if (a[i][j] == 0) {
          count1++;
        }
        if (a[j][i] == 0) {
          count2++;
        }
      }
      if (count1 == 3 || count2 == 3 || count3 == 3 || count4 == 3) {
        break;
      }
    }
    if (count1 == 3 || count2 == 3 || count3 == 3 || count4 == 3) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
}



Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;	ll m;
ll a[200010], b[200010];
bool cmp(int x, int y) {
	return x > y;
}
int che(ll x) {
	ll s = 0;
	for (int i = 0; i < n; i++) {
		if (a[i]*b[i] > x) {
			s = s + (a[i]-x/b[i]);
		}
	}
	if (s > m) return 1;
	return 0;
}
int main(){
	scanf("%d%lld", &n, &m);
	for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
	for (int i = 0; i < n; i++) scanf("%lld", &b[i]);
	sort(a, a+n);
	sort(b, b+n, cmp);
	ll l = 0;	ll r = a[n-1]*b[0]+1;
	while (l+1 < r) {
		ll mm = (l+r)/2;
		if (che(mm)) l = mm;
		else r = mm;
	}
	if (che(l)) l++;
	printf("%lld\n", l);
	return 0;
}

Measured memory_bytes: 3328
// include
#include <algorithm>
#include <iterator>
#include <vector>
#include <iomanip>
#include <iostream>
#include <stack>
#include <queue>
#include <list>
#include <utility>

#include <string>
#include <cstring>

#include <stdio.h>
#include <cassert>

// M_PI for pi
#define _USE_MATH_DEFINES
#include <math.h>

#include <climits>

using namespace std;

int N;
long long x;

long long A[2005];
long long B[2005];

void slove() {
}


int main(int argc, char* argv[]) {
    cin >> N >> x;

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


    long long S = LLONG_MAX;
    long long s;


    for (int i = 0; i < N; ++i) {
        B[i] = A[i];
    }

    for (int k = 0; k < N; ++k) {
        for (int i = 0; i < N; ++i) {
            B[i] = min(B[i], A[(N + i - k) % N]);
        }

        //for (int i = 0; i < N; ++i) {
        //    cout << B[i] << " ";
        //}
        //cout << endl;

        s = 0;

        for (int i = 0; i < N; ++i) {
            s += B[i];
        }

        s += k * x;
        //cout << s << endl;

        S = min(s, S);
    }

    cout << S << endl;


    return 0;
}


Measured memory_bytes: 256
import math

def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n /= m
        return c, n
    #
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff

def divisor_num(n):
    a = 1
    for _ , x in factorization(n):
        a *= x + 1
    return a

n = int(raw_input())
nx = math.factorial(n)
print divisor_num(nx) % (10**9 + 7)


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

int main()
{
	double x1, x2, x3, y1, y2, y3, px, py;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py) {
		double j1 = (x1 - x2)*(py - y2) - (px - x2)*(y1 - y2),
		       j2 = (x3 - x1)*(py - y1) - (px - x1)*(y3 - y1),
			   j3 = (x2 - x3)*(py - y3) - (px - x3)*(y2 - y3);
		if ((j1 < 0 && j2 < 0 && j3 < 0) || (j1 > 0 && j2 > 0 && j3 > 0))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

LL f(const LL n) {
    switch(n & 3) {
       case 0: return n;     // if n is multiple of 4
       case 1: return 1;     // If n % 4 gives remainder 1
       case 2: return n + 1; // If n % 4 gives remainder 2
       case 3: return 0;     // If n % 4 gives remainder 3
    }
}//computeXOR

int main() {
   LL A, B;
   scanf("%lld %lld", &A, &B);
   if (A > 0)
      printf("%lld\n", f(B) ^ f(A - 1));
   else
      printf("%lld\n", f(B));
   return 0;
}//main


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (r, g, b, n) = readLine()!!.split(" ").map { it.toInt() }
    var cnt = 0
    var p = n / r
    for (i in 0..p) {
        var a = (n - i * r) / g
        for (j in 0..a) {
            if ((n - i * r - j * g) % b == 0) cnt++
        }
    }
    println(cnt)
}


Measured memory_bytes: 36000
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    string s;
    cin >> s;
    cout << s[0] << s.size()-2 << s[s.size()-1] << endl;
    return 0;
}

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


int n;

string *color = new string[n];

int *d = new int[n];

queue<int> q;

int c[100][100];

void bfs(){
  color[0] = "gray";
  d[0] = 0;

  q.push(0);


  while(q.size() != 0){
    int u = q.front();
    q.pop();

    for(int v = 0; v < n; v++){
      if(c[u][v] == 1 && color[v] == "white"){
        color[v] = "gray";
        d[v] = d[u] + 1;
        q.push(v);
      }

    }
    color[u] = "black";
  }
}

int main(){

  cin >> n;

  color = new string[n];

  d = new int[n];


  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      c[i][j] = 0;
    }
  }

  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    int k;
    cin >> k;
    for(int j = 0; j < k; j++){
      int v;
      cin >> v;
      c[i][v - 1] = 1;
    }
  }

  for(int i = 0; i < n; i++){
    color[i] = "white";
  }

  for(int i = 0; i < n; i++){
    d[i] = -1;
  }

  bfs();





  for(int i = 0; i < n; i++){
    cout << i + 1 << ' ' << d[i] << endl;
  }




  return 0;
}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  string s;
  cin>>s;
  ll cnt = 0;
  for(ll i = 0;i<s.size();i++){
    if(s.at(i) == 'p'){
      cnt++;
    }
  }
  cout << s.size()/2-cnt << endl;
  return 0;
}

Measured memory_bytes: 512
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define ll long long
#define fir first
#define sz(a) int((a).size())

int fa[200005];
int cntf[200005];
int ans=0;
int get(int x)
{
	if(x==fa[x])
		return x;
	return fa[x]=get(fa[x]);
}

void _merge(int a,int b)
{
	int x=get(a),y=get(b);
	if(x==y)
		return ;
	fa[x]=y;
	cntf[y]+=cntf[x];
	cntf[x]=0;
	ans=max(ans,cntf[y]);
}

signed main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,m;
	cin>>n>>m;
	for(int i=0;i<=n+1;i++)
	{
		fa[i]=i;
		cntf[i]=1;
	}
	int a,b;
	for(int i=0;i<m;i++)
	{
		cin>>a>>b;
		_merge(a,b);
	}
	if(ans==0)
		ans=1;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5216
def main():
    s=list(input())[::-1]
    ans,tot,x,m=0,0,1,2019
    cnt=[0]*m
    n=len(s)
    for i in range(n):
        cnt[tot] += 1
        tot += int(s[i])*x
        tot %= m
        ans += cnt[tot]
        x = x*10%m
    print(ans)

if __name__ == '__main__':
    main()



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

int main()
{
	int n;
	cin >> n;
	int count = 0;
	for (int i = 0; i < 262144; i++) {
		int a[10]{ 4 };
		int k = i;
		int l = 1;
		int num = 0;
		for (int j = 0; j < 10; j++) {
			a[j] = k % 4 * 2 + 1;
			num += a[j] * l;
			k /= 4;
			l *= 10;
			if (k == 0) {
				break;
			}
		}
		if (num > n) {
			break;
		}
		bool f, g, h;
		f = g = h = false;
		for (int j = 0; j < 10; j++) {
			if (a[j] == 3) {
				f = true;
			}
			if (a[j] == 5) {
				g = true;
			}
			if (a[j] == 7) {
				h = true;
			}
			if (a[j] == 1) {
				f = false;
				break;
			}
		}
		if (f && g && h) {
			count++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
#for _ in range(int(input())):
#	n=int(input())
#	n,m=map(int,input().split())
#	s=input().strip()
sys.setrecursionlimit(10**9)
def dfs(i):
	if dp[i]!=-1:return dp[i]
	c=0
	for j in v[i]:c=max(c,dfs(j)+1)
	dp[i]=c
	return c

n,m=map(int,input().split())
v=[[] for i in range(n+1)]
for i in range(m):
	x,y=map(int,input().split())
	v[x].append(y)
dp = [-1]*(n+1) 
m=0
for i in range(1,n+1):
	m=max(m,dfs(i))
print(m)

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

using namespace std;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


int main(void){

    int n;
    cin >> n;

    cout << n + n*n + n*n*n << endl;

    return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;

std::vector<ll> vp;
void SieveOfEratosthenes() 
{ 
    vector<bool>prime(1000001,1);
  
    for (ll p=2; p*p<=1000001; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (ll i=p*p; i<=1000001; i += p) 
                prime[i] = false; 
        } 
    } 
    for (ll p=2; p<=1000001; p++) 
       if (prime[p]) 
          vp.pb(p); 
} 
void solve()
{
SieveOfEratosthenes();
  ll n,m,k,x=0,y=0,c=0,q,ans=0;
  cin>>n;
 x= upper_bound(vp.begin(), vp.end(),n)-vp.begin();
 if(vp[x-1]==n)
 {
  c(n);
  return;
 }
 c(vp[x]);

}

signed main(){
     
      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll T=1;
      //cin>>T;
      while(T--)
      {
      solve();
      }
      return 0;
    }


Measured memory_bytes: 1528
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	cout << a[n - 1] - a[0];
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	vector<ll> a(n);
	rep(i, 0, n - 1)cin >> a[i];
	vector<ll> c(n + 1);
	rep(i, 1, n)c[i] += c[i - 1] + a[i - 1];
	ll ans = 1e18;
	rep(i, 1, n)
	{
		ans = min(ans, abs(c[n] - c[i] - c[i]));
	}
	cout << ans << endl;
}


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

int main() {
  int n;
  cin >> n;
  long long a=2, b=1;
  for ( int i=0; i<n; i++ ) {
    long long t=a+b;
    a=b;
    b=t;
  }
  cout << a << '\n';
  return 0;
}

Measured memory_bytes: 256