akhauriyash/Code-Regression huggingface dataset:
/*
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
typedef mp::cpp_int mint; //*/
#include <bits/stdc++.h>
#define  re(i,j,n) for(li i=(j);i<(n);i++)
#define  rep(i,n) re(i,0,(n))
#define  red(i,n) for(li i=n-1;i>=0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;


int main()
{
    int n;
    cin>>n;
    int x[26][n];
    rep(i,26)rep(j,n)x[i][j]=0;
    string s;
    rep(i,n){
        cin>>s;
        for(char c:s) x[c-'a'][i]++;
    }
    rep(i,26) {
        int m=x[i][0];
        rep(j,n) m=min(m,x[i][j]);    
        rep(k,m) cout<<(char)(i+'a');
    }
    cout<<endl;
//    rep(i,26){rep(j,n)cout<<x[i][j]<<" "; cout<<endl;}
    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 rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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


    map<int, ll> freq;
    rep(i, n) freq[a[i]]++;

    map<int, ll> m1, m2;
    for (auto kv: freq) {
        int k = kv.first;
        ll v = kv.second;
        m1[k] = v * (v-1) / 2;
        m2[k] = (v - 1) * (v - 2) / 2;
    }

    ll sum = 0;
    for (auto kv: m1) {
        sum += kv.second;
    }

    rep(i, n) {
        cout << sum - m1[a[i]] + m2[a[i]] << endl;
    }
}


Measured memory_bytes: 26112
#include <bits/stdc++.h>
using namespace std;
//int dp[100000];
//char b[100000][26];

/*int cmp(int i,int j)
{
    //int flag=1;
    for(int k=0;k<26;k++)
        if(b[i][k]!=b[j][k])
            return 1;
    return 0;
}*/

int main()
{
    int n,i,j,k;
    long long t,t1,sum=0;
    char c;
    cin>>n;
    string a;
    unordered_map <string,long long> mp;
    for(i=0;i<n;i++)
    {
        cin>>a;
        for(j=0;j<10;j++)
            for(k=0;k<10;k++)
            if(a[j]<a[k])
        {
            c=a[j];
            a[j]=a[k];
            a[k]=c;
        }
        t=mp[a]++;
        t1=t+1;
        sum-=(long long)(t*(t-1))/(long long)2;
        sum+=(long long)(t1*(t1-1))/(long long)2;
    }
     cout<<sum;
	return 0;
}


Measured memory_bytes: 10660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    vector<pair<int, int>> a(n);
    FOR(i, 0, n) {
        cin >> a[i].first;
        a[i].second = i;
    }
    rSORT(a, (greater<pair<int, int>>()));

    ll ans = 0;
    auto dp = vec<ll>(n + 1, n + 1);
    eFOR(i, 0, n)eFOR(j, 0, n) {
        if (i + j == n) {
            chmax(ans, dp[i][j]);
            break;
        }
        chmax(dp[i + 1][j], dp[i][j] + ll(a[i + j].first) * abs(a[i + j].second - i));
        chmax(dp[i][j + 1], dp[i][j] + ll(a[i + j].first) * abs(a[i + j].second - n + j + 1));
    }

    cout << ans << "\n";
}

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

int main() {
  int A,B,N,W;
  cin >>N>>W;
  vector<long long>a(N),b(N);
  long long dp[N+1][W+1];
 for(int i=0;i<N;i++){
   cin>>a[i]>>b[i];
 }
  for(int i=0;i<W+1;i++){
    dp[0][i]=0;
  }
   for(int i=1;i<N+1;i++){
     for(int j=0;j<W+1;j++){
       if(j-a[i-1]<0){
         dp[i][j]=dp[i-1][j];
       }
       else{
       dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i-1]]+b[i-1]);
       }
 }
   }
  cout<<dp[N][W]<<endl;
}

Measured memory_bytes: 79104
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <iomanip>

using namespace std;
typedef long long ll;

//定義場所//
int i, j, k, l, m, n;
int W, N, K, M;
int dp[110000];
int sum[110000];
////////////

int main()
{
	cin >> N;
	vector<ll> A(N);
	ll ans = 0;
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	ll right = 0;
	ll sum = 0;
	for (ll left = 0; left < N; left++) {
		while (right < N && (sum ^ A[right]) == (sum + A[right])) {
			sum += A[right];
			right++;
		}
		ans += right - left;
		if (left == right) {
			right++;
		}
		else {
			sum -= A[left];
		}
	}
	cout << ans;

}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

#define BV_SIZE 64ULL // 64bit
#define MAX_BV_NUM 100 // m <= 100*64 = 6400

unsigned long long Peq[MAX_BV_NUM][0x100];
int levenshteinDistance(string a,string b) {
  int m=a.size(),n=b.size();
  int num_of_bv = (m + BV_SIZE -1) / BV_SIZE;

  for (int i = 0; i < m; i++) {
    Peq[i / BV_SIZE][a[i]] |= 1ULL << ((unsigned long long)i % BV_SIZE);
  }

  int score = m;
  unsigned long long Pv[MAX_BV_NUM], Mv[MAX_BV_NUM], Ph[MAX_BV_NUM], Mh[MAX_BV_NUM], Xv[MAX_BV_NUM], Xh[MAX_BV_NUM], Eq[MAX_BV_NUM], Xt[MAX_BV_NUM], Xa[MAX_BV_NUM];
  unsigned long long top = 1ULL << (((unsigned long long)m - 1ULL) % BV_SIZE);

  for(int i = 0; i < num_of_bv; i++) {
    Pv[i] = ~0ULL; Mv[i] = 0ULL;
  }

  for (int j = 0; j < n; j++) {
    for(int i = 0; i < num_of_bv; i++){
      Eq[i] = Peq[i][b[j]];
      Xv[i] = Eq[i] | Mv[i];
      Xt[i] = Eq[i] & Pv[i];
    }

    unsigned long long carry = 0ULL;

    for(int i = 0; i < num_of_bv; i++){
      Xa[i] = Xt[i] + Pv[i] + carry;

      unsigned long long cXt = Xt[i] + carry;
      carry = ((((Xt[i] & carry) | ((Xt[i] | carry) & ( ~ (Xt[i] + carry) ))) >> 63ULL) & 1ULL) | ((((cXt & Pv[i]) | ((cXt | Pv[i]) & ( ~ (cXt + Pv[i]) ))) >> 63ULL) & 1ULL);
    }

    for(int i = 0; i < num_of_bv; i++){
      Xh[i] = (Xa[i] ^ Pv[i]) | Eq[i];

      Ph[i] = Mv[i] | ( ~ (Xh[i] | Pv[i]) );
      Mh[i] = Pv[i] & Xh[i];
    }

    if((Ph[num_of_bv - 1] & top) != 0ULL)score++;
    else if((Mh[num_of_bv - 1] & top) != 0ULL)score--;    

    unsigned long long Ph_carry = 1ULL;
    unsigned long long Mh_carry = 0ULL;

    for(int i = 0; i < num_of_bv; i++){
      unsigned long long nxt_Ph_carry = (Ph[i] >> 63ULL) & 1ULL;
      Ph[i] = (Ph[i] << 1ULL) | Ph_carry;
      Ph_carry = nxt_Ph_carry;

      unsigned long long nxt_Mh_carry = (Mh[i] >> 63ULL) & 1ULL;
      Pv[i] = ((Mh[i] << 1ULL) | Mh_carry ) | ( ~ (Xv[i] | Ph[i]) );
      Mh_carry = nxt_Mh_carry;

      Mv[i] = Ph[i] & Xv[i];
    }

  }
  return score;
}

int main(){
	string a,b;
  cin>>a>>b;
  cout<<levenshteinDistance(a,b)<<endl;
	return 0;
}

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

typedef long long ll;

const ll MOD = 1000000007;

ll modpow(ll x,ll k){
	if(k == 0)return 1;
	ll ret = modpow(x,k/2);
	ret *= ret; ret %= MOD;
	if(k%2 == 1){
		ret *= x;
		ret %= MOD;
	}
	return ret;
}

vector<ll> div(ll n){
	vector<ll> ret;
	ret.push_back(1);
	for(int i = 2 ; n != 1 ; i ++){
		if(n%i == 0){
			int cnt = 0;
			do {
				n /= i;
				cnt ++;
			}while(n%i == 0);
			int sz = ret.size();
			for(int j = 0 ; j < sz ; j ++){
				ll t = ret[j];
				for(int k=0;k<cnt;k++){
					t*=i;
					ret.push_back(t);
				}
			}
		}
	}
	return ret;
}

int main(){
	ll s;
	cin >> s;
	
	ll ret = 0;
	ll l=0,r=1,sum=0;
	ll x=0,y=1;
	ll POW[12];
	POW[0]=1;
	for(int i=1;i<12;i++){
		POW[i]=POW[i-1]*10;
	}
	while(l+1<POW[7]){
		l++;
		sum-=x;
		if(l==POW[x])x++;
		while(sum<s){
			r++;
			sum+=y;
			if(r==POW[y])y++;
		}
		if(sum==s)ret++;
	}
	
	vector<ll> d=div(s);
	for(ll x: d){
		if(x<=s/8)ret--;
		if(x>=8)ret+=9*modpow(10,x-1)+MOD-(s/x)+1;
	}
	ret+=s/8;
	cout<<ret%MOD<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back



map<pii,int> edgecolor;
vector<pii> data;
vector<vi> to(100005,vi(0));




void dfs(int node, int used){
  int color=1;
  for (int next:to.at(node)){
    if (color==used){
      color++;
    }
    
    int smaller=min(node,next);
    int bigger=max(node,next);
    auto edge=make_pair(smaller,bigger);
    if (edgecolor.find(edge)!=edgecolor.end()){
      continue;
    }
    edgecolor[edge]=color;
    dfs(next,color);
    color++;
  }
}



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

  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    auto tmp=make_pair(a,b);
    data.pb(tmp);
  }
  
  
  rep(i,n-1){
    int a=data.at(i).first;
    int b=data.at(i).second;
    to.at(a).pb(b);
    to.at(b).pb(a);
  }

  
  dfs(1,0);
  
  vi answers(0);
  
  int maxcolor=0;
  
  rep(i,n-1){
    int color=edgecolor.at(data.at(i));
    answers.pb(color);
    maxcolor=max(maxcolor,color);
  }
  
  cout<<maxcolor<<endl;
  for (int answer:answers){
    cout<<answer<<endl;
  }

  
}




















Measured memory_bytes: 14584
import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n=int(input())
m=[]
for i in range(n):
  a=list(map(int,input().split()))
  a.reverse()
  m.append(a)
ans=0
count=0
failflag=0
previous=set()
for i in range(n):
  previous.add(i)
while count<(n*(n-1)):
  ans+=1
  tempcount=count
  r=set()
  for i in previous:
    if m[i]:
      t=m[i][-1]
      if m[t-1]:
        if m[t-1][-1]==i+1:
          count+=1
          r.add(i)
          r.add(t-1)
  previous=set()
  for k in r:
    m[k].pop()
    previous.add(k)
    if m[k]:
      previous.add(m[k][-1]-1)
  if tempcount==count:
    failflag=1
    break
if failflag==1:
  print(-1)
else:
  print(ans)
    


Measured memory_bytes: 64588
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int r , g ,b ;
    cin >> r >> g >> b;
    if( (g*10+b) % 4 == 0 ){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

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

int main() {
  int c1, c5, c10, c50, c100, c500;
  cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;

  int sum = c1 + 5 * c5 + 10 * c10 + 50 * c50 + 100 * c100 + 500 * c500;

  if (sum >= 1000) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 3096
n = gets.chomp.to_i

strs = Hash.new(0)
ans = 0
n.times do
    str = gets.chomp.split("").sort.join("")
    appearance = strs[str]
    if appearance == 0
        strs[str] = 1
    else
        ans += appearance
        strs[str] += 1
    end
end
puts ans


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

using namespace std;

typedef long long ll;

int main(){
  ll N,K,i;
  ll A[222222];
  cin >> N >> K;
  for(i=1;i<=N;i++)
    cin >> A[i];
  for(i=K+1;i<=N;i++){
    if(A[i]>A[i-K]) cout << "Yes" << endl;
    else cout << "No" << endl;
    }
}

Measured memory_bytes: 5168
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< string, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789


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

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

int N;
int A[212345];
int M = 0;
int B[212345];
int ans[212345];

int main(){
    
    cin>>N;
    REP( i, N ) cin>>A[i];
    REP( i, N ) B[i] = 0;
    int s = N;
    
    while( s ){
        int num = 0;
        for( int idx = s; idx <= N; idx += s ){
            num += B[idx-1];
        }
        s--;
        if( num % 2 != A[s] ){
            B[s]++;
            ans[M++] = s+1;
        }
    }
    
    cout<<M<<endl;
    while( M-- ){
        cout<<ans[M];
        if( M ) cout<<" ";
        else{   cout<<endl;}
    }
    
    return 0;
}



Measured memory_bytes: 2944
#include<iostream>
#include<string>
#include<vector>

struct Stack{
	std::vector<int> nums;
	int stack_ptr,ptr_max;
};

void push(int x,Stack &s){
	if(s.stack_ptr<=s.ptr_max){
		s.nums[s.stack_ptr++]=x;
	}else{
		s.nums.push_back(x);
		s.stack_ptr++;
		s.ptr_max++;
	}
}

int pop(Stack &s){
	s.stack_ptr--;
	return s.nums[s.stack_ptr];
}

int main(){
	Stack s;
	s.stack_ptr=0;
	s.ptr_max=-1;
	std::string ch;
	while(std::cin>>ch){
		if(ch=="+"){
			push(pop(s)+pop(s),s);
		}else if(ch=="-"){
			int a=-pop(s),b=pop(s);
			push(a+b,s);
		}else if(ch=="*"){
			push(pop(s)*pop(s),s);
		}else{
			int x=0,size=ch.size();
			for(int i=0;i<size;i++){
				x*=10;
				x+=ch[i]-'0';
			}
			push(x,s);
		}
	}
	std::cout<<s.nums[s.stack_ptr-1]<<'\n';
	return 0;
	
}


Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
#define sync ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main(){
	sync
	int n,k;
	cin >> n >> k;
	if((n/2+n%2)>=k) cout  << "YES\n";
	else cout << "NO\n";
	return 0;
}

Measured memory_bytes: 384
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

//nCr mod m
#define MOD 1000000007
#define M 2200000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(n<0||r<0||n<r)return 1;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return out;
}
vvp G;
int n,ma;
vi out;
void dfs(int a,int p,int w){
	int c=1;
	rep(i,G[a].size())if(G[a][i].first-p){
		pii to=G[a][i];
		if(c==w)c++;
		out[to.second]=c;
		cmax(ma,c);
		dfs(to.first,a,c);
		c++;
	}
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

    cin>>n;
    G=vvp(n);
	out=vi(n-1);
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].pb({b,i});
        G[b].pb({a,i});
    }
    dfs(0,-1,0);
	cout<<ma<<endl;
	rep(i,n-1)cout<<out[i]<<endl;
}


Measured memory_bytes: 9856
#include<iostream>
#include<cstdio>
#include<cstdlib>
//#include<>                                                                                
using namespace std;

#define MOD 1000000007

long long pow_rem(long long m,long long n)
{
  if(n==1)return m;
  long long v;
  v=pow_rem(m,n/2)%MOD;
  if(n%2==0)
    return (v*v)%MOD;
  else return ((v*v)%MOD*m)%MOD;
}
int main(){
  long long n,m,ans=1;
  cin >>m>>n;
  cout<<pow_rem(m,n)<<endl;
  return 0;
}

Measured memory_bytes: 1160
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

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

func main() {
	n, err := strconv.Atoi(input())
	if err != nil {
		log.Fatal(err)
	}

	a := make([]int, n)
	for i, _ := range a {
		a[i], err = strconv.Atoi(input())
		if err != nil {
			log.Fatal(err)
		}
	}

	count := 0
	for ; ; count++ {
		for i, v := range a {
			if v % 2 == 1 {
				fmt.Println(count)
				return
			}
			a[i] = v / 2
		}
	}
	
	fmt.Println(count)
}


Measured memory_bytes: 640
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back

#define rep(i, N) for(ll i = 0; i < N; i++)
#define repa(i, a, N) for(ll i = a; i < N; i++)
#define repr(i, N) for(ll i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

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

const double PI = 3.141592653589793;

// const ll mod = 1e9 + 7;
const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

ll id(char c) {
	return c - 'a';
}

bool isOK(vi& a, ll k, ll index) {
	return a[index] < k * (index + 1);
}

ll binary_search(vi& a, ll k) {
	ll left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	ll right = (ll)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		ll mid = left + (right - left) / 2;

		if (isOK(a, k, mid))
			right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}

template<class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
	return os << "{" << p.first << "," << p.second << "}";
}

template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
	os << "{";
	for (auto e : v)os << e << ",";
	return os << "}";
}

ll dp[3001][3001];

int main() {
	ll N, T;
	cin >> N >> T;

	vector<pll> AB(N);

	rep(i, N) {
		cin >> AB[i].first >> AB[i].second;
	}

	sort(all(AB));
	rep(i, T+1) {
		dp[0][i] = 0;
	}

	rep(i, N) {
		ll a = AB[i].first;
		ll b = AB[i].second;

		rep(t, T) {
			if (t >= a) {
				dp[i + 1][t] = max(dp[i][t - a] + b, dp[i][t]);
			}
			else {
				dp[i + 1][t] = dp[i][t];
			}
		}
	}

	ll m = 0;
	rep(i, N) {
		m = max(m, dp[i][T - 1] + AB[i].second);
	}

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 70656
#include <stdio.h>
#include <stdlib.h>
int diffrence (int arr[],int size,int k){
int i,j;
int diff=k;
for(i=0;i<size;i++){
    for(j=1;j<size;j++){
        if(arr[j]-arr[i]>diff)
            diff=arr[j]-arr[i];

    }
}
return diff;
}
int main(){
int input;
int diff;
int arr[6];
for(int i=0;i<6;i++){
    scanf("%d",&input);
    arr[i]=input;
};
diff=diffrence(arr,6,arr[5]);
if(diff>arr[5])
    printf(":(");
else
    printf("Yay!");
return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define int long long int 
#define fi first
#define se second
#define FIO {ios::sycnt2_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#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 all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1"+string(n,'0'))
//fill(all(arr),1)
//if(map.count(key)){}
//bitset<20>(n);
//int mini=min({a,b,c,d,e});
#define int long long int
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 long double ld;
int32_t main()
{
  int d,t,s;
  cin>>d>>t>>s;
  double n=(double)d/s;
  double h=(double)t;
  //cout<<h+1;
  if((double)n<=(double)h)cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 3632
n = int(input())
p = [int(i) for i in input().split()]

c = 0
for i in range(n-2):
	p1 = p[i]
	p2 = p[i+1]
	p3 = p[i+2]
	r = sorted([p1,p2,p3])
	if r[1] == p2:
		c+=1
print(c)

Measured memory_bytes: 3060
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#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>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
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;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int A[100010];
signed main() {
    int N; cin >> N;
    for(int i=0; i<N; i++) {
        cin >> A[i];
    }

    sort(A, A+N, greater<int>());
    
    int ans = 0;
    if(N % 2 == 0) {
        for(int i=0; i<N; i++) {
            if(i < N / 2) {
                ans += 2 * A[i];
                if(i == N/2 - 1) ans -= A[i];
            }
            else {
                ans -= 2 * A[i];
                if(i == N/2) ans += A[i];
            }
        }
    }
    else {
        int tmpA = 0, tmpB = 0;
        for(int i=0; i<N; i++) {
            // tmpA: 小さいほうが多い
            if(i < N / 2) {
                tmpA += 2 * A[i];
            }
            else {
                tmpA -= 2 * A[i];
                if(i < N / 2 + 2) tmpA += A[i];
            }

            // tmpB: 大きいほうが多い
            if(i < N / 2 + 1) {
                tmpB += 2 * A[i];
                if(i >= N / 2 - 1) tmpB -= A[i];
            }
            else {
                tmpB -= 2 * A[i];
            }
        }
        ans = max(tmpA, tmpB);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>
#include <array>

using namespace std;

template<typename M, typename N>
istream& operator>>(istream&is, pair<M,N> & p){is >> p.fi >> p.se; return is;}
template<typename M>
istream& operator>>(istream&is, vector<M> & v){for(auto &it:v) is >> it; return is; }
template<typename M>
istream& operator>>(istream&is, vector<vector<M>> & v){for(auto &it:v) is >> it; return is; }
template<typename M, typename N>
ostream& operator<<(ostream&os, const pair<M,N> &p){os << p.fi << ' ' << p.se << '\n';return os;}
template<typename M>
ostream& operator<<(ostream&os, const vector<M> &v){for(auto it: v)os << it << ' ';cout << '\n';return os;}
template<typename M>
ostream& operator<<(ostream&os, const vector<vector<M>> &v){for(auto it: v)os << it;return os;}

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mn(x) *min_element((x).begin(),(x).end())
#define mx(x) *max_element((x).begin(),(x).end())
#define acc(x) accumulate((x).begin(),(x).end(),0ll)
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef  unsigned long long  ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

const ld pi=acos(-1);
const ll inf=(ll)1e9;
const int mod=1000000007;
//const int mod=998244353;

int n,m,k;
const int N=2010;



ll pow(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}


int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll n;
    cin >> n;
    if(n==1){
        cout << 0 << el;
    }
    else if(n==2){
        cout << 2 << el;
    }
    else {
        cout << (pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod)+2*mod)%mod << el;
    }
    return 0;
}







Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	dump(min(a * n, b));
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

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

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t x;
  cin >> x;
  
  int64_t blance = 100;
  int64_t year = 0;
  while(x>blance){
    blance += blance/100;
    year++;
  }

  cout << year << endl;
  return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll INF=1e18;
int n,m,q;
vector<int>a,b,c,d;
int ans;


void dfs(vector<int> A){
  if(A.size()==n+1){
    int now=0;
    rep(i,q){
      if(A[b[i]]-A[a[i]]==c[i]) now +=d[i];
    }
    ans=max(ans, now);
    
   return;
  }
  
  A.push_back(A.back());
  while(A.back()<=m){
    dfs(A);
    A.back()++;
  }
}
    



int main(){
  cin >>n>>m>>q;
  a=b=c=d=vector<int>(q);
  
  rep(i,q){
   cin>>a[i]>>b[i]>>c[i]>>d[i]; 
  }
  
  dfs(vector<int>(1,1));
  cout<<ans <<endl;
  return 0;
  

  
 

}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;

  vector<tuple<string, int, int>> sp;

  for (int i = 1; i <= n; i++) {
    string s;
    int p;

    cin >> s >> p;
    sp.push_back(make_tuple(s, -p, i));
  }
  sort(sp.begin(), sp.end());

  for (int i = 0; i < n; i++) {
    cout << get<2>(sp[i]) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
int main()
{
    int i;
    char s1[1000],s2[1000],s3[1000],a[3];
    scanf("%s",s1);
    scanf("%s",s2);
    scanf("%s",s3);
       a[0]=toupper(s1[0]);
       a[1]=toupper(s2[0]);
       a[2]=toupper(s3[0]);
       a[3]='\0';
    printf("%s",a);
    
    
}

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

//a[n]=a[n-1]+a[n-2]+a[n-3]を求める関数

int f(int n){  //再帰関数
   if(n==1) return 1;
   if(n==2) return 2;
   if(n==3) return 4;
   //f(n)=f(n-1)+f(n-2)+f(n+3);
   return f(n-1)+f(n-2)+f(n-3);
}

int main(void){
   while(true){
       int n;
       cin >> n;
       if(n==0)break;
       cout << (f(n)/3650)+1 << endl;
   }
}


Measured memory_bytes: 2988
import sys
input = sys.stdin.buffer.readline

class Combination:
    def __init__(self, size, mod=10**9 + 7):
        self.size = size + 2
        self.mod = mod
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % self.mod
            self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.mod

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % self.mod

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % self.mod) % self.mod

    def nhr(self, n, r):  # 重複組合せ
        return self.ncr(n + r - 1, n - 1)

    def factN(self, n):
        if n < 0:
            return 0
        return self.fact[n]

    def factInvN(self, n):
        if n < 0:
            return 0
        return self.factInv[n]

N = int(input())
MOD = 10**9 + 7
comb = Combination(N + 100)

edges = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    fr, to = map(int, input().split())
    edges[fr].append(to)
    edges[to].append(fr)

order = []
parent = [0] * (N + 1)
st = [1]
while st:
    now = st.pop()
    order.append(now)
    for to in edges[now]:
        if to == parent[now]:
            continue
        st.append(to)
        parent[to] = now

size = [1] * (N + 1)
for v in order[::-1]:
    size[parent[v]] += size[v]

dpLeaf = [1] * (N + 1)
for v in order[:: -1]:
    pr = parent[v]
    dpLeaf[v] = dpLeaf[v] * comb.factN(size[v] - 1) % MOD
    dpLeaf[pr] = dpLeaf[pr] * dpLeaf[v] * comb.factInvN(size[v]) % MOD

ans = [0] * (N + 1)
ans[1] = dpLeaf[1]
for v in order[1:]:
    pr = parent[v]

    x = ans[pr]
    x *= comb.factN(N - 1 - size[v]) * comb.factInvN(N - size[v])
    x *= size[v]
    ans[v] = x % MOD

print(*(ans[1:]), sep='\n')

Measured memory_bytes: 86544
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define sz(v) (ll)v.size()
#define vi vector<ll>
#define pi pair<ll,ll>
#define vpi vector<pair<ll,ll>>
using namespace std;

ll MOD=1e9+7;
ll g,h,l;
const ll N=100005, inf=1e9+5;

ll add(ll a,ll b); ll mul(ll a,ll b); ll binpo(ll a,ll b);

int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  ll n;cin>>n;
  ll arr[n];
  repn(i,n){
    cin>>arr[i];
  }
  sort(arr, arr+n);
  map<pair<pair<ll,ll>,ll>,ll> m;
  ll ans = 0;
  repn(i,n){
    rep(j,i+1,n-1){
      rep(k,j+1,n-1){
        if(arr[i]==arr[j] or arr[j]==arr[k])continue;
        vector<ll> v;
        v.push_back(arr[i]); v.push_back(arr[j]); v.push_back(arr[k]);
        sort(all(v));
        if(v[0]+v[1]>v[2]){
          // cout<<i<<" "<<j<<" "<<k<<endl;
          ans++;
          // m[{{v[0],v[1]},v[2]}];
        }
      }
    }
  }
  cout<<ans;
}

//1. Change N before submitting.
//2. Remove debug statements.

ll add(ll a,ll b)
{
  return (a%MOD+b%MOD)%MOD ;
}
ll mul(ll a,ll b)
{
  return (a* 1ll *b)%MOD ;
}
ll binpo(ll a,ll b)
{
  int ans = 1 ;
  while(b)
  {
    if( b % 2 != 0)
    {
      ans = mul(ans,a);
    }
    a = mul(a,a);
    b = b/2;
  }
  return ans;
}

Measured memory_bytes: 3604
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, M, X = map(int, input().split())
A = list(map(int, input().split()))

cnt = 0
for a in A:
    if a > X:
        break
    cnt += 1

print(min(cnt, M - cnt))

Measured memory_bytes: 3572
N = int(raw_input())
B = map(int, raw_input().split(' '))
A = [100000] * N

for i in range(0, N - 1):
    if A[i] > B[i]:
        A[i] = B[i]
    if A[i + 1] > B[i]:
        A[i + 1] = B[i]

print sum(A)


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

using namespace std;

#define TC ll t; cin >> t; while(t--)
typedef long long ll;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll n,m;
    cin >> n;
    m=n*(n+1)/2;
    for(int i=1;3*i<=n;i++)
    {
        m-=3*i;
        if(5*i<=n) m-=5*i;
        if(15*i<=n) m+=15*i;
    }
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 3608
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor.hpp>
#include <boost/icl/interval_map.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/multiprecision/cpp_int.hpp>
// ↓これいる？
#include <boost/graph/strong_components.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;
using namespace boost::numeric;
using namespace boost::multiprecision;
using ll = long long;
namespace bst = boost;
template<class T> void fill(T& v) { for (auto&& i : v) cin >> i; }

//#include "atcoder.hpp"

int main() {
    int N, T;
  
    
    cin >> N >> T;
    
    vector<pair<int, ll>> AB(N);
    REP(i,N)
      cin >> AB[i].first >> AB[i].second;
  
  bst::sort(AB);
    vector<ll> dp(T + 6002, -1);
  dp[0] = 0;
  
  ll r = 0;
    for (const auto& i : AB) {
      for (int j = T-1; j >= 0; j--) 
        if (dp[j] >= 0){
        dp[j + i.first] = max(dp[j+i.first], dp[j] + i.second);
        r = max(r, dp[j + i.first]);
      }
    }
    
  cout << r << endl;
    return 0;
}







Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ii, ii> iii;
ll MOD = 1e9 + 7;
const ld E = 1e-7;
#define null NULL
#define ms(x) memset(x, 0, sizeof(x))
#ifndef LOCAL
#define endl "\n"
#endif
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define _read(x) freopen(x, "r", stdin)
#define _write(x) freopen(x, "w", stdout)
#define files(x) _read(x ".in"); _write(x ".out")
#define filesdatsol(x) _read(x ".DAT"); _write(x ".SOL")
#define output _write("output.txt")
#define input _read("input.txt")
#define mod % MOD
#define y1 hello_world
unsigned char ccc;
bool _minus = false;
template<typename T>
inline T sqr(T t) {
	return (t * t);
}
inline void read(ll &n) {
	n = 0;
	_minus = false;
	while (true) {
		ccc = getchar();
		if (ccc == ' ' || ccc == '\n')
			break;
		if (ccc == '-') {
			_minus = true;
			continue;
		}
		n = n * 10 + ccc - '0';
	}
	if (_minus)
		n *= -1;
}
inline void read(int &n) {
	n = 0;
	_minus = false;
	while (true) {
		ccc = getchar();
		if (ccc == ' ' || ccc == '\n')
			break;
		if (ccc == '-') {
			_minus = true;
			continue;
		}
		n = n * 10 + ccc - '0';
	}
	if (_minus)
		n *= -1;
}
char wwww[19];
int kkkk;
inline void write(ll y) {
	long long x = y;
	kkkk = 0;
	if (!x)
		++kkkk, wwww[kkkk] = '0';
	else
		while (x) {
			++kkkk;
			wwww[kkkk] = char(x % 10 + '0');
			x /= 10;
		}
	for (int i = kkkk; i >= 1; --i)
		putchar(wwww[i]);
	putchar('\n');
}

#ifdef LOCAL
//#define DEBUG
#endif


int main() {
	srand(time(NULL));
	cout.precision(10);
	cout << fixed;
	sync;
#ifdef LOCAL
	input;
#else

#endif

	int n;
	cin >> n;
	ll ans = 0;
	int last = 0;
	for(int i = 0; i < n; i++){
		ll a;
		cin >> a;
		if(last && a){
			ans++;
			last = 0;
			a--;
		}
		ans += a / 2;
		last = a & 1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  char in[100000];
  char out[100000];
  int i,j;
  int f;

  scanf("%s",in);

  i=0;
  while(1){
    
    if(in[i] == 'd'){
      out[i]='d';
      out[i+1]='r';
      out[i+2]='e';
      out[i+3]='a';
      out[i+4]='m';
      f=0;
      j=i+5;
      for(;i<j;i++){
	if(in[i] != out[i]){
	  f=1;
	}
      }
      if(f==1){
	printf("NO\n");
	break;
      }
      if(in[i] == 'e' && in[i+1] == 'r'){
	if(in[i+2] != 'a'){
	  i+=2;
	}
      }
    }else if(in[i] == 'e'){
      out[i] = 'e';
      out[i+1]='r';
      out[i+2]='a';
      out[i+3]='s';
      out[i+4]='e';
      f=0;
      j=i+5;
      for(;i<j;i++){
	if(in[i] != out[i]){
	  f=1;
	}
      }
      if(f==1){
	printf("NO\n");
	break;
      }
      if(in[i] == 'r'){
	i+=1;
      }
    }else if(in[i] == '\0'){
      printf("YES\n");
      break;
    }else{
      printf("NO\n");
      break;      
    }
    
  }
  
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

int main(void){
  char S[100],T[100],tmp;
  scanf("%s", &S);
  scanf("%s", &T);
  int x = strlen(S), i, j;
  for(i=0; i<x; i++){
    if(strcmp(S, T) == 0){
      printf("Yes\n");
      break;
    }
    tmp = T[x-1];
    for(j=x-1; j>0; j--){
      T[j] = T[j-1];
    }
    T[0] = tmp;
  }
  if(i==x){
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

	
	int x,y,i;
	cin>>x>>y;
	for(i=1;i<3000;i++){
		if(x>y){
			swap (x,y);
		}
		
		cout<<x<<" "<<y<<endl;
		cin>>x>>y;
		if(x==0 && y==0)break;

	}



	return 0;
}


Measured memory_bytes: 2992
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
ll mod = 1e9 + 7;
ll fact[1000005];
ll suffix[1000005];
ll cnt[1000005];
ll binpow(ll a, ll b){
	if (b == 0) return 1;
	ll x = binpow(a, b / 2);
	x *= x; x %= mod;
	if (b % 2) return (x * a) % mod;
	else return x;
}
ll bindiv(ll a, ll b){
	ll inv = binpow(b, mod - 2);
	return (a * inv) % mod;
}
int main(){
	fact[0] = 1;
	for (ll i = 1; i < 1000005; i++) fact[i] = (fact[i - 1] * i) % mod;
	ll n; cin >> n;
	ll ans = 0;
	for (ll k = 0; k <= (n - 2) / 2; k++){
		ll u = fact[n - k - 1] * fact[n - k - 2]; u %= mod;
		ll d = fact[n - (2 * k) - 2]; suffix[k] = bindiv(u, d);
	}
	for (ll k = (n - 2) / 2; k >= 1; k--) cnt[k] = (suffix[k] - suffix[k + 1] + mod) % mod;
	for (ll k = 1; k <= (n - 2) / 2; k++) (ans += (cnt[k] * k)) %= mod;
	ans = ((n - 1) * fact[n - 1] - ans) % mod; 
	ans += mod; ans %= mod; cout << ans << endl;
}

Measured memory_bytes: 19584
#include<bits/stdc++.h>
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define per(i,n,j) for(int i=(n);i>=(j);i--)
using ll=long long;
using unll=unsigned long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF=1LL<<60;

ll n,k;

int main(){
    cin>>n>>k;
    vector<unll> a(n),sum(n+1);
    sum[0]=1;
    rep(i,0,n) cin>>a[i];
    rep(i,0,n-k){
        if(a[i]<a[i+k]) cout<<"Yes"<<"\n";
        else cout<<"No"<<"\n";
    }
    return 0;
}


Measured memory_bytes: 6424