akhauriyash/Code-Regression huggingface dataset:
#include	<bits/stdc++.h>
using	namespace	std;
typedef	long long ll;

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (int i=0; i<n; i++)
#define	Rep1(i, n)	for (int i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	int A, B, K;
	cin >>A >>B >>K;
	Rep0(i, K) {
		if (0==i%2) {
			if (1==A%2)
				A--;
			A/=2;
			B+=A;
		} else {
			if (1==B%2)
				B--;
			B/=2;
			A+=B;
		}
	}
	cout <<A <<' ' <<B <<endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.14159265359
#define all(v) v.begin(),v.end()
#define vil vector<long int>
#define vi vector<int> 
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ub upper_bound
#define lb lower_bound
#define INF 1000000007 
#define MOD 998244353
void solve(ll T){
string s,t;
cin>>s>>t;
int n=s.size();
int m=t.size();
int dp[n+1][m+1];
for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++){
        if(i==0||j==0){
            dp[i][j]=0;
        }
        else if(s[i-1]==t[j-1]){
            dp[i][j]=1+dp[i-1][j-1];
        }
        else{
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
}
/*for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++){
        cout<<dp[i][j]<<" ";
    }
    cout<<endl;
}*/
deque<char> ans;;
int i=n;
int j=m;
   while(i>0&&j>0){
      if (s[i-1] == t[j-1]) 
      { 
           ans.pf(s[i-1]);
          i--; j--;
      } 
      else if (dp[i-1][j] > dp[i][j-1]) 
         i--; 
      else
         j--; 
}
for(int w=0;w<ans.size();w++){
    cout<<ans[w];
}
cout<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
ll T;
T=1;
//cin>>T;
while(T--){
   solve(T);
return 0;
}
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//===



int main() {
	int N, D;
	cin >> N >> D;

	cout << (N + 2 * D) / (2 * D + 1) << endl;
}

Measured memory_bytes: 256
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
  set <ll> s;
  rep(i,0,3) {
    char c;
    cin>>c;
    s.insert(c);
  }
  if(sz(s)>1)
    cout<<"Yes";
  else cout<<"No";
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define FOR(i, N) for (long i = 0; i < (N); i++)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    long K;
    cin >> N >> K;
    vector<long> P(N);
    vector<long> C(N);

    FOR(i, N) {
        cin >> P[i];
    }

    FOR(i, N) {
        cin >> C[i];
    }

    vector<vector<long>> heiro(N);

    FOR(i, N) {
        heiro[i].push_back(i);
        int next = P[i] - 1;
        while (next != i) {
            heiro[i].push_back(next);
            next = P[next] - 1;
        }
    }

    long ans = -MOD;

    FOR(i, N) {
        if (heiro[i].size() >= K) {
            vector<long> sum(heiro[i].size());
            sum[0] = C[i];
            for (long j = 1; j < heiro[i].size(); j++) {
                sum[j] = sum[j - 1] + C[heiro[i][j]];
            }
            FOR(j, K) {
                if (ans < sum[j]) {
                    ans = sum[j];
                }
            }
        } else {
            vector<long> sum(heiro[i].size());
            sum[0] = C[i];
            for (long j = 1; j < heiro[i].size(); j++) {
                sum[j] = sum[j - 1] + C[heiro[i][j]];
            }
            if (sum[heiro[i].size() - 1] <= 0) {
                FOR(j, heiro[i].size()) {
                    if (ans < sum[j]) {
                        ans = sum[j];
                    }
                }
            } else {
                long amari = K % heiro[i].size();
                long shou = (K - amari) / heiro[i].size();
                long loop_num = shou - 1;

                FOR(j, heiro[i].size() + amari) {
                    if (j >= heiro[i].size()) {
                        if (ans < sum[j - heiro[i].size()] + shou * sum[heiro[i].size() - 1]) {
                            ans = sum[j - heiro[i].size()] + shou * sum[heiro[i].size() - 1];
                        }
                    } else {
                        if (ans < sum[j] + loop_num * sum[heiro[i].size() - 1]) {
                            ans = sum[j] + loop_num * sum[heiro[i].size() - 1];
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 218624
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x);putchar(' ');}
inline void pr2(int x){write(x);putchar('\n');}
const int MAXN=200005;
int n;
int lowbit(int x){return x&-x;}
struct bittree
{
	int s[MAXN];
	void modify(int x,int c){for(;x<=n;x+=lowbit(x))s[x]=max(s[x],c);}
	int qry(int x){int ret=0;for(;x>=1;x-=lowbit(x))ret=max(ret,s[x]);return ret;}
}bi[2];
int L[MAXN],R[MAXN],a[MAXN];
int is[MAXN],sum;
int re[2][MAXN][20];
void rebuild(int i)
{
	int u=n-a[i]+1;
	for(int x=u,cnt=1;x<=n;x+=lowbit(x),cnt++)bi[0].s[x]=re[0][i][cnt];
	for(int x=u,cnt=1;x<=n;x+=lowbit(x),cnt++)bi[1].s[x]=re[1][i][cnt];
}
void getit(int i)
{
	int u=n-a[i]+1;
	for(int x=u,cnt=1;x<=n;x+=lowbit(x),cnt++)re[0][i][cnt]=bi[0].s[x];
	for(int x=u,cnt=1;x<=n;x+=lowbit(x),cnt++)re[1][i][cnt]=bi[1].s[x];
}
void init()
{
	int mx=0;
	for(int i=1;i<=n;i++)if(a[i]>mx)is[i]=1,mx=a[i],sum++;
	for(int i=n;i>=1;i--)
	{
		int u=n-a[i]+1;
		int u1=bi[0].qry(u-1),u2=bi[1].qry(u-1);
		if(is[i])u1+=2,u2+=2;
		else u1+=1,u2+=1;
		getit(i);
		bi[u1&1].modify(u,u1);bi[u2&1].modify(u,u2);
	}
}
int ans[MAXN];
int mx[2],cnt[2];
bool ok(int i,int o)
{
	cnt[o]+=(a[i]>mx[o]);
	int u=n-mx[o^1]+1,c1=bi[0].qry(u-1),c2=bi[1].qry(u-1);
	int cal=cnt[o]-cnt[o^1]+sum;
	cnt[o]-=(a[i]>mx[o]);
	if(cal>=0)
	{
		if((cal&1)&&cal<=c2)return true;
		if((!(cal&1))&&cal<=c1)return true;
	}
	int ls=mx[o];
	cnt[o]+=(a[i]>mx[o]);mx[o]=max(mx[o],a[i]);
	u=n-mx[o]+1,c1=bi[0].qry(u-1),c2=bi[1].qry(u-1);
	cal=cnt[o^1]-cnt[o]+sum;
	mx[o]=ls;cnt[o]-=(a[i]>mx[o]);
	if(cal>=0)
	{
		if((cal&1)&&cal<=c2)return true;
		if((!(cal&1))&&cal<=c1)return true;
	}
	return false;
}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	init();
	for(int i=1;i<=n;i++)
	{
		rebuild(i);sum-=is[i];
		if(ok(i,0))ans[i]=0,cnt[0]+=(a[i]>mx[0]),mx[0]=max(mx[0],a[i]);
		else if(ok(i,1))ans[i]=1,cnt[1]+=(a[i]>mx[1]),mx[1]=max(mx[1],a[i]);
		else return puts("-1"),0;
	}
	for(int i=1;i<=n;i++)putchar(ans[i]+'0');
	puts("");
	return 0;
}

Measured memory_bytes: 36736
# -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def divisor(n):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            yield i
            if i != n // i:
                yield n // i


@mt
def slv(N, K, A):
    S = sum(A)
    ans = 0
    for d in divisor(S):
        r = [a%d for a in A]
        r.sort()
        lr = [0]
        rr = [0]
        for v in r:
            lr.append(lr[-1] + v)
            rr.append(rr[-1] + (d-v))
        for i in range(N):
            l = lr[i+1] - lr[0]
            r = rr[-1] - rr[i+1]
            if l == r and l <= K:
                ans = max(ans, d)
    return ans






def main():
    N, K = read_int_n()
    A = read_int_n()
    print(slv(N, K, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 41560
# include "iostream"
# include "cstdio"
# include "cstring"

using namespace std;

const int maxm=1e5+10;
const int maxn=1e2+10;
const int Mod=1e9+7;

char S[maxm];
int K,Len;
long long DP[maxm][maxn];

int main(){
	register int i,j,l,Num=0;
	register long long Ans=0;
	scanf("%s%d",S,&K);
	Len=strlen(S);
	DP[0][0]=1;
	for(i=1;i<Len;i++){
		for(l=0;l<=9;l++){
			for(j=0;j<=K;j++){
				DP[i][(j+l)%K]=(DP[i][(j+l)%K]+DP[i-1][j])%Mod;
			}
		}
	}
	for(i=0;i<Len;Num=(Num+S[i]-'0')%K,i++){
		for(j=0;j<S[i]-'0';j++){
			Ans=(Ans+DP[Len-i-1][(K-(Num+j)%K)%K])%Mod;
		}
	}
	if(Num) Ans--;
	Ans=(Ans+Mod)%Mod;
	printf("%lld",Ans);
	return 0;
}

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

using namespace std;

using ll = long long;

const ll mod = 998244353;

int main() {
  ll n;
  string s;
  
  cin >> n >> s;
  
  int cnt[3] = {};
  
  ll ans = 1;
  
  for (char c : s) {
    int i, j, k;
    
    if (c == 'R') {
      i = 0;
      j = 1;
      k = 2;
    } else if (c == 'G') {
      i = 1;
      j = 0;
      k = 2;
    } else if (c == 'B') {
      i = 2;
      j = 0;
      k = 1;
    }
    
    if (cnt[j] > 0 && cnt[k] > 0) {
      ans = ans * min(cnt[j], cnt[k]) % mod;
      cnt[j]--;
      cnt[k]--;
    } else if (cnt[j] > 0) {
      ans = ans * max(cnt[j] - cnt[i], 1) % mod;
      cnt[i]++;
    } else if (cnt[k] > 0) {
      ans = ans * max(cnt[k] - cnt[i], 1) % mod;
      cnt[i]++;
    } else {
      cnt[i]++;
    }
  }
  
  for (int i = 1; i <= n; i++) {
    ans = ans * i % mod;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 900
#include <iostream>
#include <cstdint>

using namespace std;

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);

  int x, a, b;
  cin >> x >> a >> b;
  if (a >= b) {
    cout << "delicious" << endl;
  } else {
    if ((b - a) <= x) {
      cout << "safe" << endl;
    } else {
      cout << "dangerous" << endl;
    }
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int inf=1000000000;
int n,mask,m,i,j,k,e,l,mm,c,fi,fr,q[1010],f[1010],fro[1010],cnt[505],z[505],r=inf;
char s[505][505];
int main() {
  scanf("%d",&n);
  for (i=0; i<n; i++) {
    scanf("%s",s[i]);
    for (j=0; j<n; j++) if (s[i][j]=='#') {
      z[i]++; cnt[j]++;
    }
  }
  for (i=0; i<n; i++) if (cnt[i]>0) break;
  if (i>=n) { puts("-1"); return 0; }
  for (j=0; j<n; j++) {
    c=n-z[j]+1;
    if (cnt[j]>0 || z[j]==n) c--;
    for (i=0; i<n; i++) if (cnt[i]!=n) c++;
    r=min(r,c);
  }
  printf("%d\n",r);
  return 0;
}



Measured memory_bytes: 384
object Main extends App {

  import scala.io.StdIn._

  solve
  def solve:Unit = {
    val n = readLine.trim.toInt
    if (n == 0) return
    val numbers = Array.tabulate(n){_ ⇒ readInt}
    println(count(numbers, readInt))
    solve
  }
  def count(array: Array[Int], target: Int): Int = {
    var left = 0
    var right = array.length - 1
    var count = 0
    while(left <= right){
      val mid = (left + right) / 2
      count += 1
      if (array(mid) < target){
        left = mid + 1
      }else if (array(mid) > target){
        right = mid - 1
      }else {
        left = mid + 1
        right = mid
      }
    }
    count
  }
  implicit class Extension[T](val value :T) extends AnyVal {
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}


Measured memory_bytes: 43908
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
h,w = map(int,input().split())
for i in range(h):
    A = list(map(str,input().split()))
    for j in range(w):
        if A[j] == 'snuke':
            ans = alpha[j]+str(i+1)
print(ans)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	int a[5];
   	int n;
   	
   	REP(i, 5){
   		//int a;
   	    cin >> a[i];
   	    //cout << i << a << "\n";
   	}
   	int k;
   	cin >> k;
   	//if(a[4]-a[3]>k||a[3]-a[2]>k||a[2]-a[1]>k||a[1]-a[0]>k){
   	if(a[4] - a[0] > k){
   		cout << ":(" << endl;
   	}else{
   		cout << "Yay!" << endl;
   	}
   	
	return 0;
}

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

using namespace std;

int main() {
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
        int r, d, x;
        scanf("%d%d%d", &r, &d, &x);
        vector<int> a;
        int prev = x;
        for (int i = 1; i <= 10; i++) {
                a.push_back(r * prev - d);
                prev = a.back();
        }
        for (int i = 0; i < 10; i++) {
                printf("%d\n", a[i]);
        }
        puts("");
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a,b,c;
int main(){
	scanf("%lld %lld %lld",&a,&b,&c);
    if(a%2==0||b%2==0||c%2==0){
        printf("0\n");
        return 0;
    }
    printf("%lld\n",min(min(a*b,a*c),b*c));
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

#define max 100

int main()
{
    int a, b, k, i, j=0, str[max];
    
    scanf("%d %d %d", &a, &b, &k);
    
    for (i=1; i<=100; i++) {
        if (a%i==0&&b%i==0) {
            str[j]=i;
            j++;
            
        }
    }
    
    printf("%d", str[j-k]);
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mx 100000
#define pb push_back
#define siz(v) v.size();
typedef unsigned long  ull;
typedef long long int lli;
using namespace std;

int main()
{
 	ios_base::sync_with_stdio(0);
 	cin.tie(0); cin.tie(0);
	
	lli rs=0;
	int n;
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		if (i%3==0||i%5==0)
			continue;
		rs+=i;
	}
	cout<<rs<<"\n";






 return 0;
 }


Measured memory_bytes: 3660
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	int cnt_eq = 1, cnt_lt = 0, col = 0;
	cin >> col;
	for(int i = 1; i < N; i++) {
		int a;
		cin >> a;
		if(a > col+1 || a < col-1) {
			cout << "No\n";
			return 0;
		}
		if(a == col) cnt_eq++;
		if(a == col-1) cnt_lt++;
		if(a == col+1) {
			if(cnt_lt > 0) {
				cout << "No\n";
				return 0;
			}
			cnt_lt = cnt_eq;
			cnt_eq = 1;
			col++;
		}
	}
	if(cnt_lt == 0) {
		if(col*2 > N && col != N-1) cout << "No\n";
		else cout << "Yes\n";
		return 0;
	}
	int non_unique = col - cnt_lt;
	if(non_unique <= 0 || cnt_lt + non_unique * 2 > N) cout << "No\n";
	else cout << "Yes\n";
	return 0;
}

// look at my code
// my code is amazing


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

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

    int N, M;
    cin >> N >> M;

    atcoder::scc_graph g(N);
    while (M--) {
        int u, v;
        cin >> u >> v;
        --u;
        --v;

        g.add_edge(u, v);
        g.add_edge(v, u);
    }

    cout << (g.scc().size() - 1) << '\n';

    return 0;
}


Measured memory_bytes: 11124
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(String args[]) throws InterruptedException {
		    Scanner sc = new Scanner(System.in);	
			
			int n = sc.nextInt();
			int[] natural = new int[101];
			int[] yakusu = new int[101];
			int ans = 0;
			int cnt74 = 0;
			int cnt24 = 0;
			int cnt14 = 0;
			int cnt5 = 0;
			int cnt4 = 0;
			int cnt2 = 0;

			for (int i = 0; i < 101; i++) {
				natural[i] = i;
			}
			for (int i = 1; i <= n; i++) {
				for (int j = 2; j <= i; j++) {
					while (natural[i] % j == 0) {
						natural[i] = natural[i]/j; 
						yakusu[j]++;
					}
					if (natural[i] == 1) {
						break;
					}
				}
			}
			//yakusu is gotten	
			//Now to choose
			for (int i = 0; i <= n; i++) {
				if (yakusu[i] >= 74) {
					cnt74++;
				}
				if (yakusu[i] >= 24) {
					cnt24++;
				}
				if (yakusu[i] >= 14) {
					cnt14++;
				}
				if (yakusu[i] >= 4) {
					cnt4++;
				}
				if (yakusu[i] >= 2) {
					cnt2++;
				}
			}
			ans = cnt74+
			cnt24*(cnt2-1)+
			cnt4*(cnt4-1)*(cnt2-2)/2 +
			cnt14*(cnt4-1);
			//75,3-5-5,3-25,5-15
			System.out.println(ans);
		    sc.close(); }

	public static boolean isEven(int n ) {
		if (n % 2 == 0) {
			return true;
		}else{
			return false;
		}
	}

	
}

Measured memory_bytes: 22608
macro_rules! input {
    ($ttype:ty) => {
        {
            let mut input = String::new();
            let _= std::io::stdin().read_line(&mut input);
            input.trim().parse::<$ttype>().unwrap()
        }
    };

    ($($ttype:ty),*) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let mut iter = input.trim().split_whitespace();
            (
                $(iter.next().unwrap().parse::<$ttype>().unwrap(),)*
            )
        }
    };

    ($ttype:ty; $x:expr) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let v: Vec<$ttype> = input
                .trim()
                .split_whitespace()
                .map(|x| x.parse().unwrap())
                .collect();
            v
        }
    };

    ($ttype:ty; $x:expr; $y:expr) => {
        {
            use std::io::BufRead;
            let mut matrix = Vec::with_capacity($y);
            for _ in 0..$y {
                let mut input = String::new();
                let stdin = std::io::stdin();
                let _ = stdin.lock().read_line(&mut input);
                let v: Vec<$ttype> = input
                    .trim()
                    .split_whitespace()
                    .map(|x| x.parse().unwrap())
                    .collect();
                matrix.push(v);
            }
            matrix
        }
    };
}

fn main() {
    let n = input!(usize);
    let mut lst: Vec<(i32, i32, i32)> = Vec::with_capacity(n);
    for _ in 0..n {
        lst.push(input!(i32, i32, i32));
    }

    let mut now: (i32, i32, i32) = (0, 0, 0);

    for next in lst.iter() {
        let delta_t = next.0 - now.0;
        let delta_x = (next.1 - now.1).abs();
        let delta_y = (next.2 - now.2).abs();
        if delta_x + delta_y > delta_t {
            println!("No");
            return;
        } else if (delta_x + delta_y - delta_t) % 2 != 0 {
            println!("No");
            return;
        }
        now = *next;
    }
    println!("Yes");
}

Measured memory_bytes: 4352
input = gets.to_i

def hhmmss(i)
  hh = (i/60/60).to_i
  mm = (i-hh*60*60)/60.to_i
  ss = (i-(hh*60*60+mm*60)).to_i
  puts "#{hh}:#{mm}:#{ss}"
end

if 0 <= input && input < 86400 
  hhmmss(input)
else
  return false
end



Measured memory_bytes: 6860
#include<bits/stdc++.h>
#define int   long long int  
#define pb push_back
#define BOOST ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debugL(i)  cout<<"line no-> "<<i<<" working"<<endl
#define debugVL(i,l)  cout<<"val at line no."<<i<< " ->"<<l<<endl
#define  init(st,et,val,arr) for(int i=st;i<=et;i++)arr[i]=val;
const int M=1e9 + 7;
using namespace std;
int N=200000;
int32_t main() {
	BOOST;
    int n;cin>>n;
    int* a=new int[n+1];
    for(int i=1;i<=n;i++)cin>>a[i];
    int* b=new int[n+1];
    for(int i=1;i<=n;i++)
    {
    	cin>>b[i];
	}
	int* c=new int[n];
	for(int j=1;j<n;j++)cin>>c[j];
	int ans=0;
	int prev=-100;
	for(int i=1;i<=n;i++)
	{   
	    //cout<<i<<" "<<a[i]<<" "<<b[a[i]]<<" "<<prev<<" "<<a[i]<<endl;
		ans+=(b[a[i]]);
		if((prev+1)==a[i])
		{
			ans+=(c[prev]);
		}
		prev=a[i];
	}
	cout<<ans<<endl;
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

int main(){
   int a, b, c, k;
   cin >> a >> b >> c >> k;
   if (abs(c-a)<=k||((abs(b-a)<=k)&&(abs(c-b)<=k))){
      cout << "Yes" << endl;
   }
   else {
     cout << "No" << endl;
   }
  return 0;
}

Measured memory_bytes: 256
/* Code by Saborit */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast") 
#define MX 100005
#define INF (1<<30)
#define EPS 1e-9
#define MOD 1000000007
#define mid (x+xend)/2
#define izq nod*2
#define der nod*2+1
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
#define unique(X) (X).resize(unique(all(X)) - (X).begin())
#ifdef LOCAL 
	#include "debug.h"
#endif
using namespace std;
using namespace __gnu_pbds;
typedef long long int64;
typedef unsigned long long unt64;

int N, K;
int P[MX];
char A[MX];
set<int> S;

int main(void){
    //~ freopen("a.in", "r", stdin);
    //~ freopen("a.out", "w", stdout);
    
	scanf("%d%d", &N, &K);
	scanf(" %s", &A);
	
	for(int i=N; i > 0; i--){
		if( A[i] == '0' )
			S.insert(i);
		
		if( i+K <=N ){ 
			S.erase(i+K);
			
			if( S.empty() )
				return !printf("-1\n");
				
			P[i+K] = *S.begin();
		}
	}
	
	//~ db() << mt(P, N);
	
	vector<int> sol;
	int p = N;
	while( p > 0 ){
		sol.pb(p - P[p]);
		p = P[p];
	}
	
	reverse(all(sol));

	for(size_t i=0; i < sol.size(); i++)
		printf(i == sol.size()-1 ? "%d\n" : "%d ", sol[i]);
    
   return 0;
}


Measured memory_bytes: 6440
#include<bits/stdc++.h>                                                                                               
     
    using namespace std;
     
    #define rep(i,n) for(int i=0;i<(n);++i)
    #define reps(i,n) for(int i=1;i<=(n);++i)
    #define all(x) (x).begin(),(x).end()
    #define int long long
    using pii = pair<int,int>;
    constexpr int INF  = 0x3f3f3f3f;
    constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
    signed main(){
        string s,a;
        cin >> s;
        rep(i,4){
            cout << s[i];
        }   
        cout << " ";
        for(int i=4;i <= 11;++i){
            cout << s[i];
        }   
        cout << '\n';
        return 0;   
    }

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

val br = BufferedReader(InputStreamReader(System.`in`))
val pw = PrintWriter(System.out)
fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    // 回答をここに書く
    val D = nextInt()
    val s = when {
        D == 7 || D==5 || D==3 ->"YES"
        else -> "NO"
    }
    println(s)
}

// 入力取得
fun next() = br.readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() =listOfString().map { it.toInt() }
fun listOfLong() =listOfString().map { it.toLong() }
fun listOfDouble() =listOfString().map { it.toDouble() }

// 約数のList
fun divisor(value : Long) : List<Long> {
    val max = Math.sqrt(value.toDouble()).toLong()
    return (1..max)
        .filter { value % it == 0L }
        .map { listOf(it, value / it) }
        .flatten()
        .sorted()
}

// 範囲内の素数を取得
// fromだけ指定すると戻り値の個数で素数判定ができる
fun prime(from : Long, to : Long = from) : List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j ->  i % j != 0L }
    }
}

// 素因数分解
fun decom(value : Long) : List<Long>{
    if (value == 1L) return listOf(1)
    val max = Math.sqrt(value.toDouble()).toLong()
    return prime(2, max).filter { value % it == 0L }
}

// 最大公約数
fun gcd(a : Long, b : Long) : Long {
    return if (a % b == 0L) b else gcd(b, a % b)
}

// 文字列を入れ替え
fun swap(base : String, a : String, b : String) : String {
    return base.map {
        when (it) {
            a.toCharArray()[0] -> b
            b.toCharArray()[0] -> a
            else -> it.toString()
        }
    }.joinToString()
}

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 31004
def isPrime(x):
    if x == 2:
        return True
    elif (x < 2) or (x % 2 == 0):
        return False
    else:
        i = 3
        while i <= float(x) ** 0.5:
            if x % i == 0:
                return False
            i += 2
        return True


t = 0
for i in range(int(input())):
    if isPrime(int(input())):
        t += 1
print(t)

Measured memory_bytes: 5668
#include<iostream>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<set>
using namespace std;
#define ll long long

int gcd(int a, int b){
    
    if(b==0)
    return a;
    
    return gcd(b, a%b);
    
}
int main(){
int N;
cin>>N;

ll ans=0;
if(N==0)
    cout<<0;
else{
    ans+= (N/500)*1000;
    int rem= N%500;
    if(rem!=0)
        ans+=(rem/5)*5;
        cout<<ans;
}

}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
    int k,a,b;
    cin>>k;
    cin>>a>>b;
    for(int i=a;i<=b;i++) {
        if(i%k == 0){
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int n;
string s, t;

int main()
{
    cin>>n>>s>>t;
    REP(i,n+1) {
        string str;
        str = s + t.substr(n-i,i);
        //cout<<str<<endl;
        if (str.substr(0,n) == s && str.substr(i,n) == t) {
            cout<<n + i<<endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int N=100005;
struct node { int y,next; } a[N<<1];
int head[N],i,j,k,n,m;
char c;

inline char getc()
{
	#define VV 10000000
	static char s[VV],*l=s,*r=s;
	if (l==r)
		l=s,r=s+fread(s,1,VV,stdin);
	return l==r?0:*l++;
}

int read(){ int z=0; do c=getc(); while (c<'0'||c>'9'); while (c>='0'&&c<='9') z*=10,z+=c-'0',c=getc(); return z; }

void jb(int x,int y)
{
	a[++k]=(node){y,head[x]},head[x]=k,
	a[++k]=(node){x,head[y]},head[y]=k;
}

bool dfs(int w,int sp)
{
	int z=0;
	for (register int j=head[w];j;j=a[j].next)
		if ((j^1)!=sp)
			z+=dfs(a[j].y,j);
	if (z>1)
	{
		puts("First");
		exit(0);
	}
	return z^1;
}

int main()
{
	n=read(),k=1;
	for (i=1;i<n;++i) jb(read(),read());
	puts(dfs(1,0)?"First":"Second");
	return 0;
}

Measured memory_bytes: 4480
import sys
N = int(input())
S = [sys.stdin.readline().rstrip() for i in range(N)]
T = sys.stdin.readline().rstrip()
FS = [S[i].replace('?','z') for i in range(N)]
BS = [S[i].replace('?','a') for i in range(N)]
FS.append(T)
BS.append(T)
list.sort(FS)
list.sort(BS)
ends = len(BS) - BS[-1::-1].index(T)
for i in range(FS.index(T)+1,ends):
	print(i,end=" ")
print(ends)

Measured memory_bytes: 5236
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()

const string M = "Male", F = "Female", V = "Vacant";

string ask(ll i){
    cout << i << endl << flush;
    string res;
    cin >> res;
    return res;
}

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

    string res = ask(0);
    if(res == V){ return 0; }
    ll l = 1, r = n - 1;
    ll lpred;
    if(res == M){
        lpred = 1;
    }else{
        lpred = 0;
    }

    while(1){
        ll toask = (l + r) / 2;
        string res = ask(toask);
        if(res == V){ return 0; }
        ll resi = (res == M ? 0 : 1);
        ll predi = ((l % 2) == (toask % 2) ? lpred : 1 - lpred);
        if(resi == predi){
            l = toask + 1;
            lpred = 1 - resi;
        }else{
            r = toask - 1;
        }
    }
    return 0;
}


Measured memory_bytes: 852
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    h,w = map(int,ipt().split())
    s = [""]*h+["#"*(w+1)]
    for i in range(h):
        s[i] = input()+"#"
    l = [[0]*(w+1) for _ in [0]*(h+1)]
    r = [[0]*(w+1) for _ in [0]*(h+1)]
    u = [[0]*(w+1) for _ in [0]*(h+1)]
    d = [[0]*(w+1) for _ in [0]*(h+1)]
    sm = [[-3]*(w+1) for _ in [0]*(h+1)]
    for i in range(h):
        si = sm[i]
        li = l[i]
        ui = u[i]
        for j in range(w):
            if s[i][j] == "#":
                continue
            else:
                li[j] = l[i-1][j]+1
                ui[j] = ui[j-1]+1
                si[j] += li[j]+ui[j]
    ma = 0
    for i in range(h):
        ri = r[h-i-1]
        si = sm[h-i-1]
        di = d[h-i-1]
        for j in range(w):
            if s[h-i-1][w-j-1] == "#":
                continue
            else:
                ri[w-j-1] = r[h-i][w-j-1]+1
                di[w-j-1] = di[w-j]+1
                si[w-j-1] += ri[w-j-1]+di[w-j-1]
                if ma < si[w-j-1]:
                    ma = si[w-j-1]
    print(ma)


    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 210304
#include<bits/stdc++.h>
using namespace std;
int n, a, b;
int data[10] = { 0 };

int main() {
	cin >> n;

	for (int i = 0; i < n; ++i) {
		int boxa = 0, boxb = 0;
		bool flag = false;
		for (int j = 0; j < 10; ++j) {
			cin >> data[j];
		}
		for (int j = 0; j < 10; ++j) {
			if (boxa > boxb && boxa < data[j]) {
				boxa = data[j];
			} else if (boxb < data[j]) {
				boxb = data[j];
			} else if (boxa < data[j]) {
				boxa = data[j];
			} else {
				cout << "NO" << endl;
				flag = true;
				break;
			}
		}
		if (!flag)cout << "YES" << endl;
	}
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> s(m),c(m),ans(n);
    bool ok=true;
    for (int i = 0; i < n; i++)
    {
        ans[i]=-1;
    }
    
    for (int i = 0; i < m; i++)
    {
        cin>>s[i]>>c[i];
        s[i]--;
    }
    for (int i = 0; i < m; i++)
    {
        if(ans[s[i]]==-1 || ans[s[i]]==c[i])
        {
            ans[s[i]]=c[i];
        }
        else
        {
            ok=false;
            break;
        }
    }
    if(ans[0]==0 && n>1) ok=false;
    if(ok)
    {
        if(n==1) cout<<max(0,ans[0])<<endl;
        else
        {
            for (int i = 0; i < n; i++)
            {
                if(ans[i]==-1)
                {
                    if(i==0) cout<<1;
                    else cout<<0;
                }
                else
                {
                    cout<<ans[i];
                }
                
            }
            cout<<endl;
        }
        
    }
    else
    {
        cout<<-1<<endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	float a,s,d,f,g,i,j;
	s=0;
	d=100000000;
	while(scanf("%f",&a)!=EOF){
		if(a>s){
			s=a;
		}
		if(a<d){
			d=a;
		}
	}
	printf("%f\n",s-d);
	return 0;
}

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

int main() {
    int r, g, b, n;
    cin >> r >> g >> b >> n;

    int c = 0;
    for (int i = 0; i <= n / r; i++) {
        for (int j = 0; j <= (n - r * i) / g; j++) {
            if ((n - (r * i + g * j)) % b == 0) {
                c++;
            }
        }
    }
    cout << c << endl;
}


Measured memory_bytes: 256
k = int(input())
dp = [[] for i in range(1000)]
dp[0] = list(range(1,10))
D = [-1,0,1]

count = 0
for i in range(10**5):
  count = len(dp[i])
  if count > k:
    ans = dp[i]
    ans.sort()
    print(ans[k-1])
    exit()
  else:
    k -= count
    for j in dp[i]:
      str_j = str(j)
      for d in D:
        nxt = int(str_j[-1])+d
        if 0<=nxt<=9:
          dp[i+1].append(j * 10 + nxt)

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

using namespace std;

#define int long long
#define forr(i,n) for(int i = 0;i < (int)n; i++)
#define forn(i,n) for(int i = n-1;~i;i--)
#define deb(x) cout<<#x<<" " <<x<<"\n";
#define all(x) x.begin(), x.end()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ar array

const int INF = (int)2e9;
const int mxN = (int)2e5;

int n,a[mxN],q,b,c,sum=0;
map<int,int> maps;

void solve(){
	cin >> n;
	 forr(i,n) cin>>a[i],maps[a[i]]++,sum+=a[i];
	 cin>>q;		
	while(q--){
		cin>>b>>c;
		sum-=maps[b]*b;
		sum+=maps[b]*c;
		maps[c]+=maps[b];
		maps[b]=0;
		cout<<sum<<"\n";
	}
}


int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	return 0;
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N, A;
  cin >> N >> A;

  cout << N * N - A << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int x,a,b;
  scanf("%d",&x);
  if(x<500){
    printf("%d",(x/5)*5);
  }
  else{
    a=x/500;
    b=x%500;
    printf("%d", 1000*a+(b/5)*5);
  }
  return 0;
}
    

Measured memory_bytes: 128
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

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

  int N, K;
  cin >> N >> K;

  int total = 0;
  REP(i, N) {
    int x;
    cin >> x;
    total += min(x, K - x);
  }

  cout << total * 2 << endl;
  return 0;
}


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

for i in range(0,10):
    if ntmp>=10**i:
        s+=int((ntmp%10**(i+1))/10**i)
        ntmp-=ntmp%10**(i+1)
    else:
        break

if n%s:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 2940
x = int(input())

m = 1000
bs = {}
for i in range(0, m + 1):
    bs[i ** 5] = i
    bs[i ** 5 * -1] = -i

# print(bs)
for a in range(-m, m + 1):
    b = a ** 5 - x
    if b in bs:
        print(a, bs[b])
        exit(0)


Measured memory_bytes: 9408
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rnfor(i,a,b) for(ll (i) = (a) - 1; (i) >= (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    rep1(i, k)r = r * n-- / i;
    return r;
}

int main(){
    ll n;
    cin >> n;
    ll m = 1e9,ans = 0;
    rep0(i, n){
        ll p;
        cin >> p;
        if(m > p)++ans;
        m = min(m,p);
    }
    pf(ans);
    return 0;
}


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

int main() {
  int n, tmp;
  cin >>n;
  tmp = n%10;
  string ret;
  if (tmp == 2 || tmp == 4 || tmp == 5 || tmp == 7 || tmp == 9) {
    ret = "hon";
  }
  if (tmp == 0 || tmp == 1 | tmp == 6 || tmp == 8) {
    ret = "pon";
  }
  if (tmp == 3) {
    ret = "bon";
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 3628
///#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define all(x) (x).begin(), (x).end()
#define finout(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
#define X first
#define Y second

using namespace std;
const int MOD = 1e9 + 7;

typedef pair <int, int> pii;
typedef vector <int> vi;
inline int ni() {int x; cin >> x; return x;}
template <class T>
inline T nt() {T x; cin >> x; return x;}
inline void print(){}
template<typename T, typename ...TAIL>
inline void print(const T &t, TAIL... tail) {cout << t; print(tail...);}
inline void input() {return;}
template<typename T, typename ...TAIL>
inline void input(T &t, TAIL&... tail) {cin >> t; input(tail...);}

const int N = 2 * 1005001;
const int inf = 1e9 + 7;
const double PI = 3.14159265359;

signed main () {
    ios_base::sync_with_stdio(NULL);  cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n= s.size();
    map <int, int> mp;
    for (int i = 0; i < n; i++) {
        mp[s[i]] = 1;
    }
    if ((mp['S']^mp['N']) || (mp['E']^mp['W']))
        cout << "No\n";
    else
        cout << "Yes\n";
    return 0;
}




/*
5
1 2 3 4 5
2
1
1 5

*/











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

int main(){
	int n,q;
	while(cin >> n >> q,n&&q){
		int date[101] = {0};
		for(int i=0;i<n;i++){
			int m;
			cin >> m;
			for(int i=0;i<m;i++){
				int d;
				cin >> d;
				date[d]++;
			}
		}
		int ans = 0;
		for(int i=1;i<101;i++){
			if(date[ans] < date[i]){
				ans = i;
			}
		}
		if(date[ans] >= q){
			cout << ans << endl;
		} else {
			cout << 0 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <vector>
using namespace std;
typedef pair<int, int> P;
int main(void){
    int n, a[50], amax = -1e7, amin = 1e7, positive = 1;
    vector<P> ans;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
        amax = max(amax, a[i]);
        amin = min(amin, a[i]);
    }
    if(amax <= 0){
        positive = 0;
    }else if(amin < 0){
        int t = 0;
        if(amax >= -amin){
            for(int i=0;i<n;i++){
                if(a[t] < a[i])t = i;
            }
        }else{
            for(int i=0;i<n;i++){
                if(a[t] > a[i])t = i;
            }
            positive = 0;
        }
        for(int i=0;i<n;i++){
            ans.push_back(P(t+1, i+1));
        }
    }
    if(positive == 1){
        for(int i=0;i<n-1;i++){
            ans.push_back(P(i+1, i+2));
        }
    }else{
        for(int i=n;i>1;i--){
            ans.push_back(P(i, i-1));
        }
    }
    
    
    
    
    cout << ans.size() << endl;
    for(int i=0;i<ans.size();i++){
        cout << (ans[i].first) << " " << (ans[i].second) << endl;
    }
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = sorted(map(int, input().split()))
C = []
for _ in range(M):
  C.append([int(i) for i in input().split()])
C.sort(key=lambda x: -x[1])
cur = 0
ans = 0
for a in A:
  if cur != len(C) and C[cur][0] == 0:
    cur += 1
  if cur != len(C) and a < C[cur][1]:
    ans += C[cur][1]
    C[cur][0] -= 1
  else:
    ans += a
print(ans)

Measured memory_bytes: 30188
N = int(input())
A = map(int, raw_input().split())
ANS = set()

for j in range(N, 0, -1):
    s = 0
    for k in range(j+j, N+1, j):
        if k in ANS:
            s += 1

    am = s % 2
    if A[j-1] != am:
        ANS.add(j)

print(len(ANS))
str_ANS = [str(j) for j in ANS]
print(" ".join(str_ANS))

Measured memory_bytes: 26512
#include <cstdio>

int R[200005];

int main() {
	int n; scanf("%d", &n);
	scanf("%d", &R[0]);
	int min = R[0], ans = -2e9;
	for (int i = 1; i < n; ++i) {
		scanf("%d", &R[i]);
		if (R[i] - min > ans) ans = R[i] - min;
		if (R[i] < min) min = R[i];
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 3476
fn main() {
    proconio::input! {
        s: proconio::marker::Chars,
    }
    if s.iter().filter(|x| **x != 'x').collect::<Vec<_>>()
        != s.iter().rev().filter(|x| **x != 'x').collect::<Vec<_>>()
    {
        println!("-1");
    } else {
        let mut nidx = 0;
        let mut ridx = s.len() - 1;
        let mut count = 0usize;
        while nidx < ridx {
            match (s[nidx], s[ridx]) {
                ('x', 'x') => {
                    nidx += 1;
                    ridx -= 1;
                }
                (_, 'x') => {
                    ridx -= 1;
                    count += 1;
                }
                ('x', _) => {
                    nidx += 1;
                    count += 1;
                }
                (nc, rc) if nc != rc => unreachable!(),
                (_nc, _rc) => {
                    nidx += 1;
                    ridx -= 1;
                }
            }
        }
        println!("{}", count);
    }
}


Measured memory_bytes: 4244
#%%
s = input()
if s[:7] == 'keyence':
    ans = 'YES'
elif s[-7:] == 'keyence':
    ans = 'YES'
elif s[0] == 'k' and s[-6:] == 'eyence':
    ans = 'YES'
elif s[:2] == 'ke' and s[-5:] == 'yence':
    ans = 'YES'
elif s[:3] == 'key' and s[-4:] == 'ence':
    ans = 'YES'
elif s[:4] == 'keye' and s[-3:] == 'nce':
    ans = 'YES'
elif s[:5] == 'keyen' and s[-2:] == 'ce':
    ans = 'YES'
elif s[:6] == 'keyenc' and s[-1:] == 'e':
    ans = 'YES'
else:
    ans = 'NO'


print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
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> v(N);
    int sum = 0;    
    REP(i, N) {
        int a;
        cin>>a;
        sum+=a;
        v[i]=a;
    }
    sort(v.begin(),v.end());

    if(sum%10==0) {
        for(auto x: v){
            if(x%10!=0){
              	sum-=x;
                break;
            }
        }
    }
    if(sum%10!=0) cout << sum << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+10;
typedef long long ll;

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

struct dat {
	ll v;double t;
} q[N];

int n,L,h=1,t=0;
double s;
ll sumv=0;

int main() {
	cin>>n>>L;
	for(int i=1;i<=n;i++) {
		ll T,v;cin>>T>>v;
		while(sumv+v>L) {
			ll tmp=min(q[h].v,sumv+v-L);
			q[h].v-=tmp;sumv-=tmp;s-=q[h].t*tmp;
			if(!q[h].v) ++h;
		}
		q[++t]=(dat){v,T};
		sumv+=v;s+=v*T;
		while(h<t&&q[t-1].t>=q[t].t) {
			q[t-1].t=(q[t-1].t*q[t-1].v+q[t].t*q[t].v)/(q[t-1].v+q[t].v);
			q[t-1].v+=q[t].v;--t;
		}
		cout<<setprecision(10)<<fixed<<s/L<<endl;
	}
	return 0;
}


Measured memory_bytes: 18304