akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define INFLL 0x3fffffffffffffffLL
#define INF 0x7fffffff
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define exist(s,e) (s.find(e)!=s.end())
#define ff first
#define ss second
#define EPS 1e-8
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
const int MOD=100000007;
/////////////////// DEBUG MODE ///////////////////////////////////
#define D(x) cerr<<"DEBUG: "<<#x<<" is: "<<x<<'\n'
#define error(args...) {string _s=#args; replace(all(_s),',',' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string>) { cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
/////////////////// GLOBAL VARIABLES /////////////////////////////
vector<vector<int>> adj; vector<bool> vis;
/////////////////// FUNCTIONS ////////////////////////////////////
template<class T>
T maxx(T a, T b) {return a>b?a:b;}
template<typename T, typename... Args>
T maxx(T a, T b, Args... args){return maxx(a>b?a:b, args...);}
ll mexp(ll x, ll n, ll m){
  ll res=1;  while(n){if(n&1) res=(res*x)%m;n>>=1; x=((x%m)*(x%m))%m;}
  return res;
}
template<class T>
T minn(T a, T b) {return a<b?a:b;}
template<typename T, typename... Args>
T minn(T a, T b, Args... args){return minn(a>b?a:b, args...);}
bool ispow2(ll x){ return x && (!(x&(x-1))); }
ld pow(ld a, int n) {
  if(n == 0) return 1;if(n == 1) return a;
  double t = pow(a, n/2);return t * t * pow(a, n%2);
}
/////////////////// MAIN STARTS //////////////////////////////////
int main(){
  ios::sync_with_stdio(0);  cin.tie(0);   cout<<fixed; cerr<<fixed;
  cout<<setprecision(8); cerr<<setprecision(3);
  #ifdef DEBUG
  freopen("ip.txt","r",stdin); //freopen("op.txt","w",stdout);
  clock_t tStart = clock();
  #endif

	ll v[5], n; cin>>n; memset(v,0, sizeof(v));
	for(int i=0;i<n;++i){
		string s; cin>>s;
		if(s[0]=='M') v[0]++;
		else if(s[0]=='A') v[1]++;
		else if(s[0]=='R') v[2]++;
		else if(s[0]=='C') v[3]++;
		else if(s[0]=='H') v[4]++;
	}
	ll ans=0;
	for(int i=0;i<5;++i){
		for(int j=i+1;j<5;++j){
			for(int k=j+1;k<5;++k) {ans+=v[i]*(v[j]*v[k]);}
		}
	}
	cout<<ans<<'\n';

	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
  return 0;
}


Measured memory_bytes: 256
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

#ifdef SHIK
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
template<typename T>
void _W( const vector<T> &x ) {
    for ( auto i=x.cbegin(); i!=x.cend(); i++ ) {
        if ( i!=x.cbegin() ) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U>
void W( const T& head, const U&... tail ) {
    _W(head);
    putchar(sizeof...(tail)?' ':'\n');
    W(tail...);
}

#ifdef SHIK
#define FILEIO(...)
#else
#define FILEIO(name) do {\
    freopen(name ".in","r",stdin); \
    freopen(name ".out","w",stdout); \
} while (0)
#endif

// }}}

const int N=110;
int m,n,a[N];
int main() {
    R(m,n);
    REP(i,n) R(a[i]);
    sort(a,a+n);
    int x=0,y=a[n-1];
    REP(i,n-1) x+=a[i];
    int ans=max(0,y-x-1);
    W(ans);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dx = abs(x2 - x1);
    int dy = abs(y2 - y1);
    if(y1 == y2)
    {
        if(x1 > x2)
        {
            cout << x2 << ' ' << y2 - dx << ' ' << x1 << ' ' << y1 - dx;
        }
        else
        {
            cout << x2 << ' ' << y2 + dx << ' ' << x1 << ' ' << y1 + dx;
        }
        return 0;
    }
    else if(x1 == x2)
    {
        if(y1 > y2)
        {
            cout << x2 + dy << ' ' << y2 << ' ' << x1 + dy << ' ' << y1;
        }
        else
        {
            cout << x2 - dy << ' ' << y2 << ' ' << x1 - dy << ' ' << y1;
        }
        return 0;
    }
    if(x1 < x2)
    {
        if(y1 > y2)
        {
            cout << x2 + dy << ' ' << y2 + dx << ' ' << x1 + dy << ' ' << y1 + dx;
        }
        else
        {
            cout << x2 - dy << ' ' << y2 + dx << ' ' << x1 - dy << ' ' << y1 + dx;
        }
    }
    else
    {
        if(y1 > y2)
        {
            cout << x2 + dy << ' ' << y2 - dx << ' ' << x1 + dy << ' ' << y1 - dx;
        }
        else
        {
            cout << x2 - dy << ' ' << y2 - dx << ' ' << x1 - dy << ' ' << y1 - dx;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
		    
int main(){
  int handan=1,a,i,j,k,kaisuu=0;
  int N,suuretu[100];
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&suuretu[i]);
  }
  
  while(handan){
    handan=0;
    for(j=N-1;j>=1;j--){
      if(suuretu[j]<suuretu[j-1]){
	k=suuretu[j];
	suuretu[j]=suuretu[j-1];
	suuretu[j-1]=k;
	handan=1;
	kaisuu++;
      }
    }
  }
  for(i=0;i<N-1;i++){
    printf("%d ",suuretu[i]);
  }
  printf("%d\n",suuretu[N-1]);
  printf("%d\n",kaisuu);
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = vector<T>;
using vvi = vector<vt<int>>;

int main(){

  int x,n;
  cin >> x >> n;
  vt<int> p(200);
  rep(i,n){
    int num;
    cin >> num;
    p[num] = 1;
  }

  int tmp = abs(x+1);
  int ans = -1;
  rep(i,102){
    if(p[i] != 1 && tmp > abs(x-i)){
      tmp = abs(x-i);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int G(int n,int K){
    if(n<K)return 0;
    if(n%K==0)return n/K;
    return G(n-n/K-1,K);
}
int sg(int n,int k){
    // cout<<"n="<<n<<" k="<<k<<"\n";
    if(n<k)return 0;
    if((n-n/k*k)%(n/k+1)==0)return n/k;
    return sg(n-((n-n/k*k+n/k)/(n/k+1))*(n/k+1),k);
}
int main(){
    // mt19937 rand((size_t)new char);
    // while(1){
    //     int n=rand()%10000+1,k=rand()%100+1;
    //     if(sg(n,k)!=G(n,k)){
    //         cout<<n<<" "<<k<<"\n";
    //         break;
    //     }
    //     static int cnt;
    //     if(++cnt%1000==0)cout<<cnt<<"\n";
    // }
    int n,ans=0;cin>>n;
    for(int i=1;i<=n;i++){
        int a,k;cin>>a>>k;
        ans^=sg(a,k);
    }
    cout<<(ans?"Takahashi":"Aoki")<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string a;
int main(){
	int n,len,high=0,hiax=0;
	cin>>n>>a;
	for(int i=0;i<n;i++){
		if(a[i]=='I'){
			high++;
			hiax=max(hiax,high);
			continue;
		}
		high--;
	}
	cout<<hiax;
	return 0;
}


Measured memory_bytes: 256
N=int(input())
arr = list(map(int,list(input().split())))
ds = set(arr)
############################################

allxor=0
for i in range(N):
	#if len(ds)==0:
	#	break
	#allxor=allxor ^ ds.pop()
	allxor=allxor ^ arr[i]

for i in range(N):
	print(allxor ^ arr[i],end='')
	print(' ',end='')

#for i in range(N):
#	if i==0 :
#		s=str(allxor ^ arr[i])
#	else:
#		s=s + ' ' + str((allxor ^ arr[i]))
#print(s)


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

int main()  
{   
    cin.tie(0); ios::sync_with_stdio(false);  
	//freopen("input.txt", "rt", stdin);
	string s; cin >> s;
	ll ans = 0, bcnt = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'B')
			bcnt++;
	}
	ll k = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'B') {
			ans += s.size() - (bcnt - k) - i;
			k++;
		}
	}

	cout << ans << endl;


	return 0;   
}  


Measured memory_bytes: 720
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = String.valueOf(n);
        char c = s.charAt(s.length() - 1);
        if (c != '1' && c != '3' && c != '7' && c != '9') {
            System.out.println(-1);
            return;
        }
        int cnt = 1;
        int num = 0;
        int i = 0;
        while(i <= 1000000) {
            num = (10 * num + 7) % n;
            if (num == 0) {
                System.out.println(cnt);
                return;
            }
            cnt++;
            i++;
        }
        System.out.println(-1);
    }
}

Measured memory_bytes: 35572
n, m = map(int, input().split())

list = [True for i in range(n)]
cnt = [0 for i in range(n)]
for i in range(m):
	tmp, s = input().split()
	p = int(tmp)
	if s == "AC":
		list[p-1] = False
	elif s == "WA":
		if list[p-1]:
			cnt[p-1] += 1

for i in range(n):
	if list[i]:
		cnt[i] = 0

print(list.count(False), sum(cnt))


Measured memory_bytes: 4656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

#ifdef MY_DEBUG_FLAG
template<typename T> void debug(T a) { cerr << a << ' '; }
template<typename T, typename U> void debug(pair<T, U> a) { cerr << a.first << ' ' << a.second << ' '; }
template<typename T> void debug(vector<T> a) { for(auto it : a) debug(it);}
template<typename T> void debug(set<T> a) { for(auto it : a) debug(it);}
#define db(a) cerr << "DEBUG ( " << #a << " == ", debug(a), cerr << ")\n"
#else
#define db(...)
#endif

#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false), cout.tie(nullptr), cin.tie(nullptr)
#define sz(a) ((int)(a).size())
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define dec(i,n,a) for(int i=(n); i>=(a); i--)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()

constexpr ll inf = 0x3f3f3f3f3f3f3f3f;
constexpr int MAXN = 410;
constexpr int mod = 1000000007;

ll pref[MAXN], dp[MAXN][MAXN];

int main() {
	int n; scanf("%d", &n);
	vi a(n+1); rep(i,1,n+1) scanf("%d", &a[i]);
	rep(i,1,n+1) pref[i] = pref[i-1] + a[i];

	for(int i = n; i >= 1; i--) {
		for(int j = i+1; j <= n; j++) {
			ll add = inf;
			for(int k = i; k < j; k++) {
				add = min(add, dp[i][k] + dp[k+1][j]);
			}
			dp[i][j] = add + pref[j] - pref[i-1];
		}
	}
	printf("%lld\n", dp[1][n]);
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll h,w;cin>>h>>w;
    vvc c(2*h,vc(w));
    rep(i,h){
        rep(j,w){
            cin >> c[2*i][j];
            c[2*i+1][j] = c[2*i][j];
        }
    }
    rep(i,2*h){
        rep(j,w){
            cout << c[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
N, M, K = map(int, input().split())
ret = False
for i in range(N+1):
    for j in range(M+1):
        r = j*N+i*M-2*i*j
        # print(i,j,r)
        if r >= K:
            break
    if r == K:
        ret = True
        # print(i,j)
        break
        
print('Yes' if ret else 'No')

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

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

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

    // start
    vector<int> x(5);
    int k;
    rep(i, 5) cin >> x.at(i);
    cin >> k;
    sort(all(x));
    cout << (x.at(4) - x.at(0) > k ? ":(" : "Yay!") << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
/*
 * FileName:     C
 * CreatedDate:  2020-02-22 21:28:13 +0900
 * LastModified: 2020-02-22 21:40:20 +0900
 */

#include <stdio.h>
#include"math.h"

int main(void){
    int N;
    scanf("%d",&N);
    int i;
    double X[N];
    double s=0;
    for(i=0;i<N;i++){
        scanf("%lf",&X[i]);
        s+=X[i];
    }
    s =round(s/(double)N);
    double total = 0;
    for(i=0;i<N;i++){
        total += (X[i]-s)*(X[i]-s);
    }
    printf("%d\n",(int)total);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int mex=5001;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 
 
 
 
int main()
{
  ll int n;
  cin>>n;
  ll int a=n/3,b=n/5,c=n/15,an=0;
  fo(i,1,n+1)
  {
	  if(i%3&&i%5) an+=i;
  }
  //ll int an=n-(a+b-c);
  cout<<an;
}

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

int main(){
  int n;
  while(cin >> n,n){
    int k,s=0,f=0;
    for(int i=0;i<n;i++){
      cin >> k;
      if(k>=1)s++;
      if(k>1)f=1;
    }
    if(!f)cout << "NA" << endl;
    else cout << s+1 << endl;
  }
}

Measured memory_bytes: 1160
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <numeric>
#include <cassert>
#include <sstream>

using namespace std;

class agc020a {
public:
    void solve(istream& in, ostream& out) {
        int N, A, B;
        in >> N >> A >> B;
        int dist = B - A;
        if (dist % 2 == 0) {
            out << "Alice\n";
        } else {
            out << "Borys\n";
        }
    }
};


int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	agc020a solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
#define rep(x, a, b) for(int x = (a); x <= (b); ++x)
#define rop(x, a, b) for(int x = (a); x < (b); ++x)
#define per(x, a, b) for(int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
const long double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;
struct node {
	int x, y;
}a[200005];
bool operator < (const node & a, const node & b) {
	if(a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator == (const node & a, const node & b) {
	return a.x == b.x && a.y == b.y;
}
const int INF = 2000000000;
int x_1, x_2, y_1, y_2;
int n;
int f[200005];
main() {
	scanf("%lld%lld%lld%lld", &x_1, &y_1, &x_2, &y_2);
	int bj = 1;
	if(x_1 > x_2) swap(x_1, x_2), bj *= -1;
	if(y_1 > y_2) swap(y_1, y_2), bj *= -1;
	scanf("%lld", &n);
	rep(i, 1, n) {
		scanf("%lld%lld", &a[i].x, &a[i].y);
		if(x_1 == x_2 && a[i].x == x_1 && a[i].y >= y_1 && a[i].y <= y_2) {
			printf("%0.15f", (DB) (((LL) y_2 - y_1) * 100.0 - 20 + 10 * pi));
			return 0;
		}
		if(y_1 == y_2 && a[i].y == y_1&& a[i].x >= x_1 && a[i].x <= x_2) {
			printf("%0.15f", (DB) (((LL) x_2 - x_1) * 100.0 - 20 + 10 * pi));
			return 0;
		}
		if(a[i].x < x_1) a[i].x = INF, a[i].y = INF;
		else if(a[i].x > x_2) a[i].x = INF, a[i].y = INF;
		else if(a[i].y < y_1) a[i].x = INF, a[i].y = INF;
		else if(a[i].y > y_2) a[i].x = INF, a[i].y = INF;
		else a[i].x *= bj;
	}
	sort(a + 1, a + 1 + n);
	while(a[n].x == INF) --n;
	int as = 0;
	rep(i, 1, n) {
		if(as == 0) f[++as] = a[i].y;
		else {
			int k = upper_bound(f + 1, f + 1 + as, a[i].y) - f;
			while(k <= as && f[k] < a[i].y) ++k;
			f[k] = a[i].y;
			as = max(as, k);
		}
	}
	printf("%0.15f", (DB) (((LL) x_2 - x_1 + y_2 - y_1) * 100.0 - (20 - 5 * pi) * as + ((as == min(x_2 - x_1 + 1, y_2 - y_1 + 1)) ? 5.0 * pi : 0)));
	return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>

int main(){
    int A,B;
    scanf("%d %d",&A,&B);
    if(A>=13){
        printf("%d\n",B);
    }else if(A<=5){
        printf("0\n");
    }else{
        printf("%d\n",B/2);
    }
    return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


int main(){
    int n;
    cin >> n;
    int f;
    cin >> f;
    ll sum = f;
    int l, r = f;
    set<int> d;
    rep(i, n-1) l=r, cin >> r, sum += r, d.insert(l-r);
    d.insert(r-f);
    
    ll k = sum/((1ll+n)*n/2);
    if(sum%((1ll+n)*n/2) != 0 || k <= 0){
        cout << "NO" << endl;
        return 0;
    }

    for(auto x : d){
        if(x+k < 0 || (x+k)%n != 0){
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;


    return 0;
}



Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<cmath>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<stdio.h>
#include<queue>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[101],b[101];
  for(int i=1;i<=n;i++)
    cin>>a[i];
  for(int i=1;i<=n;i++)
    cin>>b[i];
  b[1]=a[1]+b[1];
  for(int i=2;i<=n;i++)
    a[i]=a[i]+a[i-1];
  for(int i=2;i<=n;i++)
  {
    b[i]+=max(b[i-1],a[i]);
  }
  cout<<b[n]<<endl;
  system("pause");
  return 0;
}

Measured memory_bytes: 504
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;

using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<ll, ll> pii;
typedef long double ld;
#define double long double
typedef pair<ld, ld> pld;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

typedef vector<ll> vi;
typedef vector<pii> vpii;
namespace IO {
    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> &a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> &a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> &a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define int ll

void solve() {
    int a, b;
    cin >> a >> b;
    put(a*b);
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(30);
//    freopen("input.txt", "r", stdin);
//    freopen("input.txt", "r", stdin);
    int q = 1;
//    cin >> q;
    while (q--) solve();
}



Measured memory_bytes: 3644
n = int(input())
ans = ''
i = 1
while i <= n:
    x = i
    if (x % 3) == 0:
        ans += ' ' + str(i)
        i += 1
    elif (x % 10) == 3:
        ans += ' ' + str(i)
        i += 1
    else:
        while True:
            x = (x // 10)
            if x == 0:
                i += 1
                break
            elif (x % 10) == 3:
                ans += ' ' + str(i)
                i += 1
                break
print(ans)



Measured memory_bytes: 5632
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		ArrayList<Integer> hour=new ArrayList<>();
		Scanner sc=new Scanner(System.in);
		
		int goukei=0;
		int hourdata=0;
		int result;
		
		//高橋君の夏休み
		int N=sc.nextInt();
		//高橋君の宿題の数
		int M=sc.nextInt();
		
		//宿題をやるのにかかる時間
		for(int i=0;i<M;i++) {
			hour.add(sc.nextInt());
		}
		
		//宿題をやるのにかかる時間の合計
		for(int i=0;i<hour.size();i++) {
			hourdata=hour.get(i);
			goukei+=hourdata;
		}
		
		if(goukei<=N) {
			result=N-goukei;
			System.out.println(result);
		}else {
			System.out.println(-1);
		}

	}

}


Measured memory_bytes: 46620
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin >> s;
    n = s.size();
    stack<char> st;
    st.push(s[0]);
    for(int i = 1;i<n;i++)
    {
        if(st.size() > 0)
        {
            if(s[i] != st.top())
            st.pop();
            else
            st.push(s[i]);
        }
        else
        st.push(s[i]);
        
    }
    if(s.size() <= 1)
    cout << 0;
    else
    cout << n - st.size();
return 0;    
}

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

int main(){
	int n;
	cin >> n;
	
	string s;
	
	unordered_map<string, int> mp;
	while ( n--){
		cin >> s;
		mp[s]++;
	}
	
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
	return 0;
}

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

def main():
    n=int(input())
    XY=[list(map(int,input().split())) for _ in range(n)]
    
    if n==2:
        return dist(XY[0][0],XY[0][1],XY[1][0],XY[1][1])/2
    
    ans=float('inf')
    for i in range(n-2):
        for j in range(i+1,n-1):
            for k in range(j+1,n):
                x1,y1=XY[i]
                x2,y2=XY[j]
                x3,y3=XY[k]
                r,x,y=circle(x1,y1,x2,y2,x3,y3)
                #print(r,x,y)
                if r==-1:
                    continue
                for x4,y4 in XY:
                    if dist(x,y,x4,y4)>r:
                        break
                else:
                    ans=min(ans,r)
    for i in range(n-1):
        for j in range(i+1,n):
            x1,y1=XY[i]
            x2,y2=XY[j]
            x,y=(x1+x2)/2,(y1+y2)/2
            r=dist(x,y,x1,y1)
            for x3,y3 in XY:
                if dist(x,y,x3,y3)>r:
                    break
            else:
                ans=min(ans,r)
    return ans
                
def dist(x1,y1,x2,y2):
    return ((x2-x1)**2+(y2-y1)**2)**0.5

def circle(x1,y1,x2,y2,x3,y3):
    #length of each side to the second power and area of the triangle
    a2=(x2-x3)**2+(y2-y3)**2 
    b2=(x1-x3)**2+(y1-y3)**2
    c2=(x2-x1)**2+(y2-y1)**2
    area=((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/2

    #not on the same line please
    if area==0:
        return -1,0,0
    
    #circumcenter coordinate and radius      
    x=(a2*(b2+c2-a2)*x1+b2*(c2+a2-b2)*x2+c2*(a2+b2-c2)*x3)/(16*area*area)
    y=(a2*(b2+c2-a2)*y1+b2*(c2+a2-b2)*y2+c2*(a2+b2-c2)*y3)/(16*area*area) 
    r=((x1-x)**2+(y1-y)**2)**0.5
    
    #join to return
    return r,x,y
    
if __name__=='__main__':
    print(main())

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c,cmp,data,m,h,k,w,x,y,xcmp=0,ycmp=0,sum=0;

string s;

vector<int> z;

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

       cin >> x;
      if(x<=6){
          Cout(1);
      }
      else if((x-6)%11==0){
          Cout((x-6)/11*2+1);
      }
      else if(x%11==0){
          Cout(x/11*2);
      }
      else{
          if(x%11<=6){
              Cout(x/11*2+1);
          }
          else{
              Cout(x/11*2+2);
          }
      }
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long ;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i<(ll)(n); i++)
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<ll> vcl;

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}
ll c2(ll n){
    return n*(n-1)/2;
}

int main(){
ll n;
cin>>n;
ll b=0;
vcl a(n);
rep(i,n){
    cin>>a[i];
    b^=a[i];
}

rep(i,n){
    ll c=b^a[i];
    cout<<c<<endl;
}
}


Measured memory_bytes: 4780
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main(){
    int a,b=0;
    scanf("%d",&a);
    int aa=a;
    while(a){
        b+=a%10;
        a=a/10;
    }
    if(aa%b==0){
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
}


Measured memory_bytes: 128
#include <queue>
#include <cstdio>
int main() {
	register int u, cur; register char c, cz[13];
	std::priority_queue<int> que;
	while (true) {
		getchar_unlocked();
		getchar_unlocked();
		c = getchar_unlocked();
		if (c == 'd') break;
		if (c == 't') {
			getchar_unlocked();
			getchar_unlocked();
			getchar_unlocked();
			getchar_unlocked();
			getchar_unlocked();
			u = que.top(), cur = 0; que.pop();
			if (u == 0) cz[cur++] = 48;
			while (u) cz[cur++] = u % 10 + 48, u /= 10;
			while (cur) putchar_unlocked(cz[--cur]);
			putchar_unlocked('\n');
		}
		else {
			getchar_unlocked();
			getchar_unlocked();
			getchar_unlocked();
			getchar_unlocked();
			c = getchar_unlocked();
			cur = 0;
			while (48 <= c && c <= 57) cur = cur * 10 + c - 48, c = getchar_unlocked();
			que.push(cur);
		}
	}
	return 0;
}

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

#define INF (1LL << 31 - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define fi first
#define se second

inline void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int n, a[100005];
map<int, int> mp;

int main() {
    init();

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

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

    long long ans = 0;
    for (int i = -1; i < 100000; ++i) {
        if (ans < mp[i]) ans = mp[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5376
#include "bits/stdc++.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
using ll = long long;
using namespace std;

/*
ll GCD(ll a, ll b) {
return b ? GCD(b, a%b) : a;
}

sort(a, a + N, greater<int>())   // descend
sort(a, a+N)                    //  ascend


** nCk
void comb(vector<vector <long long int > > &v) {
for (int i = 0; i < v.size(); i++) {
v[i][0] = 1;
v[i][i] = 1;
}
for (int k = 1; k < v.size(); k++) {
for (int j = 1; j < k; j++) {
v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
}
}
}


** main内でnCn~nC0 生成 **
vector<vector<long long int> > v(n + 1, vector<long long int>(n + 1, 0));
comb(v);


*/



int main() {
	ll n;
	cin >> n;
	ll prime[1000];
  	rep(i,0,1000) prime[i]=1;
	ll ans = 1;
	rep(i, 2, n + 1) {
		ll c = i;
		rep(j,2,n+1){
			while(c%j == 0) {
				prime[j]++;
				c /= j;
			}
		}
	}
	rep(i, 2, n + 1){
      if(prime[i]>1) ans = (ans*prime[i])%(1000000000+7);
    }
	cout << ans;
}


Measured memory_bytes: 256
n = int(input())
s = input()

ans = 0
for i in range(1000):
    key = '{:03d}'.format(i)

    for j in range(n):
        if s[j] == key[0]: break
    else: continue

    for k in range(j+1, n):
        if s[k] == key[1]: break
    else: continue

    for l in range(k+1, n):
        if s[l] == key[2]: break
    else: continue

    ans += 1

print(ans)    


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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int n,m;
    cin>>n;


    map<string,int> ss;

    rep(i,n){
        string s;
        cin>>s;
        ss[s]++;
    }

    cout<< ss.size() <<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 19124
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			String result = "";
			String str = sc.next();
			String[] strs = str.split("0");
			for (int j = 0; j < strs.length; j++)
				if (strs[j].length() != 0)
					switch (getInt(strs[j].charAt(0))) {
					case 1:
						switch (strs[j].length() % 5) {
						case 1:
							result += ".";
							break;
						case 2:
							result += ",";
							break;
						case 3:
							result += "!";
							break;
						case 4:
							result += "?";
							break;
						case 0:
							result += " ";
							break;
						default:
							break;
						}
						break;
					case 2:
						switch (strs[j].length() % 3) {
						case 1:
							result += "a";
							break;
						case 2:
							result += "b";
							break;
						case 0:
							result += "c";
							break;
						default:
							break;
						}
						break;
					case 3:
						switch (strs[j].length() % 3) {
						case 1:
							result += "d";
							break;
						case 2:
							result += "e";
							break;
						case 0:
							result += "f";
							break;
						default:
							break;
						}
						break;
					case 4:
						switch (strs[j].length() % 3) {
						case 1:
							result += "g";
							break;
						case 2:
							result += "h";
							break;
						case 0:
							result += "i";
							break;
						default:
							break;
						}
						break;
					case 5:
						switch (strs[j].length() % 3) {
						case 1:
							result += "j";
							break;
						case 2:
							result += "k";
							break;
						case 0:
							result += "l";
							break;
						default:
							break;
						}
						break;
					case 6:
						switch (strs[j].length() % 3) {
						case 1:
							result += "m";
							break;
						case 2:
							result += "n";
							break;
						case 0:
							result += "o";
							break;
						default:
							break;
						}
						break;
					case 7:
						switch (strs[j].length() % 4) {
						case 1:
							result += "p";
							break;
						case 2:
							result += "q";
							break;
						case 3:
							result += "r";
							break;
						case 0:
							result += "s";
							break;
						default:
							break;
						}
						break;
					case 8:
						switch (strs[j].length() % 3) {
						case 1:
							result += "t";
							break;
						case 2:
							result += "u";
							break;
						case 0:
							result += "v";
							break;
						default:
							break;
						}
						break;
					case 9:
						switch (strs[j].length() % 4) {
						case 1:
							result += "w";
							break;
						case 2:
							result += "x";
							break;
						case 3:
							result += "y";
							break;
						case 0:
							result += "z";
							break;
						default:
							break;
						}
						break;
					default:
						break;
					}
			System.out.println(result);
		}
		sc.close();
	}

	private static int getInt(char c) {
		return Integer.parseInt(Character.toString(c));
	}
}

Measured memory_bytes: 24420
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int a, b;
    cin >> a >> b;
    string aa = to_string(a);
    string bb = to_string(b);
    string sa(a,bb[0]), sb(b,aa[0]);
    
    if (sa <= sb) cout << sa << endl;
    else cout << sb << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
ll n,m;
ll num[10]={2,5,5,4,5,6,3,7,6};
string dp[11000];
void chmax2(string &a,string b){
    if(a=="-") a=b;
    if(a.size()<b.size()) a=b;
    else if(a.size()==b.size()){
        if(a<b) a=b;
    }
}
int main(){
    cin>>n>>m;
    vl a(m);rep(i,m)cin>>a[i];
    rep(i,11000)dp[i]="-";
    dp[0]="";
    for(int i=0;i<=n;i++){
        if(dp[i]=="-") continue;
        for(auto aa:a){
            string b=dp[i]+(char)('0'+aa);
            chmax2(dp[i+num[aa-1]],b);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 45056
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//STANDARD DATA TYPES
#define ll long long
#define llu unsigned long long
#define ld long double
//ADV DATA TYPES
#define pii pair < int , int >
#define pll pair < ll, ll >
#define mp make_pair
#define ff first
#define ss second
//C ++ DS
#define vi vector < int >
#define vll vector < ll >
#define pb push_back
#define pf push_front
#define iter :: iterator
#define all(x) x.begin(),x.end()

//priority_queue < pii, vector < pii >, greater < pii > > pq;
//lower_bound(v.begin(),v.end(),20);//for any sorted container
//CONSTANTS
#define MOD 998244353
#define INF 0x3f3f3f3f
#define MAXN (int)(2e5+1)
//MOD OPERATIONS
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll addmod(ll a, ll val, ll p = MOD) {{if ((a = (a + val)) >= p) a -= p;} return a;}
inline ll submod(ll a, ll val, ll p = MOD) {{if ((a = (a - val)) < 0) a += p;}return a;}
inline ll mult(ll a, ll b, ll p = MOD) {return (ll) a * b % p;}
//DEBUG
#define shout()  {cout << "I'm Here...!!!" << endl;}
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }

typedef ll ftype;
typedef complex < ftype > point;
#define x real
#define y imag

ftype dot(point a, point b){
	return (conj(a)*b).x();
}

ftype cross(point a, point b){
	return (conj(a)*b).y();
}

vector < point > hull, vecs;

void add_line(ftype k, ftype b){
	point nw = {k, b};

	//Pops those points above the new Lower Convex Hull
	//Assuming when linear functions are added their k only increases
	//Else if k is decreasing 
	// Change '<' to '>' in the inequality in following while loop condition
	while(!vecs.empty() && dot(vecs.back(), nw - hull.back())<0){
		hull.pop_back();
		vecs.pop_back();
	}

	//Pushes the normal vector for last two point in the hull
	if(!hull.empty()){
		point iota = {0, 1};
		vecs.push_back(iota*(nw-hull.back()));
	}

	//Pushes the new  point in the Hull
	hull.push_back(nw);
}

ll get(ftype x) {
    point query = {x, 1};
    auto it = lower_bound(vecs.begin(), vecs.end(), query, [](point a, point b) {
        return cross(a, b) > 0;
    });
    return dot(query, hull[it - vecs.begin()]);
}
ll height[MAXN];
ll dp[MAXN];
int main()
{
	fastio;
	int n;cin>>n;
	ll C;cin>>C;
	for(int i=1;i<=n;i++)
		cin>>height[i];
	for(int i=1;i<=n;i++)
	{
		if(i==1){
			dp[1]=0;
			add_line(height[1],height[1]*height[1]);
			continue;
		}
		ll res;
		res=get(-2*height[i]);
		dp[i]=res+C+height[i]*height[i];
		add_line(height[i],dp[i]+height[i]*height[i]);
	}
	cout<<dp[n]<<endl;
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int n, k, s;
    cin >> n >> k >> s;
    vector<int> A(n, 0);
    for (int i = 0; i < k; i++) {
        A[i] = s;
    }
    for (int i = k; i < n; i++) {
        if (s - 1 == 0) {
            A[i] = s + 1;
        } else {
            A[i] = s - 1;
        }
    }

    for (int i = 0; i < n; i++) {
        cout << A[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int main(){
  int K, X;
  cin >> K >> X;
  // X-(K-1) - X+(k-1)
  int num = (K-1)*2+1;
  int start = X-(K-1);
  int end = X+(K-1);
  if (start<-1000000){
    num-=(-1000000-start);
    start = -1000000;
  }
  if (end > 1000000){
    num-=(end - 1000000);
  }
  for (int i=0;i<num;i++){
    cout << start << " ";
    start++;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    string s;
    cin>>n;
    cin>>s;
    if(n>=s.size())
        cout<<s<<endl;
    else
    {
        for(int i=0; i<s.size(); i++)
        {
            if(i<n)
                cout<<s[i];
        }
        cout<<"..."<<endl;
    }
}



Measured memory_bytes: 3056
#pragma GCC optimize(2)
#include<iostream>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <cstring>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <sstream>
#include <map>
#include <unordered_map>
#include <vector> 
#include <bitset>
#include <cctype>
#include <set>
#include <stack>
#include <queue>
#include <fstream>
#include <numeric>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MAXN = 3005;
const int MAXM = 50005;
const int MOD = 1e9+7;

#define MP make_pair
#define INF 0x3f3f3f3f
#define closeSync ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mst(X,Y) memset(X,Y,sizeof(X)) 
#define rep(i, a, n) for (int i=(a); i<=(n); i++)
#define per(i, a, n) for (int i=(a); i>=(n); i--)
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) { cerr << " " << to_string(H);    debug_out(T...);}
template <typename T> inline T max(T a, T b, T c,T d) { return max(max(a, b),max(c, d)); }
template <typename T> inline T max(T a, T b, T c) { return max(max(a, b),c); }


ll mp[MAXN][MAXN];
ll dp[MAXN][MAXN][4];
int main()
{closeSync;
#ifdef DEBUG
	// freopen("C:/Users/86159/Desktop/a2.in.txt", "r", stdin);
	// freopen("C:/Users/86159/Desktop/output.txt", "w", stdout);
#endif  
	ll r,c,k;
	cin>>r>>c>>k;
	rep (i,1,k)
	{
		ll rr,cc,vv;
		cin>>rr>>cc>>vv;
		mp[rr][cc] = vv;
	}
	rep (i,1,r)
		rep (j,1,c)
			rep (k,1,3)
			{
				dp[i][j][k] = max(dp[i][j-1][k],
					dp[i][j-1][k-1]+mp[i][j],dp[i-1][j][3]+mp[i][j]);

				//debug(i,j,k,dp[i][j][k]);		
			}	

	// cout<<dp[r][c][1]<<endl;
	// cout<<dp[r][c][2]<<endl;
	cout<<dp[r][c][3]<<endl;


	return 0;
}

Measured memory_bytes: 355724
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

int saiki(int n, int m, int k){
	if(k==4){
		if(n==m) return 1;
		else return 0;
	}else{
		int sum = 0;
		for(int i=0; i<10; i++){
			sum += saiki(n, m+i, k+1);
		}
		return sum;
	}
}

int main(){
	int sum = 0;
	int n;
	while(scanf("%d", &n)>0){
		/*
		sum = 0;
		for(int i=0; i<10; i++){
			for(int j=0; j<10; j++){
				for(int k=0; k<10; k++){
					for(int l=0; l<10; l++){
						if(i+j+k+l==n) sum++;
					}
				}
			}
		}
		printf("%d\n", sum);
		*/
		cout << saiki(n, 0, 0) << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    tmd = collections.defaultdict(list)
    cl = collections.defaultdict(int)
    for i in range(n-1):
        tma, tmb, tmc = list(map(int, readline().split()))
        tmd[tma-1] += [tmb-1]
        tmd[tmb-1] += [tma-1]
        cl[tma-1, tmb-1] = tmc
        cl[tmb-1, tma-1] = tmc
    q, k = list(map(int, readline().split()))

    ql = [[0, k-1]]
    ql = collections.deque(ql)
    fq = collections.defaultdict(int)
    fq[k-1]
    while True:
        if len(ql) != 0:
            cost, tmp = ql.popleft()
            for tmv in tmd[tmp]:
                if tmv not in fq:
                    ql.append([cost + cl[tmv, tmp], tmv])
                    fq[tmv] = cost + cl[tmv, tmp]
                elif cost + cl[tmv, tmp] < fq[tmv]:
                    fq[tmv] = cost + cl[tmv, tmp]
        else:
            break
    for i in range(q):
        x, y = list(map(int, readline().split()))
        print(fq[x-1] + fq[y-1])


if __name__ == '__main__':
    solve()


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

using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int arr[51];
int main(){
  int n,cp=0;cin>>n;
  for(int i=1;i<=n;i++){
    cin>>arr[i];
    if(arr[i]!=i)
      cp++;
  }
  if(cp<=2)
    cout<<"YES";
  else
    cout<<"NO";
  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define fastio (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long int;
using namespace std;

int main() {
    fastio;
    string s;
    cin >> s;
    cout << s[0] << s[1] << s[2];
}

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

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  int total = 0;
  for(int i = 1; i <= n; i++){
    int sum = 0, temp = i;
    while(temp > 0){
      sum += temp % 10;
      temp /= 10;
    }
    if(sum >= a && sum <= b){
      total += i;
    }
  }
  cout << total << endl;
  return 0;
}

Measured memory_bytes: 3620