akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
#include <sstream>
using namespace std;
const constexpr int INF = 1e9;
#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
struct Less{
   bool operator()(const pair<string, int>&a, const pair<string, int>&b){
        if(a.first==b.first){
            return a.second < b.second;
        }
       return a.first < b.first;
    }
};

ll extGCD(ll a, ll b, ll& x, ll& y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a/b*x;
    return d;
}
ll GCD(ll a, ll b){
    if(a<b) swap(a, b);
    if(b==0) return a;
    return GCD(b, a%b);
}
int par[100010], rr[100010];
void init(){
    for(int i=0; i<100010; ++i){
        par[i]=i;
        rr[i]=0;
    }
}
int root(int x){
    return par[x] == x ? x:par[x] = root(par[x]);
}
bool same(int x, int y){
    return root(x)==root(y);
}
void unite(int x, int y){
    x = root(x);
    y = root(y);
    if(x==y) return ;
    
    if(rr[x]<rr[y]){
        par[x] = y;
    }else{
        par[y] = x;
        if(rr[x]==rr[y]) rr[x]++;
    }
}

ll pow_mod(ll x, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res*x%MOD;
        }
        x = x*x%MOD;
        n>>=1;
    }
    return res;
}
int arr[100010];
int main() {
    int N; cin >> N;
    REP(i, N){
        int a; cin >> a;
        arr[a]++;
    }
    if(N%2==0){
        ll ans=1;
        for(int i=1; i<=N-1; i+=2){
            if(arr[i]==2){
                ans =(ans* 2)%MOD;
            }else{
                cout << 0 << endl;
                return 0;
            }
        }
        cout << ans << endl;
    }else{
        ll ans=1;
        if(arr[0]!=1){
            cout << 0 << endl;
            return 0;
        }
        for(int i=2; i<=N-1; i+=2){
            if(arr[i]==2){
                ans =(ans* 2)%MOD;
            }else{
                cout << 0 << endl;
                return 0;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

void solve() {
    int N;
    cin >> N;
    int min_P, ans;
    min_P  = INT_MAX;
    ans = 0;
    for (int i = 0; i < N; i++) {
        int P;
        cin >> P;
        min_P = min(min_P, P);
        if(min_P == P) ans++;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  ll a,b,x;cin >> a >> b >> x;
  ll num = b/x - a/x;
  if(a%x==0)++num;
  cout << num << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int []a = new int[N];
		for(int i =0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		int max=a[0];
		int min=a[0];
		for(int i=1;i<N;i++) {
			if(max<a[i]) {
				max=a[i];
			}
		}
		for(int i=1;i<N;i++) {
			if(min>a[i]) {
				min=a[i];
			}
		}
		int ans = max-min;
      System.out.println(Math.abs(ans));
	}
}


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

#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define debg(a) cout<<#a<<":"<<a<<endl;
#define print(a) cout<<a<<endl;
#define end cout<<endl;
#define elif else if


int a,b,c,i,j,k,n,m,x,y,z;
str s,t;
vector<signed> v;

signed main(){
  
  int n,k;
  cin>>n>>k;
  int ans=(n-1)/2+1;
  cout<<(ans>=k?"YES":"NO")<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
using namespace std;

int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {

    if(b%2 == 0)
    {
        int s = 0;
        s = a + b/2;
        printf("%d\n",s);
    }
    else
    {
        double s ;
        double c = 1.0*b/2;
        s = a + c;
        printf("%.1f\n",s);
    }


    }

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,i;
    string s;
    cin >> n;
    cin >> s;
    int count=0;
    for(i=0;i<n-2;i++){
        if(s[i]=='A' and s[i+1]=='B' and s[i+2]=='C')
            count++;
    }
    cout << count << endl;
    return 0;
}

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


int main () {

	int a;
	int ans;
	while (cin>>a && a) {
		ans=0;
		if(a<=36){
			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)==a)
								ans++;
						}
					}
				}
			}
				
		}
		cout << ans <<endl;
	}
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+100;
#define ll long long

ll check(ll h,ll w){
    if(h%3==0)return 0;
    ll ans=1e9;
    for(ll i=1;i<h;i++){
        ll a=i*w,b=(h-i)*(w/2),c=(h-i)*(w-w/2);
        ll m=max(a,max(c,b))-min(a,min(c,b));
        ans=min(ans,m);
    }
    return min(h,ans);
}

int main(){
    ll h,w;
    cin>>h>>w;
    cout<<min(check(h,w),check(w,h));
}

//Persist for love.


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool f = false;
    for(char c : s){
        if(c=='C')f=true;
        if(c=='F'&&f){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var N int

	fmt.Scanf("%d", &N)

	C := make([]int, N-1)
	S := make([]int, N-1)
	F := make([]int, N-1)

	for i := 0; i < N-1; i++ {
		fmt.Scanf("%d %d %d", &C[i], &S[i], &F[i])
	}

	for i := 0; i < N; i++ {
		var time = 0

		for j := i; j < N-1; j++ {
			if time < S[j] {
				time = S[j]
			} else {
				wait := (time - S[j]) % F[j]
				time += (F[j] - wait) % F[j]
			}

			time += C[j]
		}

		fmt.Println(time)
	}
}


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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
    ll i, j;
    ll N;
    cin >> N;
    vll A(N);
    for(auto &e : A)
        cin >> e;
    ll m = 1000;
    ll k = 0;
    ll bv;
    for(i = 0; i < N; i++) {
        if(k > 0 && A[i] > bv) {
            m += k * A[i];
            k = 0;
        }
        if(k == 0) {
            bool buy = false;
            for(j = i + 1; j < N; j++) {
                if(A[j] < A[i]) {
                    break;
                }
                if(A[j] > A[i]) {
                    buy = true;
                    break;
                }
            }
            if(buy) {
                k += m / A[i];
                m -= k * A[i];
                bv = A[i];
            }
        }
    }
    cout << m << endl;

    return 0;
}


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

int main(){
  int n;
  cin >> n;
  int ac = 0;
  int wa = 0;
  int tle = 0;
  int re = 0;
  vector<string>a(n);
  for(int i = 0; i<n; i++) cin >> a.at(i);
  
  for(int i = 0; i<n; i++){
    if(a.at(i) == "AC") ac++;
    else if(a.at(i) == "WA") wa++;
    else if(a.at(i) == "TLE") tle++;
    else if(a.at(i) == "RE") re++;
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}

Measured memory_bytes: 6420
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s;
    cin >> s;
    int cnt = 0;
    REP(i,0,s.size()) if (s[i] == 'x') ++cnt;
    if (cnt < 8) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

Measured memory_bytes: 256
$N=<>;
@T=(0,(glob<>),0);
@A=(0,(glob<>),0);
$x=1;
$d[$_]=$T[$_-1]<$T[$_]for 1..$#T-1;
for($i=$#T-1;$i;--$i){
	$A[$i]==$T[$#T-1]&&$T[$i]==$T[$#T-1]&&++$f;
	$d[$i]|=$A[$i]>$A[$i+1]
}
$d[$_]or$x=($x*($T[$_]<$A[$_]?$T[$_]:$A[$_]))%1000000007for 1..$#T-1;
print$x*($f&&$T[$#T-1]==$A[1]),$/

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

using namespace std;

const int INF = 1e9;

int n, c, cost[35][35], mat[505][505], s[3][35];

int main(){
	scanf("%d%d", &n, &c);
	
	for(int i = 1; i <= c; i++){
		for(int j = 1; j <= c; j++)
		scanf("%d", &cost[i][j]);
	}
	
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++)
		scanf("%d", &mat[i][j]);
	}
	
	int res = INF;
	
	for(int k = 0; k < 3; k++){
		for(int ii = 1; ii <= c; ii++){
			int tot = 0;
			for(int i = 1; i <= n; i++){
				for(int j = 1; j <= n; j++){
					if((i + j) % 3 != k) continue;
					tot += cost[mat[i][j]][ii];
				}
			}
			s[k][ii] = tot;
		}
	}
	
	for(int i = 1; i <= c; i++){
		for(int j = 1; j <= c; j++){
			for(int k = 1; k <= c; k++){
				if(i != j && j != k && i != k)
				res = min(res, s[0][i] + s[1][j] + s[2][k]);
			}
		}
	}
	
	printf("%d\n", res);
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define MAXN	200005
#define MAXP	400005
#define INF	1e9
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
struct Segment_Tree {
	int lc[MAXP], rc[MAXP];
	int tag[MAXP], maxnum[MAXP];
	int n, size, root;
	void update(int root) {
		maxnum[root] = max(maxnum[lc[root]], maxnum[rc[root]]);
	}
	void pushdown(int root) {
		if (tag[root] == 0) return;
		tag[lc[root]] += tag[root];
		maxnum[lc[root]] += tag[root];
		tag[rc[root]] += tag[root];
		maxnum[rc[root]] += tag[root];
		tag[root] = 0;
	}
	void build(int root, int l, int r) {
		if (l == r) {
			maxnum[root] = l - n;
			return;
		}
		int mid = (l + r) / 2;
		lc[root] = ++size;
		build(lc[root], l, mid);
		rc[root] = ++size;
		build(rc[root], mid + 1, r);
		update(root);
	}
	void build(int x) {
		n = x;
		size = root = 0;
		build(root, 0, n);
	}
	void modify(int root, int l, int r, int ql, int qr) {
		if (l == ql && r == qr) {
			tag[root]++;
			maxnum[root]++;
			return;
		}
		pushdown(root);
		int mid = (l + r) / 2;
		if (mid >= ql) modify(lc[root], l, mid, ql, min(mid, qr));
		if (mid + 1 <= qr) modify(rc[root], mid + 1, r, max(mid + 1, ql), qr);
		update(root);
	}
	void modify(int l, int r) {
		modify(root, 0, n, l, r);
	}
	int query(int root, int l, int r, int ql, int qr) {
		if (l == ql && r == qr) return maxnum[root];
		int ans = -INF, mid = (l + r) / 2;
		pushdown(root);
		if (mid >= ql) ans = max(ans, query(lc[root], l, mid, ql, min(qr, mid)));
		if (mid + 1 <= qr) ans = max(ans, query(rc[root], mid + 1, r, max(mid + 1, ql), qr));
		return ans;
	}
	int query(int l, int r) {
		return query(root, 0, n, l, r);
	}
} ST;
vector <int> a[MAXN];
int main() {
	int n, m;
	read(n), read(m);
	for (int i = 1; i <= n; i++) {
		int x, y;
		read(x), read(y);
		a[x].push_back(y);
	}
	int ans = n - m;
	ST.build(m + 1);
	for (int i = 0; i <= m; i++) {
		for (unsigned j = 0; j < a[i].size(); j++)
			ST.modify(0, a[i][j]);
		ans = max(ans, ST.query(i + 1, m + 1) - i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 14720
from collections import Counter

N = int(input())
S = [input() for i in range(N)]

s = Counter(S)

print('AC x ',end='')
print(s['AC'])
print('WA x ', end='')
print(s['WA'])
print('TLE x ',end='')
print(s['TLE'])
print('RE x ', end='')
print(s['RE'])

Measured memory_bytes: 16520
import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
strToInteger s = (read :: String -> Integer) s

main = do
    n <- readLn :: IO Int
    k <- readLn :: IO Int
    
    print $ solve 1 n k
    
solve :: Int -> Int -> Int -> Int
solve m 0 k = m
solve m n k = solve (min (2*m) (m+k)) (n-1) k

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

int main(){
  long long int N, M, money = 0, drink = 0;
  cin >> N >> M;
  vector<pair<long long int,long long int>> a(N);
  for(long long int i = 0; i < N; i++){
    cin >> a.at(i).first >> a.at(i).second; //金額、本数の順
  }
  sort(a.begin(),a.end());



  for(long long int i = 0; i < N+1; i++){
    if(drink < M){
      money += a.at(i).first*a.at(i).second;
      drink += a.at(i).second;
    }
    else if(drink > M){
      money -= a.at(i-1).second*a.at(i-1).first;
      drink -= a.at(i-1).second;
      money += a.at(i-1).first*(M-drink);
      break;
    }
    else{
      break;
    }
  }
  cout << money << endl;
}


Measured memory_bytes: 1792
/*****And nothing else matters!******/

#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define setbits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define sp(x) fixed << setprecision(10) << x
#define nitro ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = 998244353;
const int N = 2e5 + 10;

vpi seg(N);
vl dp(N), pre(N);

int main()
{
    nitro;
    int n, k;
    cin >> n >> k;
    f(i,0,k)
        cin >> seg[i].F >> seg[i].S;

    pre[1] = 1;
    for(int i = 1; i <= n; i++)
    {
        if(i > 2)
            pre[i] = (pre[i] + pre[i-1]) % mod;
        pre[i] = (pre[i] + dp[i]) % mod;
        for(int j = 0; j < k; j++)
        {
            if(i + seg[j].F <= n)
                dp[i + seg[j].F] = (dp[i + seg[j].F] + pre[i]) % mod;
            if(i + seg[j].S + 1 <= n)
                dp[i + seg[j].S + 1] = (dp[i + seg[j].S + 1] - pre[i]) % mod;

        }
    }
    cout << (pre[n] + mod) % mod;
}


Measured memory_bytes: 7856
#include <bits/stdc++.h> 
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<int>>;

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

int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    rep(i,n)cin>>h[i];
    int ans=1;
    int maxh=h[0];
    for(int i=0;i<n-1;++i){
        if(h[i+1]>=maxh)ans++;
        maxh=max(maxh,h[i+1]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include<stdio.h>

int main(void)
{
	int a[5],i,j,check=0,seihou=0;
	
	scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]);
	
	for(i=0;i<4;i++)
	{
		for(j=i+1;j<4;j++)
		{
			if(a[i]==a[j])
			{
				check++;
			}
			if(check==3)
			seihou=1;
		}
	}
	if(check==2||seihou==1)
	printf("yes\n");
	else
	printf("no\n");
	return 0;
}

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

using namespace std;

int main() {

	long a,b,c;
	cin >> a >> b >> c;
	
	if ((a == 5 && b == 5 && c == 7)
		|| (a == 5 && b == 7 && c == 5) 
		|| (a == 7 && b == 5 && c == 5)){
		cout << "YES" << endl;
		return 0;
	}
	
	cout << "NO" << endl;
	return 0;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    void run() {
        int MOD = (int) 1e9 + 7;
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n = s.length();

        int[][] dp = new int[n + 1][13];
        dp[0][0] = 1;

        for (int i = 0; i < n; i++) {
            char c = s.charAt(i);
            for (int j = 0; j < 13; j++) {
                if (c == '?') {
                    for (int k = 0; k < 10; k++) {
                        int nextJ = (10 * j + k) % 13;
                        dp[i + 1][nextJ] = (dp[i + 1][nextJ] + dp[i][j]) % MOD;
                    }
                } else {
                    int k = Character.getNumericValue(c);
                    int nextJ = (10 * j + k) % 13;
                    dp[i + 1][nextJ] = (dp[i + 1][nextJ] + dp[i][j]) % MOD;
                }
            }
        }

        System.out.println(dp[n][5]);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 32396
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 998244353
#define inf (1LL<<61)
#define int long long
typedef long long ll;

int dp[2][100001];

int32_t main()
{
    IOS;
    
    int n;
    cin >> n ;
    int w;
    cin >> w;
    int v[n],wt[n];
    for(int i = 0;i < n;i++)
        cin >> wt[i] >> v[i];
    dp[1][0] = 0;
    for(int j = 1;j < 100001;j++)
    {
        dp[0][j] = inf;
        dp[1][j] = inf;
    }
    dp[0][0] = 0;
    int ans = 0;
    for(int i = 0;i < n;i++)
    {
        int cur = i & 1;
        int prev = cur ^ 1;
        
        for (int j = 1; j < 100001; ++j)
        {
            dp[cur][j] = dp[prev][j];
            if(j >= v[i])
                dp[cur][j] = min(dp[cur][j],dp[prev][j-v[i]] + wt[i]);
            else
                dp[cur][j] = min(dp[cur][j],dp[prev][0] + wt[i]);

            if(i == n - 1 and dp[cur][j] <= w)
                ans = j;


        }

    }
    cout << ans;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<cmath>
#include<cstdio>

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

using namespace std;

const double EPS=1e-10;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x,y,z;
  point(){}
  point(double x,double y,double z) : x(x),y(y),z(z){}
  point operator + (point p){return point(add(x,p.x),add(y,p.y),add(z,p.z));}
  point operator - (point p){return point(add(x,-p.x),add(y,-p.y),add(z,-p.z));}
  point operator * (double d){return point(x*d,y*d,z*d);}
};
double dot(point a,point b){return a.x*b.x+a.y*b.y+a.z*b.z;}
double norm(point a){return sqrt(a.x*a.x+a.y*a.y+a.z*a.z);}
double theta(point a,point b){return acos(dot(a,b)/norm(a)/norm(b));}

int main(void){

  int n,m;
  while(cin >> n,n){
    vector<point>star(n);
    for(int i=0;i<n;i++)cin >> star[i].x >> star[i].y >> star[i].z;
    cin >> m;
    vector<double>p(m);
    vector<point>scope(m);
    for(int i=0;i<m;i++)
      cin >> scope[i].x >> scope[i].y >> scope[i].z >> p[i];
 
    int ans=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
	if(theta(star[i],scope[j])-EPS<p[j]){ans++;break;}
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1316
def getinputdata():

    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

x=arr_data[0][0]

arr=[]


for v in x:
    
#    sの場合
    if v=="S":
        
        arr.append("S")
        
#    tの場合 直前がTあるいは初めての場合
    elif v=="T" and (len(arr)==0 or arr[-1]=="T"):
        
        arr.append("T")
      
    else:
            
        del arr[-1]
        
            
print(len(arr))    


Measured memory_bytes: 5096
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
using namespace std;
typedef long long ll;
ll d[303030];
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)scanf("%lld", &d[i + 1]), d[i + 1] += d[i];
	ll mini = 1000000000000000000LL;
	for (int i = 0; i <= n; i++)mini = min(mini, abs(d[n] - d[i] - d[i]));
	printf("%lld\n", mini);
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <cstring>
using namespace std;
int main()
{
	int k,dist[100000];
	cin>>k;
	for(int i=0;i<k;i++)
	{
		dist[i]=10000007;
	}
	dist[1]=1;
	deque<int> q;
	q.push_back(1);
	while(q.size())
	{
		int x;
		x=q.front();
		q.pop_front();
		if(dist[(10*x)%k]>dist[x])
		{
			dist[(10*x)%k]=dist[x];
			q.push_front((10*x)%k);
		}
		if(dist[(x+1)%k]>dist[x]+1)
		{
			dist[(x+1)%k]=dist[x]+1;
			q.push_back((x+1)%k);
		}
	}
	cout<<dist[0];
}

Measured memory_bytes: 896
#include<iostream>

using namespace std;

int main() {
	int n,min,max,a;
	long int sum;
	cin >> n;
	cin >> min;
	max = min;
	sum = min;
	for (int i = 1; i < n; i++) {
		cin >> a;
		if (min > a) {
			min = a;}
		if (max < a) {
			max = a;}
		sum = sum + a;
	}
	cout << min << " " << max<< " " << sum << endl;

	
	

	
	
	return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;



void solve(){

    ll n,k;
    cin >> n >> k;
    vector<ll> x,y;
    rep(i,n){
        ll p,q;
        cin >> p >> q;
        x.emplace_back(p);
        y.emplace_back(q);
    }

    ll ans = 4*INF*INF;
    rep(u,n){
        rep(d,n){
            rep(l,n){
                rep(r,n){
                    if(u==d||l==r) continue;
                    ll count=0;
                    rep(i,n){
                        if(y[u]<=y[i]&&y[i]<=y[d]&&x[l]<=x[i]&&x[i]<=x[r]){
                            count++;
                        }
                    }
                    if(count>=k){
                        ans = min(ans, ll(abs(y[d]-y[u])*abs(x[r]-x[l])) );
                    }
                }
            }
        }
    }

    cout << ans << endl;

    

}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;

int a[10],ans;
void work(){
    for (int i=0;i<3;i++) cin>>a[i];
    for (int i=0;i<3;i++){
        for (int j=0;j<3;j++) if (i!=j){
            for (int k=0;k<3;k++) if (i!=k && k!=j){
                int tmp = a[i] * 10 + a[j] + a[k];
                if (tmp > ans) ans = tmp;
            }
        }
    }
    cout<<ans<<endl;
}
int main(){
//    freopen("in.txt","r",stdin);
    work();
    return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
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; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A,B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  int n;
  string s;
  cin >> n >> s;
  rep(i, 4) {
    string t;
    t += string(i & 1 ? "W" : "S") + string(i >> 1 & 1 ? "W" : "S");
    rep(j, n - 2) {
      if (t[j + 1] == 'S') t += (s[j + 1] == 'o') ? t[j] : 'S' + 'W' - t[j];
      if (t[j + 1] == 'W') t += (s[j + 1] == 'o') ? 'S' + 'W' - t[j] : t[j];
    }
    bool valid = true;
    if (t[0] == 'S') valid &= (s[0] == 'o') == (t[1] == t[n - 1]);
    if (t[0] == 'W') valid &= (s[0] == 'o') != (t[1] == t[n - 1]);
    if (t[n - 1] == 'S') valid &= (s[n - 1] == 'o') == (t[0] == t[n - 2]);
    if (t[n - 1] == 'W') valid &= (s[n - 1] == 'o') != (t[0] == t[n - 2]);
    if (valid) {
      cout << t << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


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

int main(int argc, const char * argv[]) {
    int N;
    long K;
    cin>>N;
    cin>>K;
    int *P=new int[N];
    for(int i=0;i<N;++i){
        cin>>P[i];
        --P[i];
    }
    long *C=new long[N];
    for(int i=0;i<N;++i){
        cin>>C[i];
    }
    
    long max=INT64_MIN;
    for(int i=0;i<N;++i){//開始位置
        //サイクル計算
        int idx=i;
        int length=1;
        long cycleC=0;
        for(int j=0;j<N;++j){
            idx=P[idx];
            cycleC+=C[idx];
            if(idx==i){
                break;
            }
            ++length;
        }
        if(cycleC<=0){
            idx=i;
            long score=C[idx];
            if(max<score){
                max=score;
            }
            for(int j=1,end=min(length,(int)K);j<end;++j){
                idx=P[idx];
                score+=C[idx];
                if(max<score){
                    max=score;
                }
            }
        }else{
            int mod=K%length;
            if(mod==0){
                mod=length;
            }
            long cycleNum=(K-(long)mod)/length;
            long score=cycleNum*cycleC;
            if(max<score){
                max=score;
            }
            for(int j=0;j<mod;++j){
                idx=P[idx];
                score+=C[idx];
                if(max<score){
                    max=score;
                }
            }
        }
    }
    cout<<max<<endl;
    
    delete[] P;
    delete[] C;
    return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
#define MOD 1000000007
using namespace std;

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

    int n;
    cin >> n;
    int k=n/2;
    if (n%2==1)
    {
    	k++;
    }
    cout << k << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >>n;
  int a[n];
  for(int i=0; i<n; i++) cin>>a[i];
  sort(a,a+n);
  bool flg=0;
  for(int i=0; i<n-1; i++){
  	if(a[i]==a[i+1]) flg=1;
  }
  if(flg) cout <<"NO"<<endl;
  else cout << "YES"<< endl;
}

Measured memory_bytes: 1024
n = int(input())
a = [int(i) for i in input().split()]
x = [0]*n
#for i in range(n):
x[0] = sum(a)
for j in range(1, n, 2):
  x[0] -= 2*a[j]
for i in range(1, n):
  x[i] = 2*a[i-1]-x[i-1]
print(*x)

Measured memory_bytes: 14092
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	int L,R,d,ans = 0;
	cin>>L>>R>>d;
	for(int i = L; i<=R; ++i)if(i%d == 0)++ans;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3592
// https://atcoder.jp/contests/

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int n, t, a, m;

  cin >> n >> t >> a;

  double h = INF;
  REP(i, n)
  {
    int hi;
    cin >> hi;

    double nx = abs(t - 0.006 * hi - a);
    if (nx < h)
    {
      h = nx;
      m = i + 1;
    }
  }

  cout << m << '\n';

  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:108777216")
#define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <utility>
#include <algorithm>
#include <ctime>
#include <cstdarg>
#include <sstream>
#include <functional>
using namespace std;

int const MAX_N = 512 * 1024;
long long const LL_INF = 5000000000000000000LL;

deque<int> s;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	int n, k;
	cin >> n >> k;
	s.resize(n);
	for (int i = 0; i < n; i++) cin >> s[i];

	int mx = 0;
	for (int a=0; a<=n; a++)
		for (int b = 0; a + b <= n; b++) {
			if (a + b > k) continue;
			if (a + b == 0) continue;
			vector<int> vals;
			for (int j = 0; j < a; j++) vals.push_back(s[j]);
			for (int j = 0; j < b; j++) vals.push_back(s[n - j - 1]);
			sort(vals.begin(), vals.end());
			int sum = 0;
			for (int j = 0; j < (int)vals.size(); j++) sum += vals[j];
			int rem = k - a - b;
			if (rem > 0) {
				int WW = 0;
				while (WW < vals.size() && vals[WW] < 0 && rem > 0) {
					rem--;
					sum -= vals[WW];
					WW++;
				}
			}
			mx = max(mx, sum);
		}

	cout << mx;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<queue>
#include<algorithm>
using namespace std;
int main(){
	int n,num;
	priority_queue<double,vector<double>,greater<double> > q;
		while(!q.empty()){
			q.pop();
		}
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>num;
			q.push(num);
		}
		double sum=0.0,a,b;
		while(q.size()>1){
			a=q.top();
			q.pop();
			b=q.top();
			q.pop();
			sum = (a+b)/2;
			q.push(sum);
		}
		cout << q.top() << endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

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

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

int main(){

ll n,a,b;
cin>>n>>a>>b;
ll c;
if(a==0&&b==0)
c=0;
else{
if(n==(a+b))
    c=a;
    else if(n>(a+b))
    {
      ll q=n/(a+b);
      ll r=n%(a+b);
    if(r>=a)
        c=q*a+a;
    else
        c=q*a+r;
    }
    else{
        if(n<a)
        c=n;
        else if(n>=a)
            c=a;
    }
    }
    cout<<c<<endl;
}


Measured memory_bytes: 256
r,c=map(int,raw_input().split())
l=[]
for i in range(r):l.append(map(int,raw_input().split()))
l.append([0]*(c+1))
for i in range(c+1):
    for j in range(r):
        if i==0:l[j].append(sum(l[j]))
        l[-1][i]+=l[j][i]
for i in range(r+1):print' '.join(map(str,l[i]))

Measured memory_bytes: 4312
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  string s; cin >> s;

  reverse(s.begin(), s.end());
  int n = s.size();
  vector<int> imos(n+1, 0);
  int ten = 1;
  for(int i = 0; i < n; i++){
    imos[i+1] = (imos[i] + (s[i]-'0') * ten ) % 2019;
    ten = (ten * 10) % 2019;
  }

  int ans = 0;
  map<int, int> mp;
  for(int i = 0; i < n+1; i++){
    ans += mp[imos[i]];
    mp[imos[i]]++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 5184
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <queue>
using namespace std;
typedef long long ll;
#define PI 3.14159265359

int main() {
  int A, B, H, M;
  cin >> A >> B >> H >> M;

  double a, b, c, d;
  a = sin(2 * PI * (H * 60 + M)/720) * A;
  b = cos(2 * PI * (H * 60 + M)/720) * A;
  c = sin(2 * PI * (M)/60) * B;
  d = cos(2 * PI * (M)/60) * B;
  double res = sqrt((a-c) * (a-c) + (b-d) * (b-d));
  printf("%.16f\n", res);

  return 0;
}

Measured memory_bytes: 4064
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 100000000000000003;
int ne[200001], he[100001];
char C[1200100];

ll num[500010];
int kazu[500010];
int query(ll n) {
	int n2 = n % 500000 + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) return kazu[n2];
		n2 = n2 * 61 % 500009;
	}
	return 0;
}
void add(ll n, int b) {
	int n2 = n % 500000 + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) {
			kazu[n2] |= b;
			return;
		}
		n2 = n2 * 61 % 500009;
	}
	num[n2] = n + 1;
	kazu[n2] = b;
}

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


	fread(C, 1, 1200100, stdin);
	char* ci = C, c;
	int N = 0;
	while ((c = *ci++) >= '0') N = N * 10 + c - '0';
	set<pair<int, char*>> ST;
	char* s[200001];
	rep1(i, N) {
		s[i] = ci;
		while (*ci++ >= '0');
		int n = ci - s[i] - 1;	
		if (n <= 100000) {
			ne[i] = he[n];
			he[n] = i;
		}
		else {
			ST.insert(mp(n, s[i]));
		}
	}

	ll kotae = 0;

	for (int M = 1; M <= 100000; M++) {
		for (int p = he[M]; p; p = ne[p]) {
			auto S = s[p];
			int k[26] = {};
			ll are = 0;
			for (int i = M - 1; i >= 1; i--) {
				int tmp = query(are);
				rep(j, 26) if ((tmp >> j & 1)) {
					k[j]++;
				}
				kotae += k[S[i] - 'a'];
				k[S[i] - 'a'] = 0;
				are = (are * 30 + S[i] - 'a' + 1) % mod;
			}

			kotae += k[S[0] - 'a'];
			k[S[0] - 'a'] = 0;

			add(are, 1 << (S[0] - 'a'));
		}
	}
	for (auto p : ST) {
		auto S = p.second;
		int k[26] = {};
		ll are = 0;
		for (int i = p.first - 1; i >= 1; i--) {
			int tmp = query(are);
			rep(j, 26) if ((tmp >> j & 1)) {
				k[j]++;
			}
			kotae += k[S[i] - 'a'];
			k[S[i] - 'a'] = 0;
			are = (are * 30 + S[i] - 'a' + 1) % mod;
		}

		kotae += k[S[0] - 'a'];
		k[S[0] - 'a'] = 0;

		add(are, 1 << (S[0] - 'a'));
	}
	co(kotae);


	Would you please return 0;
}

Measured memory_bytes: 12924
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 2010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n;
II a[MAXN];
ll dp[MAXN][MAXN];

ll solve(int l, int r) {
    int remain = r-l+1;
    int start = n - remain + 1;
    if (dp[l][r] != -1) return dp[l][r];
    if (l == r) return dp[l][r] = (ll) a[start].FI * abs(r - a[start].SE);
    return dp[l][r] = max((ll) a[start].FI * abs(r - a[start].SE) + solve(l, r-1), (ll) a[start].FI * abs(l - a[start].SE) + solve(l+1, r));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n) {
        cin >> a[i].FI;
        a[i].SE = i;
    }
    sort(a+1, a+n+1);
    FOR(i,1,n/2) swap(a[i], a[n-i+1]);
    FOR(i,1,n)
        FOR(j,1,n) dp[i][j] = -1;
    cout << solve(1,n);
    return 0;
}


Measured memory_bytes: 35196
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
 
#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define FORR(i,a,b) for (int i = b - 1; i >= a; --i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)
 
int main() {
	string N;
	cin >> N;
 
	ll sum = 0;
	REP(i, N.length()) {
		char buf = N[i];
		sum = (sum + atoi(&buf)) % 9;
	}
	if (sum == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
 
	return 0;
}

Measured memory_bytes: 3748
s[1<<17],t[1<<17];a,b,c;main(d){for(;d=getchar()-10;a++)s[a+1]=s[a]+d-54;for(;d=getchar()-10;b++)t[b+1]=t[b]+d-54;for(gets(&a);~scanf("%d%d%d%d",&a,&b,&c,&d);)puts((s[b]-s[a-1])%3-(t[d]-t[c-1])%3?"NO":"YES");}

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

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

    if (x >= 2000) {
        cout << 1 << endl;
    } else {
        int res = 0;
        for (int a = 0; a < 20; a++) {
            for (int b = 0; b < 20; b++) {
                for (int c = 0; c < 20; c++) {
                    for (int d = 0; d < 20; d++) {
                        for (int e = 0; e < 20; e++) {
                            for (int f = 0; f < 20; f++) {
                                if (x == a*100 + b*101 + c*102 + d*103 + e*104 + f*105) res = 1;
                            }
                        }
                    }
                }
            }
        }

        cout << res << endl;
    }

    return 0;
}


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

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		int a = sc.nextInt();
		//list.addAll(Arrays.asList(sc.nextLine()));
		for(int k = 1;k <= a; k++) {
			int j = sc.nextInt();
			list.add(j);
		}
		int count = 0;
		for (int i = 1; i < list.size()-1;i++) {
				if (list.get(i-1) < list.get(i) && list.get(i) < list.get(i+1) || list.get(i-1) > list.get(i) && list.get(i) > list.get(i+1)) {
					count++;
				}
		}
		System.out.println(count);
	}
}

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

typedef long long int ll;
typedef long double ld;
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

ll const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 1e9+7l;

// code begins here

int main(){
    fast;
    
    ll a,b;
    cin>>a>>b;
    
    cout<<a*b<<endl;
    
    return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>

int main(){
int x,a,b;
int jaraka,jarakb;
scanf("%d %d %d",&x,&a,&b);
jaraka = x-a;
jarakb= x-b;
if(jaraka<0){
	jaraka*= -1;
}
if(jarakb<0){
	jarakb*= -1;
}
if(jaraka>jarakb){
	printf("B\n");
}
else{
	printf("A\n");

}
	return 0;
}

Measured memory_bytes: 2072
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    int ans = 0;
    ans = 1900 * m + (n - m) * 100;
    ans *= pow(2, m);
    cout << ans << endl;
	return 0;
}



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    map<string, int> dict;
    set<string> st;

    rep(i, n) {
        cin >> s.at(i);
        st.insert(s.at(i));
        dict[s.at(i)] = 0;
    }
    
    rep(i, n) {
        dict[s.at(i)]++;
    }
    
    vector<pair<int, string>> tmp;
    for (string str: st) {
        tmp.push_back(make_pair(dict[str], str));
    }
    sort(tmp.begin(), tmp.end());
    reverse(tmp.begin(), tmp.end());

    stack<string> ans;
    string str;
    int max_count;
    tie(max_count, str) = tmp.at(0);
    ans.push(str);

    for (int i=1; i<tmp.size(); i++) {
        string str;
        int count;
        tie(count, str) = tmp.at(i);

        if (count == max_count) {
            ans.push(str);
        }
    }

    while (!ans.empty()) {
        cout << ans.top() << endl;
        ans.pop();
    }

    return 0;
}


Measured memory_bytes: 41840
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	sort(a.begin(), a.end());
	int cnt = 0;
	rep(i,n-1){
		if(a[i] == a[i+1]){
			++cnt;
		}
	}
	int ans = n - ((cnt + 1) / 2) * 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

const double pie = acos(-1.0);
const ll MOD = 1e9 + 7;

// 最大公約数
ll gcd(ll a, ll b)
{
   if (a%b == 0) {
       return(b);
   } else {
       return(gcd(b, a%b));
   }
}

// 最小公倍数
ll lcm(ll a, ll b){
   return a / gcd(a, b) * b;
}

//素数判定
bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された
    if(n % 2 == 0 || n % 3 == 0) return false;
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i     == 0) return false; // (6の倍数)-1
        if(n % (i+2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

void solve() {
	ll n; cin >> n;
    ll four = 0, two = 0, none = 0;
	for(int i = 0; i < n; ++i){
		ll a; cin >> a;
		if(a % 4 == 0) four++;
		else if(a % 2 == 0) two++;
		else none++;
	}
	if(four+1 >= none && two == 0) cout << "Yes" << endl;
	else if(four >= none) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	char a[101],b[101];
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		cin>>b[i];
	}
	for(int i=1;i<=n;i++){
		cout<<a[i]<<b[i];
	}
	return 0;
}

Measured memory_bytes: 256