akhauriyash/Code-Regression huggingface dataset:
n = int(input())
h = list(map(int, input().split()))
a, count = 0, 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    a += 1
    if i == n-2 and count < a:
      count = a
  else:
    if count < a:
      count = a
    a = 0
print(count)


Measured memory_bytes: 14252
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <tuple>
using namespace std;

string s;

signed main() {
	int i;
	
	cin >> s;
	int cnt = 0;
	for (i = 0; i < s.length(); i++) {
		if (s[i] == '0') cnt++;
		else cnt--;
	}
	
	cout << s.length() - abs(cnt) << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
const ll MOD = 998244353;

int main() {
	ll A, B, V, W, T;
	cin >> A >> V;
	cin >> B >> W;
	cin >> T;
	if (W >= V) {
		cout << "NO" << endl;
	}
	else {
		ll D = abs(A - B);
		if ((V - W) * T >= D) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int ans=0;
	string s, t;
	cin>>s>>t;
	for(int i=0;i<3;i++) ans+=s[i]==t[i];
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [0]*n
for j in range(0,n):
    s[j] = input()
for j in range(0,n-1):
    if s[j][len(s[j])-1] != s[j+1][0]:
        print('No')
        break
    elif s.count(s[j]) >= 2:
        print('No')
        break
    elif j == n-2:
        print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N,K; cin >> N >> K; 
    int a=N/K;
    if(K%2==1){
        cout << a*a*a << endl;
    }
    else {
        ll ans=0; 
        ans+=a*a*a;
        int p=N-K/2;
        if(p>=0) {
            int pos=1;
            rep(i,3) pos*=p/K+1;
            ans+=pos;
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))

int n,m,h,k;

int dpc[1<<8+5];
struct edge{
	int to,co,ct,ki;
};

vector<edge> vs[105];

int dp[105][30];

typedef pair<int,mp> mmp;

int st,gl;
int main(void){
	for(;;){
		scanf("%d%d%d%d",&n,&m,&h,&k);
		if(n==0)break;
		reg(i,1,n)vs[i].clear();
		rep(i,m){
			int a,b,c,p,q;
			scanf("%d%d%d%d%d",&a,&b,&c,&p,&q); q--;
			edge e;
			e.to=b; e.co=c; e.ct=p; e.ki=q;
			vs[a].push_back(e);
			e.to=a;
			vs[b].push_back(e);
		}
		int pp;
		scanf("%d%d%d",&st,&gl,&pp);
		memset(dpc,-1,sizeof(dpc));
		rep(i,pp){
			int c,d,a,s=0;
			scanf("%d%d",&d,&c);
			rep(j,d){
				scanf("%d",&a); a--;
				s |= (1<<a);
			}
			int& nc=dpc[s];
			if(nc==-1 || c<nc)nc=c;
		}
		
		dpc[0]=0;
		rep(i,1<<k)rep(j,1<<k){
			if(dpc[i]==-1 || dpc[j]==-1)continue;
			//printf("%d %d %d\n",i,j,i-j);
			int tc=dpc[i]+dpc[j];
			int &c=dpc[i|j];
			if(c==-1 || tc<c)c=tc;
		}
		
		int ans=-1;
		rep(i,1<<k){
			if(dpc[i]==-1)continue;
			//printf("%d %d\n",i,dpc[i]);
			memset(dp,-1,sizeof(dp));
			pque(mmp) que;
			que.push(mmp(0,mp(st,0)));
			
			int nmc=-1;
			while(!que.empty()){
				mmp pa=que.top(); que.pop();
				int co=pa.fir,
					no=pa.sec.fir,
					nh=pa.sec.sec;
				//printf("%d: %d %d %d\n",i,co,no,nh);
				if(dp[no][nh]!=-1)continue;
				dp[no][nh]=co;
				if(no==gl){
					nmc=co;
					break;
				}
				rep(j,vs[no].size()){
					edge e=vs[no][j];
					int to=e.to,
						th=nh+e.ct,
						dc=e.co;
					int tc;
					if(i & (1<<e.ki))tc=co;
					else tc=co+dc;
					if(th>h)continue;
					//printf("to %d %d %d\n",to,th,tc);
					if(dp[to][th]!=-1 && dp[to][th]<tc)continue;
					que.push(mmp(tc,mp(to,th)));
				}
			}
			if(nmc<0)continue;
			int na=dpc[i]+nmc;
			if(ans==-1 || na<ans)ans=na;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1528
var input = function()
{
  return input= require('fs').readFileSync('/dev/stdin', 'utf8').split(" ").map(Number);
};

var out = function(x)
{
  console.log(x);
  return x;
}

var divInt =function(a,b)
{
  return Math.floor(a/b);
}

var rem = function(a,b)
{
  return a%b;
}

var div = function(a,b)
{
  return (a/b).toFixed(5);
}

var calc = function(x)
{
  var str = divInt(x[0],x[1]) +" " +  rem(x[0],x[1]) +" " + div(x[0],x[1]);
  out(str);
  return str;
};

calc(input());

Measured memory_bytes: 7908
N = int(raw_input())

for i in range(N):

  A = map(int, raw_input().split())

  B, C = [], []

  B.append(0)
  C.append(0)

  flag = True

  for i in A:
    if B[-1] < i:
      B.append(i)

    elif C[-1] < i:
      C.append(i)

    else:
      flag = False
      break

  if flag:
    print "YES"

  else:
    print "NO"

Measured memory_bytes: 6296
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;
const ll INF = 1001001001001001001;
ll sum[200005];     // 累積和

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }
    
    ll res = INF;
    int left, right;
    for(int i = 3; i < n; ++i){     // 真ん中の切り込み
        ll p, q, r, s;
        
        double S = (double)sum[i - 1] / 2;
        left = upper_bound(sum + 2, sum + i, (ll)S) - sum;
        double temp1 = abs(S - sum[left - 1]);
        double temp2 = INF;
        double temp3 = INF;
        if(left - 1 > 2){
            temp2 = abs(S - sum[left - 2]);
        }
        if(left + 1 <= i - 1){
            temp3 = abs(S - sum[left]);
        }
        if(min({temp1, temp2, temp3}) == temp2){
            --left;
        }
        else if(min({temp1, temp2, temp3}) == temp3){
            ++left;
        }
        
        S = (double)((sum[n] - sum[i - 1]) / 2);
        right = upper_bound(sum + i + 1, sum + n + 1, (ll)(S + sum[i - 1])) - sum;
        temp1 = abs(S - (sum[right - 1] - sum[i - 1]));
        temp2 = INF;
        temp3 = INF;
        if(right - 1 > i){
            temp2 = abs(S - (sum[right - 2] - sum[i - 1]));
        }
        if(right + 1 <= n){
            temp3 = abs(S - (sum[right] - sum[i - 1]));
        }
        if(min({temp1, temp2, temp3}) == temp2){
            --right;
        }
        else if(min({temp1, temp2, temp3}) == temp3){
            ++right;
        }
        
        p = sum[left - 1];
        q = sum[i - 1] - sum[left - 1];
        r = sum[right - 1] - sum[i - 1];
        s = sum[n] - sum[right - 1];
        
        ll temp = abs(max({p, q, r, s}) - min({p, q, r, s}));

        res = min(res, temp);
    }
    
    cout << res << endl;
}

Measured memory_bytes: 2560
#include<stdio.h>
#define SIZE 10

/**
 * 関数宣言
 */
void binarySort(int* datas, int size);

int main(){
	int heights[SIZE];
	int i;
	
	for(i = 0; i < SIZE; i++)
	{
		scanf(" %d", heights+i);
	}
	
	binarySort(heights, SIZE);
	binarySort(heights+1, SIZE-1);
	binarySort(heights+2, SIZE-2);
		
	for(i = 0; i < 3; i++)
	{
		printf("%d\n", heights[i]);
	}
	
	
    return 0;
}

void binarySort(int* datas, int size)
{
	int i;
	int tmp;
	
	for(i = size-1; i >= 0; i--)
	{
		if(datas[i] < datas[i+1])
		{
			tmp = datas[i];
			datas[i] = datas[i+1];
			datas[i+1] = tmp;
		}
	}
	
	return;
}

Measured memory_bytes: 1028
let x, y = Scanf.scanf " %d %d" @@ fun a b -> a, b
let g = [4; 6; 9; 11]
let _ = print_endline @@ if x = 2 || y = 2 then "No" else if List.mem x g then if List.mem y g then "Yes" else "No" else "Yes"

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

typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 
#define printArray(arr) for (int i = 0; i<size(arr); i++) cout << arr[i] << " ";cout << '\n'
#define printVerdict(verdict) cout << (verdict ? "Yes": "No") << '\n'
#define printDecimal(d) printf("%.9f\n", d)
#define inrange(val, start, end) (val >= start && val <= end)
#define phi_v 1.618034

const ll inf = 0x3f3f3f3f;

template <class T1, class T2, class T3> 
void printTuple(tuple<T1, T2, T3> t) {cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << '\n';}
template <class T1, class T2>
void printPair(pair<T1, T2> p) {cout << p.first << " " << p.second << '\n';}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll k; cin >> k;
	ll curr = 7%k;
	bool possible = true;
	ll cnt = 1;
	set<ll> seen{curr};
	while (possible && curr) {
		curr = (curr * 10 + 7)%k;
		cnt++;
		if (present(seen, curr)) possible = false;
		else if (!curr) break;
		else seen.insert(curr);
	}
	if (possible) cout << cnt << '\n';
	else cout << -1 << '\n';
}


Measured memory_bytes: 50476
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <climits>
#include <math.h>
#include <utility>
#include <ctime>
#include <cstdlib>
using namespace std;

typedef long long ll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

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

int main() {
	int w, a, b; cin >> w >> a >> b;
	if (b < a)swap(a, b);
	cout << max(0, b - (w + a)) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (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();
            }
            
            boolean approve = true;
            for (int i=0;i<N;i++) {
                if (A[i]%2==0) {
                    if (A[i]%3!=0 && A[i]%5!=0) {
                        approve=false;
                        break;
                    }
                }
            }
            
            if (approve) {
                System.out.println("APPROVED");
            } else {
                System.out.println("DENIED");
            }
        }
    }

}


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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if (a==b) {
    cout<< c <<endl;
  }
  else if (a==c) {
    cout<< b << endl;
  }
  else{
    cout<< a <<endl;
  }
}



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

main()
{
    int n, q, l, r, a[100001], cnt=0;
    string s;
    cin>>n>>q>>s;
    a[0]=0;
    for(int i=1; i<s.size(); i++)
    {
        if(s[i-1]=='A' && s[i]=='C') cnt++;
        a[i]=cnt;
    }
    while(q--)
    {
        cin>>l>>r;
        cout<<a[r-1]-a[l-1]<<endl;
    }

    return 0;
}


Measured memory_bytes: 1408
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int i,m,n,k,a[131072],f[16]={0},ff;
    scanf("%d%d",&n,&k);
    for(i=1;i<=k;i++){scanf("%d",&a[i]);f[a[i]]++;}
    if(n==0){if(f[0]==0){printf("0\n");return 0;}}
    for(i=n;i<=1000000;i++){
        m=i;ff=1;
        while(m){
            if(f[m%10]){ff=0;}m/=10;
        }
        if(ff){printf("%d\n",i);break;}
    }
    return 0;
}

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

int main(){
    int n, a;
    long long int a_sum=0;
    cin >> n;
    int a_max=-1e6;
    int a_min= 1e6;
    for(int i=0; i<n; i++){
        cin >> a;
        a_max=max(a_max, a);
        a_min=min(a_min, a);
        a_sum += a;
    }
    cout << a_min << " " << a_max << " " << a_sum << endl;
    return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
const int maxn=20;
int ans,n,m,p[maxn],s[maxn][maxn],a[maxn],k[maxn];
inline bool ok()
{
	for(register int i=1;i<=m;i++)
	{
		int sum=0;
		for(register int j=1;j<=k[i];j++)
			sum+=a[s[i][j]];
		if(sum%2!=p[i])
			return 0;
	}
	return 1;
}
void dfs(int x)
{
	if(x>n)
	{
		if(ok())
			ans++;
		return;
	}
	dfs(x+1);
	a[x]=1;
	dfs(x+1);
	a[x]=0;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(register int i=1;i<=m;i++)
	{
		scanf("%d",&k[i]);
		for(register int j=1;j<=k[i];j++)
			scanf("%d",&s[i][j]);
	}
	for(register int i=1;i<=m;i++)
		scanf("%d",&p[i]);
	dfs(1);
	printf("%d",ans);
	return 0;
}



Measured memory_bytes: 256
// B - Break Number
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	vector<int> nums{64,32,16,8,4,2,1};
	int N; cin>>N;
	int num = 1;
	rp(i, 0, nums.size()){
		if(nums[i] <= N){
			num = nums[i];
			break;
		}
	}
	cout<< num <<endl;
}

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

typedef long long signed int ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(obj) (obj).begin(),(obj).end()

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int N;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>N;
	vector<int> P(N);
	int tmp;
	REP(i, N) {
		cin >> tmp;
		P[i] = tmp;
	}
	sort(ALL(P));
	cout << P[N / 2] - P[N / 2 - 1] << endl;
	return 0;
}

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

int main() {
    int n, k;
    scanf("%d %d", &n, &k);

    double m = 1;
    double ans = 0;

    for (int i = n; i > 0; i--) {
        if (i * m >= k) ans += 1 / (m * n);
        else {
            while (i * m < k) m *= 2;
            ans += 1 / (m * n);
        }
    }
  
    printf("%.12f\n", ans);
}

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

int main() {
  char c;
  cin >> c;
  string out;
  if (c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u') out = "vowel";
  else out = "consonant";
  cout << out << endl;
}


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

int main(){
    int x, y;
    while (true)
    {
        cin >> x >> y;
        if(x==0 && y==0) break;
        if(x>y) cout << y << " " << x << endl;
        else cout << x << " " << y << endl;
    }
    
}


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

public class Main {
    public static void main(String args[]) {
	Scanner sc = new Scanner(System.in);

	while (true) {
	    int n = sc.nextInt();
	    int ans = 0;
	    if (n == 0) {
		break;
	    }
	    
	    ans = solve(n);
	    System.out.println(ans);
	}
    }

    public static int solve(int n) {
	//int max = 123456 * 2;
	//int prime[] = new prime[123456 * 2 + 1];
	boolean is_prime[] = new boolean[123456 * 2 + 1];
	int count = 0;

	//int p = 0;
	for (int i = 0; i <= 2 * n; i++) {
	    is_prime[i] = true;
	}

	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= 2 * n; i++) {
	    if (is_prime[i]) {
		// prime[p++] = i;
		for (int j = 2 * i; j <= 2 * n; j += i) {
		    is_prime[j] = false;
		}
	    }
	}
	for (int i = n + 1; i <= 2 * n; i++) {
	    if (is_prime[i]) {
		count++;
	    }
	}
	
	return count;
    }
}

Measured memory_bytes: 12000
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

score = 0
for i in range(n):
    a0 = a[i]-1
    score += b[a0]
    if i < n-1:
        if a[i+1] - a[i] == 1:
            score += c[a0]
print(score)

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

int main() {
  int A,B,C,D;cin >>A>>B>>C>>D;
  if (C%B == 0 && A%D == 0) {
   if (C/B <= A/D) cout << "Yes" << endl;
   else cout << "No" << endl;}
  else if (C%B == 0 && A%D != 0) {
   if (C/B-1 <= A/D) cout << "Yes" << endl;
   else cout << "No" << endl;}
  else if (C%B != 0 && A%D == 0) {
   if (C/B+1 <= A/D) cout << "Yes" << endl;
   else cout << "No" << endl;}
  else {
   if (C/B <= A/D) cout << "Yes" << endl;
   else cout << "No" << endl;}
}


Measured memory_bytes: 3608
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ======================================================================
    int N;
    char[] C;
    Set<Integer> set = new HashSet<>();
    int calc(int now, int val) {
    	if(now >= C.length) {
    		if(val <= N) {
    			String wk = String.valueOf(val);
    			if(wk.contains("7") && wk.contains("5") 
    					&& wk.contains("3") && !set.contains(val)) {
    				set.add(val);
    				return 1;
    			} else return 0;
    		} else {
    			return 0;
    		}
    	}
    	int ans = 0;
    	ans += calc(now+1, val);
    	ans += calc(now+1, val * 10 + 7);
    	ans += calc(now+1, val * 10 + 5);
    	ans += calc(now+1, val * 10 + 3);
    	return ans;
    }
	public void solve() {
		N = ni();
		C = String.valueOf(N).toCharArray();
		out.println(calc(0, 0));
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return sc.nextInt();
    }
    public long nl() {
    	return sc.nextLong();
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] nddi(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 45748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(15);
vector<int> forintinput(int n) {
	vector<int> x;
	for(int i = 0;i < n;i++){
		int ia;
		cin >> ia;
		x.push_back(ia);
	}
	return x;
}
int main(){
	int d;
	cin >> d;
	cout << "Christmas";
	if(d == 25){
		return 0;
	}else{
		for(int i=0;i<25-d;i++) cout << ' ' <<"Eve";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"

typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;

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

    ll ans = 1;
    if((n-1)%11 > 5)ans++;

    ans += ((n-1)/11)*2;

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
// Problem : C - Sum of product of pairs
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
typedef long long       ll;
#define PI                acos(-1)
#define pb                push_back
#define mp                make_pair
#define mt                make_tuple
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define fore(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
#define forr(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
#define deb(x)			  cerr << "# " << (#x) << " = " << (x) << endl;
#define sz(x)             (int)x.size()
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;

typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
const int INF = 1234567890;

ll MOD = 1e9 + 7;

ll modPow(ll b, ll e) {
	if (e == 0) return 1;
	ll res = modPow(b, e>>1);
	res = res * res % MOD;
	if (e&1) res = b * res % MOD;
	return res;
}

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    int n;
    cin >> n;
    ll sum = 0;
    ll sq = 0;
    fore(i, 0, n) {
    	ll x;
    	cin >> x;
    	sum += x;
    	sq += x*x;
    	sum %= MOD;
    	sq %= MOD;
    }
    ll ans = ((sum*sum%MOD) - sq + MOD) % MOD;
    ans = ans * modPow(2, MOD-2) % MOD;
    cout << ans << '\n';
    return 0;
}
// Dinosaurs are cool!

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		const long MOD = 1000000007;

		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			int[] nums = new int[26];
			for (int i = 0; i < n; i++) {
				nums[s[i] - 'a']++;
			}

			int[] doubles = nums.Where(x => x > 1).ToArray();
			if (doubles.Length == 0) {
				long ans = ModInt.Pow(2, n).num - 1;
				Console.WriteLine(ans);
			} else {
				long removes = doubles.Select(x => x).Sum();
				long remains = n - removes;
				long ans = ModInt.Pow(2, remains).num;
				for (int i = 0; i < doubles.Count(); i++) {
					ans = (ans * (doubles[i] + 1)) % MOD;
				}

				Console.WriteLine(ans - 1);
			}
		}
	}

	struct ModInt
	{
		/// <summary>
		/// 剰余を取る値．
		/// </summary>
		public const long Mod = (int)1e9 + 7;

		/// <summary>
		/// 実際の数値．
		/// </summary>
		public long num;
		/// <summary>
		/// 値が <paramref name="n"/> であるようなインスタンスを構築します．
		/// </summary>
		/// <param name="n">インスタンスが持つ値</param>
		/// <remarks>パフォーマンスの問題上，コンストラクタ内では剰余を取りません．そのため，<paramref name="n"/> ∈ [0,<see cref="Mod"/>) を満たすような <paramref name="n"/> を渡してください．このコンストラクタは O(1) で実行されます．</remarks>
		public ModInt(long n) { num = n; }
		/// <summary>
		/// このインスタンスの数値を文字列に変換します．
		/// </summary>
		/// <returns>[0,<see cref="Mod"/>) の範囲内の整数を 10 進表記したもの．</returns>
		public override string ToString() { return num.ToString(); }
		public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
		public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
		public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
		public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

		/// <summary>
		/// 与えられた 2 つの数値からべき剰余を計算します．
		/// </summary>
		/// <param name="v">べき乗の底</param>
		/// <param name="k">べき指数</param>
		/// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
		public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }

		/// <summary>
		/// 与えられた 2 つの数値からべき剰余を計算します．
		/// </summary>
		/// <param name="v">べき乗の底</param>
		/// <param name="k">べき指数</param>
		/// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
		public static ModInt Pow(long v, long k)
		{
			long ret = 1;
			for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
				if ((k & 1) == 1)
					ret = ret * v % Mod;
			return new ModInt(ret);
		}
		/// <summary>
		/// 与えられた数の逆元を計算します．
		/// </summary>
		/// <param name="v">逆元を取る対象となる数</param>
		/// <returns>逆元となるような値</returns>
		/// <remarks>法が素数であることを仮定して，フェルマーの小定理に従って逆元を O(log N) で計算します．</remarks>
		public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
	}

	
}


Measured memory_bytes: 13536
numlist=[0,0,1]+[0]*999998
for i in range(3,1000000,2):
    numlist[i]=1
for i in range(3,1000,2):
    if numlist[i]==1:
        for j in range(i*i,1000000,i):
            numlist[j]=0

cnt=[0,0,1]+[0]*999999
count=1
for i in range(3,1000000,2):
    if numlist[i]:
        count+=1
    cnt[i]=cnt[i+1]=count
while True:
    try:
        n=int(input())
        print(cnt[n])
    except:
        break


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

using namespace std;
using ll = long long;

int main(void)
{
    ll     n;
    char   c;
    string s;
    cin >> n;

    while (n > 0)
    {
        n -= 1;
        c = 'a' + (n % 26LL);
        s = c + s;
        n /= 26LL;
    };

    cout << s << endl;

    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn = 1000 + 5;

double h[maxn];

int main(){
    int n;
    int T;
    int A;
    cin>>n;
    cin>>T>>A;
    int minn=1;
    double minmm=1e20;
    for (int i=0;i<n;i++)
        {
            cin>>h[i];
            double h1=T-(double)h[i]*0.006;
            double h2= h1-A;
            if(h2<0) h2=-h2;
            
            if(minmm>h2)
                {
                    minmm=h2;
                    minn=i+1;
                }
        }
    cout<<minn<<endl;
    return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
	string S;
	cin >> S;

  fx(S.size()-1){
    if(S[x]=='A'&&S[x+1]=='C'){
      ce("Yes")
        return 0;
    }
    
  }
ce("No")
    return 0;
}



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

int main(){
    string s;
    cin>>s;
    int l=0,r=s.size()-1;
    int cnt=0;
    while(l<r){
        if(s[l]==s[r]){
            l++;
            r--;
        }
        else if(s[l]=='x'){
            l++;
            cnt++;
        }
        else if(s[r]=='x'){
            r--;
            cnt++;
        }
        else{
            cnt=-1;
            break;
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<cstdio>
#include<iterator>
#include<string>
#include<queue>
#include<algorithm>
#include<string.h>
using namespace std;
#define MP make_pair
#define F first
#define S second
#define LL long long
#define INF	int(1e9)
typedef pair<int, int> P;
typedef pair<P, P> PP;
inline int in() {
	int temp;
	scanf("%ld", &temp);
	return temp;
}
int n = in();
LL sosu[1001], dp[1001];
int main(){
	for (int i = 1; i <= n; i++) 
	{
		int save = i;
		for (int j = 2; j * j <= i; j++)
		{
			if (!(save % j))
			{
				save /= j;
				sosu[j]++;
				j--;
			}
			if (save == 1)
				break;
		}
		if (save != 1)
			sosu[save]++;
	}
	dp[0] = 1;
	for (int i = 1; i <= n; i++) 
	{
		dp[i] = dp[i - 1] * sosu[i] % (INF + 7);
		dp[i] += dp[i - 1];
		dp[i] %= (INF + 7);
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}


//#########################################

int main() {

long long n=D();
long long fn=1;

while(n>1){
fn=(fn*n)%(1000000007);


n--;
}
cout<<fn;



}




Measured memory_bytes: 256
K, N = map(int, input().split(' '))
A_ls = list(map(int, input().split(' ')))
l, max_l = 0, 0
for i in range(N):
    l = A_ls[(i + 1) % len(A_ls)] - A_ls[i]
    if l < 0:
        l = K - A_ls[i] + A_ls[(i + 1) % len(A_ls)]
    max_l = max(max_l, l)
print(K - max_l)

Measured memory_bytes: 32064
///*
#include<iostream>
using namespace std;

int main() {
	
	int a, b;
	cin >> a >> b;

	if (a != 1 && b != 1) {
		if (a > b) {
			cout << "Alice";
		}
		else if (a == b) {
			cout << "Draw";
		}
		else {
			cout << "Bob";
		}
	}
	else if (a == 1 && b != 1) {
		cout << "Alice";
	}
	else if (a != 1 && b == 1) {
		cout << "Bob";
	}
	else {
		cout << "Draw";
	}
}
//*/

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int n=0;string s;cin>>s;
	rep(i,s.size()) n+=(s[i]=='x');
	if(n<=7) cout<<"YES"<<endl;else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL 

struct node {

  int key;
  struct node *left;
  struct node *right;
  struct node *parent;
};

typedef struct node* Node;
Node root;
 
void insert(int k) {
    
 Node y = NIL;
 Node x = root;
 Node z;  

 z = malloc(sizeof(struct node));
 z->key = k;
 z->left = NIL;
 z->right = NIL;
   
 while(x != NIL) {
    y = x;
  if(z->key < x->key)
    x = x->left;
  
  else x = x->right;
 }
  z->parent = y;
  
  if(y == NIL)
    root = z;
  
  else if(z->key < y->key)
    y->left = z;
  
  else 
    y->right = z;
  
}

void inorder(Node u) {
  
  if(u->left != NIL)
    inorder(u->left);
  printf(" %d",u->key);
  if(u->right != NIL)  
    inorder(u->right); 
}

void preorder(Node u) {
  printf(" %d",u->key);
  if(u->left != NIL)
    preorder(u->left);
  if(u->right != NIL)
    preorder(u->right); 
}

int main(void) {
  
  int i,n,x;
  char c[5];
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++) {
    scanf("%s",c);
    if(c[0] == 'i') {
      scanf("%d",&x);
      insert(x);
    }
    else if(c[0] == 'p') {
      if(root != NIL)   
	inorder(root);
      printf("\n");
      if(root != NIL)
	preorder(root);
      printf("\n");
      
    }
  }
  return 0;
}

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

int main(){
	int r; 
	cin >> r;
	if(r < 1200)
		cout << "ABC";
	if(r >= 1200 && r < 2800)
		cout << "ARC";
	if(r >= 2800)
		cout << "AGC";

	return 0;
}

Measured memory_bytes: 3636
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	s := next()
	t := next()

	ans := len(t)
	for i := 0; i < len(s)-len(t)+1; i++ {
		tmp := count(s[i:i+len(t)], t)
		if tmp < ans {
			ans = tmp
		}
	}
	fmt.Println(ans)
}

func count(s, t string) int {
	ch := len(s)
	for i := 0; i < len(s); i++ {
		if s[i:i+1] == t[i:i+1] {
			ch--
		}
	}
	return ch
}


Measured memory_bytes: 1776
d,n = map(int,input().split())
if d == 0:
    if n == 100:
        print(n+1)
    else:
        print(n)
elif d == 1:
    if n == 100:
        print(n*100+100)
    else:
        print(n*100)
elif d == 2:
    if n == 100:
        print(n*100*100+10000)
    else:
        print(n*100*100)

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

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    string S;
    cin >> S;
    REP(i, S.length())
    {
        cout << "x";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map{it.toInt()}
    val b = readLine()!!.split(" ").map{it.toInt()}
    val c = readLine()!!.split(" ").map{it.toInt()}
    var before = -1
    var result = 0
    for(x in 0..a.size-1){
        val i = a[x]
        result += b[i-1]
        if(i == before+1){
            result += c[before-1]
        }
        before = i
    }
    println(result)
}

Measured memory_bytes: 37740
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const int64_t mod = 1e9 + 7;

int main(void) {
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  vector<pair<int64_t, int64_t>> PN(N);
  int zeros = 0;
  int minus = 0;
  rep(i, N) {
    int A;
    cin >> A;
    if (A == 0) ++zeros;
    if (A < 0) ++minus;
    PN[i] = {abs(A), A};
  }
  sort(PN.begin(), PN.end(), [](const auto &lhs, const auto &rhs) {
    if (lhs.first == rhs.first)
      return lhs.second < rhs.second;
    else
      return lhs.first > rhs.first;
  });

  if ((N - zeros) < K) {  // have to include zero.
    cout << 0 << endl;
    return 0;
  } else if (N == K || N == minus) {
    int64_t answer = 1;
    if (K % 2) {
      rep(i, K) {
        answer = answer * PN[N - i - 1].second % mod;
        answer = (answer + mod) % mod;
      }
    } else {
      rep(i, K) {
        answer = answer * PN[i].second % mod;
        answer = (answer + mod) % mod;
      }
    }
    cout << answer << endl;
    return 0;
  }

  int64_t tmp_ans0 = 1;
  int64_t last_pn = 1;
  int64_t last_mn = 1;
  int64_t last_pi = -1;
  int64_t last_mi = -1;
  bool is_pos = true;
  for (int i = 0; i < K; ++i) {
    if (PN[i].second > 0) {
      if (last_pi != -1) {
        tmp_ans0 = tmp_ans0 * last_pn % mod;
      }
      last_pn = PN[i].second;
      last_pi = i;
    } else {
      if (last_mi != -1) {
        tmp_ans0 = tmp_ans0 * last_mn % mod;
        tmp_ans0 = (tmp_ans0 + mod) % mod;
      }
      last_mn = PN[i].second;
      last_mi = i;
      is_pos = !is_pos;
    }
  }

  if (is_pos) {
    if (last_pi != -1) tmp_ans0 = tmp_ans0 * last_pn % mod;
    if (last_mi != -1) tmp_ans0 = tmp_ans0 * last_mn % mod;
    tmp_ans0 = (tmp_ans0 + mod) % mod;
    cout << tmp_ans0 << endl;
    return 0;
  }

  int next_pn = 0;
  int next_mn = 0;
  for (int i = K; i < N; ++i) {
    if (next_pn == 0 && PN[i].second > 0) {
      next_pn = PN[i].second;
      if (next_mn != 0) break;
    }
    if (next_mn == 0 && PN[i].second < 0) {
      next_mn = PN[i].second;
      if (next_pn != 0) break;
    }
  }
  int64_t tmp_p = last_pn * next_pn;
  int64_t tmp_m = last_mn * next_mn;
  if (last_pi == -1) tmp_m = 0;
  tmp_ans0 = (tmp_ans0 * (max(tmp_p, tmp_m) % mod)) % mod;
  cout << tmp_ans0 << endl;
  return 0;
}


Measured memory_bytes: 6400
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
const int N = 1e5+5;


int p[N];
int f[N];
int fa(int x) {
	return (f[x] == x)? x : (f[x] = fa(f[x]));
}
vector<int> group[N];


int main() {
	int n, m;
	while(~scanf("%d %d", &n, &m)) {
		for(int i = 1; i <= n; ++i) {
			group[i].clear();
			f[i] = i;
			scanf("%d", &p[i]);
		}
		
		for(int i = 0; i < m; ++i) {
			int a, b; scanf("%d %d", &a, &b);
			int f1 = fa(a);
			int f2 = fa(b);
			if(f1 != f2) {
				f[f1] = f2;
			}
		}


		for(int i = 1; i <= n; ++i) {
			int father = fa(i);
			group[father].push_back(i);
		}
		
		int result = 0;
		for(int i = 1; i <= n; ++i) {
			if(group[i].size() > 0) {
				map<int, int> mp;
				for(int j = 0, len = group[i].size(); j < len; ++j) {
					mp[group[i][j]] ++;
				}
				for(int j = 0, len = group[i].size(); j < len; ++j) {
					if(mp.find(p[group[i][j]]) != mp.end()) {
						result ++;
					}
				}
			}
		}
		printf("%d\n", result);
	}
	return 0;	
}


Measured memory_bytes: 8440
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): return print(arg)
def Y(): print("Yes"); return
def N(): print("No"); return

#####Shorten#####
def DD(arg): return defaultdict(arg)

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

S = S()
d = DD(int)
for s in S:
  d[s] += 1
for k in d:
  if d[k]%2:
    N()
    exit()
Y()


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <unordered_map>
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

int main(void)
{
    int r;
    cin >> r;
    cout << r*r*3<<endl;

    return 0;
}

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

typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vstr;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define asd cout << "ok" << endl;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define trav(it, m) for(auto it = m.begin(); it it!= m.end(); it++)

const char nl = '\n';
const int MOD = 1e9 +7;
const ll INF = 1e19;
const ld PI = acos((ld)-1);
const int MX = 2e5 + 5;

int main(){

  ios_base::sync_with_stdio(0); cin.tie(0);
  int n; cin >>n ;
  map<int, bool> m;
  m[n] = 1;
  for(int i = 2; i <= 1000000; i++)
  {
    if(n%2){
      n = n*3 +1;
      if(m[n]){
        cout << i << nl;
        return 0;
      }
      m[n] = 1;
    }
    else{
      n /= 2;
      if(m[n]){
        cout << i << nl;
        return 0;
      }
      m[n] = 1;
    }
  }





  return 0;
}



Measured memory_bytes: 3544
N=int(input())
F=[[0]*10]*N
ans=-10e+9
for i in range(N):
    F[i]=list(map(int,input().split()))
    
P=[[0]*10]*N

for i in range(N):
    P[i]=list(map(int,input().split()))
SUM=[["" for i in range(10)] for i in range(N)]
for i in range(N):
    tm=0
    for j in range(10):
        tm+=P[i][j]
        SUM[i][j]=tm


for i in range(1,2**10):
    total=0
    bit=[0]*10
    for j in range(10):
        if(i>>j&1):
            bit[j]=1
    for j in range(N):
        tmp=0
        for k in range(10):
            if(bit[k]==1 and bit[k]==F[j][k]):
                tmp+=1
        total+=P[j][tmp]
    ans=max(ans,total)

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin>>A>>B;
  vector<int> a(5),b(5);
  for(int i = 0;i<5;i++){
    a.at(i) = A%10;
    A = A/10;
    b.at(i) = B%10;
    B = B/10;
  }
  int fr = 100*a.at(4)+10*a.at(3)+a.at(2),to = 100*b.at(4)+10*b.at(3)+b.at(2);
  int ans = to-fr+1;
  if(a.at(3)*10+a.at(4)<10*a.at(1)+a.at(0)) ans--;
  if(b.at(3)*10+b.at(4)>10*b.at(1)+b.at(0)) ans--;
  cout << ans << endl;
}

Measured memory_bytes: 256