akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main() {
  int n, x;
  int i, j, k;
  int cnt;
  
  while (1) {
    scanf("%d%d", &n, &x);
    if (n==0 && x==0) break;
    cnt=0;
    for (i = 1; i <= n; i++)
      for (j = i+1; j <= n; j++)
	for (k = j+1; k <= n; k++)
	  if (i+j+k == x) cnt++;
    
    printf("%d\n", cnt);
  }
  

  return 0;
}



Measured memory_bytes: 2144
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int a, b;
	cin >> a >> b;
	if(a*b%2==0) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

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

signed main () {
  int K,A,B;
  cin >> K >> A >> B ;

  for(int i = A;i < B+1 ;i++){ 

if(B < K){cout << "NG" <<endl;
return 0;
}
    if(i%K ==0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    int n, m, max = 0;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    cin >> m;
    vector<string> t(m);
    for (int i = 0; i < m; ++i) {
        cin >> t[i];
    }

    for (int i = 0; i < n; ++i) {
        int ta = count(s.begin(), s.end(), s[i]);
        int tb = count(t.begin(), t.end(), s[i]);
        int t = ta - tb;
        if (t > max) max = t;
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
int main()
{
    int  s , t ;
    cin >> s >> t ;
    if((s==1 && t==2) || (s==2 && t==1))
    cout << 3 ;
    else if((s==2 && t==3) || (s==3 && t==2))
    cout << 1 ;
    else
    cout << 2 ;



    return 0 ;
}


Measured memory_bytes: 256
import bisect
n=int(raw_input())
a=[int(raw_input()) for _ in xrange(n)]
a=a+a
suma=[0]*(2*n+1)
for i in xrange(n*2):
    suma[i+1]+=suma[i]+a[i]
suma=suma+[n*10**9+5]+[float('inf')]
ans=0
for i in xrange(n):
    r=n*10**9+1
    l=1
    while r-l>1:
        m=(r+l)/2
        c2=bisect.bisect_left(suma,m+suma[i])
        c3=bisect.bisect_left(suma,m+suma[c2])
        if suma[n+i]-suma[c3]>=m:
            l=m
        else:
            r=m
    ans=max(ans,l)
print(ans)

Measured memory_bytes: 19636
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;

char str[1005];  
int n,hsh[30],cnt,len; 

bool cmp(string a,string b){
	return a < b;
}

int main()  
{  
    string str[100];
    int N,M;
    cin >> N >> M;
    for(int i = 0;i < N;i++){
    	cin >> str[i];
	}
	sort(str,str+N,cmp);
	for(int i = 0;i < N;i++){
		cout << str[i];
	}
	cout << endl;
    return 0;  
}  

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

#define pb push_back
#define mp make_pair

typedef long long ll;

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

  ll x = 1, y = 1;
  for(int i = 0; i < n; i++){
    int t, a;
    cin >> t >> a;

    ll b = (x+a-1)/a;
    ll u = (y+t-1)/t;

    x = a * max(b, u);
    y = t * max(b, u);
  }

  cout << x + y << endl;

  return 0;
}


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

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

}

Measured memory_bytes: 3012
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	int R;
	cin>>R;
	if(R<1200){
		cout<<"ABC"<<endl;
	}else if(R<2800){
		cout<<"ARC"<<endl;
	}else{
		cout<<"AGC"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    int count_max = 0;
    for (int i = 0; i < n - 1; i++) {
        int count = 0;
        vector<int> vx(26, 0);
        vector<int> vy(26, 0);
        for (int x = 0; x < i + 1; x++) {
            vx[s[x] - 'a']++;
        }
        for (int y = i + 1; y < n; y++) {
            vy[s[y] - 'a']++;
        }
        for (int j = 0; j < 26; j++) {
            if (vx[j] * vy[j] != 0) {
                count++;
            }
        }
        count_max = max(count_max, count);
    }

    cout << count_max << endl;

    return 0;
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1001001000;

int main(){
   ll N,A[5];
   cin >> N;
   rep(i,5)cin >> A[i];
   sort(A,A+5);
   cout << ((N + A[0] -1) / A[0]) -1 + 5;
   return 0;
}

Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ff first 
#define ss second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define testcase(t) int t;cin>>t;while(t--)
#define mp(x,y) make_pair(x,y)
#define in(x) insert(x)
#define rep(i,a,b)  for (__typeof((b)) i=(a);i<=(b);i++)
#define nrep(i,a,b)  for (__typeof((b)) i=(b);i>=(a);i--)
#define PI 3.14159265358979323846
#define SP(x) setprecision(x)
#define reflex ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define M 1000000007
#define sz(a) (int)a.size()
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(x) x.resize(distance(x.begin(), unique(all(x))))
#define mem(arr,val) memset(arr,val,sizeof(arr)) //For "0" and "-1"                  
#define inp0(a,n) rep(i,0,n-1) cin>>a[i];
#define inp1(a,n) rep(i,1,n) cin>>a[i]; 
#define prll(x) printf("%lld",x)
#define nth_ele(v,n) nth_element(v.begin(), v.begin()+n ,v.end())//O(N)
#define DEBUG(x) cerr << (#x) << ": " << (x) << endl
#define DEBUGV(x) for(auto IT:x) cout<<IT<<" "; cout<<endl;
#define minheap priority_queue <int, vector<int>, greater<int>>
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll gcd(ll n1, ll n2){if(n2!=0) return gcd(n2, n1%n2);else return n1;}
ll powerM(ll a,ll b){if(b==0) return 1;  if(b==1) return a%M; ll x=powerM(a,b/2)%M; if(b&1){return ((((a%M)*(x%M))%M)*(x%M))%M;}return ((x%M)*(x%M))%M;}
ll power(ll a,ll b){if(b==0) return 1;  if(b==1) return a; ll x=power(a,b/2); if(b&1){return ((((a)*(x)))*(x));}return ((x)*(x));}
 
const ll INF=1e18; 
const int SIZE = 100006;

int main(){
	long double a,b,c;
	cin>>a>>b>>c;
	if(c<a || c<b){
		cout<<"No\n";
		return 0;
	}
	long double dd = c-a-b;
	dd = dd*dd;
	long double ee = 4*a*b;
	// cout<<dd<<" "<<ee<<endl;
	if(ee<dd) cout<<"Yes\n";
	else cout<<"No\n";
}

 // 4 ab < (c-a-b)*()

Measured memory_bytes: 256
a=input()
b=input()
c=input()
flag = "a"

while 1:
    if flag=="a":
        if a=="":
            print("A")
            break
        flag=a[0]
        a=a[1:]
    elif flag=="b":
        if b=="":
            print("B")
            break
        flag=b[0]
        b=b[1:]
    elif flag=="c":
        if c=="":
            print("C")
            break
        flag=c[0]
        c=c[1:]

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

class Quaternion
{
public:
	int r, i, j, k;
	
	Quaternion(int r = 0, int i = 0, int j = 0, int k = 0)
	: r(r), i(i), j(j), k(k) {}
	
	Quaternion operator+()
	{
		return *this;
	}
	
	Quaternion operator-()
	{
		return Quaternion(-r, -i, -j, -k);
	}
	
	Quaternion operator+(Quaternion& other)
	{
		return Quaternion(r + other.r, i + other.i, j + other.j, k + other.k);
	}
	
	
	Quaternion operator-(Quaternion& other)
	{
		return (-other) + (*this);
	}
	
	Quaternion operator*(Quaternion& other)
	{
		return Quaternion(r * other.r - i * other.i - j * other.j - k * other.k,
						  r * other.i + i * other.r + j * other.k - k * other.j,
						  r * other.j - i * other.k + j * other.r + k * other.i,
						  r * other.k + i * other.j - j * other.i + k * other.r);
	}
};

int main()
{
	for(int n; cin >> n && n; )
	{
		rep(i, n)
		{
			Quaternion a, b, c;
			
			cin >> a.r >> a.i >> a.j >> a.k;
			cin >> b.r >> b.i >> b.j >> b.k;
			
			c = a * b;
			
			cout << c.r << " " << c.i << " " << c.j << " " << c.k << endl;
		}
	}
}

Measured memory_bytes: 0
//ΔAGC035A
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int NN = 333333;
int n,a[NN];
void Y(){
	cout<<"Yes";
	exit(0);
}
void N(){
	cout<<"No";
	exit(0);
}
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i=i+1)
		scanf("%d",a+i);
	sort(a+1,a+n+1);
	if(a[n]==0)
		Y();
	if(n%3)
		N();
	n/=3;
	if(a[1]!=a[n]||a[n+1]!=a[n*2]||a[n*2+1]!=a[n*3])
		N();
	if(a[n]^a[n*2]^a[n*3])
		N();
	Y();
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
const int INF=1e9;
int main(){
  int n,k,a[100100];
  bool f,num[100100];
  while(cin>>n>>k&&(n||k)){
    memset(num,false,sizeof(num));
    f=false;
    REP(i,k){
      cin>>a[i];
      num[a[i]]=true;
      if(a[i]==0){
        f=true;
        continue;
      }
    }
    vector<P>V;
    int s=-1;
    for(int i=1;i<=n;i++){
      if(num[i]){
        if(s==-1){
          s=i;
        }
      }else{
        if(s!=-1){
          V.PB(MP(s,i));
          s=-1;
        }
      }
    }
    if(s!=-1){
      V.PB(MP(s,n+1));
    }
    int ans=-1;
    REP(i,V.size()){
      if(f){
        if(i==0){
          ans=max(ans,V[i].second-V[i].first+1);
        }else{
          if(V[i-1].second+1==V[i].first){
            ans=max(ans,V[i].second-V[i-1].first);
          }else{
            ans=max(ans,V[i].second-V[i].first+1);
          }
        }
      }else{
        ans=max(ans,V[i].second-V[i].first);
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1796
n = int(input())
s = list(map(int, input().split()))

q = int(input())
t = list(map(int, input().split()))

count = 0

for i in range(q):
    s.append(t[i])
    j = 0
    while t[i] != s[j]:
        j += 1
    if j != n:
        count += 1
    del s[n]
print(count)


Measured memory_bytes: 6320
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n = int(input())
a = list(map(int,input().split()))
c  = 1
for i in range(n):
    c *= a[i]
c -= 1
ans = 0
for i in range(n):
    ans += c%a[i]
print(ans)

Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <cmath>
#include <sstream>
#include <queue>
#include <map>
#include <cstring>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
    int X;
    cin >> X;
    long long n = 2;
    for (int i = 0; i < X; ++i) {
        n = (n + 1) << 1;
    }
    cout << n << endl;
    return 0;
}

Measured memory_bytes: 384
p=print
r=range
def a(i,j,k,l=0):p("+<"[l],i,j,k)
def b(i):a(i,i,i)
def d(x):
	a(x,3,x)
	for t in r(30):b(v:=x+4);a(v,3,6),*map(b,[6]*(29-t));a(6,x,T:=x*60+35+t,1);a(v,T,v)
p(6484)
a(0,1,3)
a(2,3,3,1)
d(0)
d(1)
for t in r(60):b(2);[(a(34+t-s,95+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
typedef pair<int,int> pii;
typedef long long ll;	


int n;
ll sum;



int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	cin >> n;
	for (int i=1;i*i<=n;i++){
		for (int j=i;j*i<n;j++){
			if (i == j) {
				sum++;
			}
			else {
				sum+=2;
			}
		}
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
#define INF 1e9

static const int seed=6;
static const int D=365;
static const int ntype=26;
static int ans[D+1];
static int max_score=-INF;
static int t=1e5;
class Contest{
public:
    Contest(){
        last=0;
    }
    int s[D+1];
    int c;
    int last;
};

static Contest contest[ntype+1];

void Input(){
    int d;
    cin>>d;
    for(int i=1;i<=ntype;++i){
        int t;
        cin>>t;
        contest[i].c=t;
    }
    for(int day=1;day<=D;++day){
        for(int type=1;type<=ntype;++type){
            int t;
            cin>>t;
            contest[type].s[day]=t;
        }
    }
}

int evaluate(){
    int sum=0;
    vector<int> l(ntype+1,0);
    for(int day=1;day<=D;++day){
        int type=ans[day];
        sum+=contest[type].s[day];
        l[type]=day;
        for(int t=1;t<=ntype;++t){
            sum-=contest[t].c*(day-l[t]);
        }
    }
    return sum;   
}

void Output(){
    for(int d=1;d<=D;++d) cout<<ans[d]<<endl;
}

void Init(){
    for(int d=1;d<=D;++d) ans[d]=rand()%ntype+1;
}

void Greedy(){
    vector<int> l(ntype+1,0);
    int score=0;
    for(int d=1;d<=D;++d){
        for(int i=1;i<=ntype;++i) score-=contest[i].c*(d-l[i]);
        int temp=score;
        int t=-1;
        for(int i=1;i<=ntype;++i){
            int k=contest[i].s[d]+contest[i].c*(d-l[i])+score;
            if(k>temp){
                temp=k;
                t=i;
            }
        }
        ans[d]=t;
        l[t]=d;
    }
}

void solve(int time){
    vector<bool> seen(D+1,false);
    max_score=evaluate();
    for(int i=0;i<time;++i){
        int p=rand()%D+1;
        if(seen[p]) continue;
        int temp=ans[p];
        ans[p]=rand()%ntype+1;
        int temp_score=evaluate();
        if(max_score<temp_score){
            max_score=temp_score;
            seen[p]=true;
        }
        else ans[p]=temp;
    }
}

int main(){
    srand(seed);
    Input();
    Greedy();
    solve(t);
    Output();
}

Measured memory_bytes: 3672
# coding: utf-8
class seg_tree:
    def __init__(self,n,minimum=True):
        self.inf = 2**31-1
        self.size = 2**(len(bin(n-1))-2)*2-1
        self.minimum = minimum
        if self.minimum:
            self.tree = [self.inf for i in range(self.size)]
        else:
            self.tree = [-1 for i in range(self.size)]
     
    def data(self):
        return self.tree[self.size//2:]
 
    def update(self,i,x):
        i=self.size//2+i
        self.tree[i]=x
        if self.minimum:
            while 1:
                i=(i-1)//2
                self.tree[i]=min(self.tree[i*2+1],self.tree[i*2+2])
                if i<=0:
                    break
        else:
            while 1:
                i=(i-1)//2
                self.tree[i]=max(self.tree[i*2+1],self.tree[i*2+2])
                if i<=0:
                    break
 
    def _mincheck(self,s,t,l,r,_p=0):
        if s<=l and r<=t:
            return self.tree[_p]
        elif r<s or t<l:
            return self.inf
        else:
            return min(self._mincheck(s,t,l,l+(r-l)//2,_p*2+1),self._mincheck(s,t,l+(r-l)//2+1,r,_p*2+2))
     
    def _maxcheck(self,s,t,l,r,_p=0):
        if s<=l and r<=t:
            return self.tree[_p]
        elif r<s or t<l:
            return -1
        else:
            return max(self._maxcheck(s,t,l,l+(r-l)//2,_p*2+1),self._maxcheck(s,t,l+(r-l)//2+1,r,_p*2+2))
 
    def find(self,s,t):
        if self.minimum:
            return self._mincheck(s,t,0,self.size//2)
        else:
            return self._maxcheck(s,t,0,self.size//2)
 
n,q=map(int,input().split())
st=seg_tree(n)
ans=[]
for i in range(q):
    c,x,y=map(int,input().split())
    if c:
        ans.append(st.find(x,y))
    else:
        st.update(x,y)
print(*ans,sep='\n')


Measured memory_bytes: 10916
n, m = map(int, input().split())
s = input()
s = ''.join(reversed(s))
ans = []
index = 0
while index < n:
    next_index = -1
    for j in range(min(index + m, n), index, -1):
        if s[j] == '0':
            next_index = j
            break
    if next_index == -1:
        ans = [-1]
        break
    ans.append(next_index - index)
    index = next_index 
print(' '.join(list(map(str, list(reversed(ans))))))

Measured memory_bytes: 17584
from collections import defaultdict
N,Ma,Mb=map(int,raw_input().split())

dp=defaultdict(lambda: float("inf"))
dp[(0,0)]=0

for i in range(N):
	a,b,c=map(int,raw_input().split())
	for j in dp.items():
		x=j[0][0]
		y=j[0][1]
		z=j[1]
		na, nb, nc = x+a, y+b, z+c 
		dp[(na, nb)]=min( dp[(na, nb)], nc)


ans=float("inf")
for i in dp.items():
	x=i[0][0]
	y=i[0][1]
	z=i[1]
	if x==0 and y==0:
		continue
	if x*Mb==y*Ma:
		ans=min(ans,z)

else:
	if ans==float("inf"):
		print -1
	else:
		print ans

Measured memory_bytes: 7476
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	int X, Y;
	cin >> X >> Y;

	int ans = 0;
	if (X <= 3) ans += (4 - X) * 100000;
	if (Y <= 3) ans += (4 - Y) * 100000;
	if (X == 1 && Y == 1) ans += 400000;

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
s = int(input())
a = set()
a.add(s)
def collatz(n):
	if n%2 == 0:
		return n//2
	else:
		return 3*n + 1
c = 1
while True:
	c += 1
	a.add(s)
	s = collatz(s)
	if s in a:
		print (c)
		exit()

Measured memory_bytes: 2940
#include <iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;

int main()
{
    int n;
    int ls,minn=1e8,sc=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&ls);
        if(ls<=minn)
        {
            sc++;
            minn=ls;
        }
    }
    printf("%d\n",sc);
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.lang.Math;

public class Main {
	public static void main(String[] args) {
		FS reader = new FS();
		// write reader
		String S = reader.next();
		char[] s = new char[S.length()];
		for (int i=0; i<S.length(); i++) {
		    s[i] = S.charAt(i);
		}
		
		boolean isAllSame = true;
		for (int i=0; i<S.length(); i++) {
		    if (S.charAt(i) != S.charAt(0)) isAllSame = false;
		}
		if (isAllSame) {
		    System.out.println(0);
		    return;
		}
		
		int ans = Integer.MAX_VALUE;
		for (int i=0; i<26; i++) {
		    int tmp = 0;
		    char cur = (char)('a'+i);
    		char[] sbase = s.clone();
    		while (true) {
    		    boolean isValid = true;
    		    char[] snew = new char[sbase.length-1];
    		    for (int j=0; j<snew.length; j++) {
    		        if (sbase[j] == cur || sbase[j+1] == cur) {
    		            snew[j] = cur;
    		        } else {
		                snew[j] = 'A';
		                isValid = false;
    		        }
    		    }
    		    tmp++;
    		    if (isValid) break;
    		    sbase = snew.clone();
    		}
    		ans = Math.min(ans, tmp);
		}
		
		System.out.println(ans);
	}
	
	public static void solver() {
		// write logic
	}
	
	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}
	
		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	
		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}


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

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

using ll = long long;
using P = pair<int,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int a, b, c, k;
    cin >> a >> b >> c >> k;

    int ans = 0;
    if(a < k){
        ans += a;
        k -= a;
        k -= b;
        if(k >= 0){
            ans-=k;
        }
    }else{
        ans += k;
    }

    cout << ans << "\n";


    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

  T.pop_back();
  if (S == T) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
    int n;
    int a[2][100] = {0};

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

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

    a[1][0] += a[0][0];

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

    cout << a[1][n-1] << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(raw_input())
arr = map(int, raw_input().split())
ps = [0] * (n)
psr = [0] * (n)
ps[0], psr[-1] = arr[0], arr[-1]
for i in range(1, len(arr)):
    ps[i] = ps[i-1] + arr[i]
    psr[-1- i] = psr[-i] + arr[-1-i]
mindiff = 101
for i in range(n - 1):
    diff1 = abs(psr[i+1] - ps[i])
    mindiff = min(diff1, mindiff)
print mindiff

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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define PI (acos(-1))

class UnionFind{
  public:
  //親の番号を格納する 親だった場合-1*集合のサイズ
  vector<int> Parent;
  vector<int> Diff_weight;

  //コンストラクタ 初めはバラバラの状態
  UnionFind(int N){
    Parent = vector<int>(N,-1);//要素数N,要素の値-1で初期化
    Diff_weight = vector<int>(N,0);//親への距離
  }

  //Ａがどのグループに属しているか調べる
  int root(int A){
    if(Parent[A] < 0){
      return A;//Aが親だったらA自身を返す
    }else{
      int tmp = root(Parent[A]);
      Diff_weight[A] += Diff_weight[Parent[A]];
      return Parent[A] = tmp;//親に繋ぎなおす
    }
  }

  int weight(int A){
    root(A);
    return Diff_weight[A];
  }

  //頂点数を調べる
  int size(int A){
    return -Parent[root(A)];//Aの根×-1=集合のサイズ
  }

  //AとBをくっつける
  bool connect(int A, int B, int W){
    W += weight(A); W -= weight(B);
    //Aの根とBの根をくっつける
    A = root(A);
    B = root(B);
    if(A==B)return false;//既に同じグループならそのままでfalseを返す

    //Aのサイズ>=Bのサイズとする  
    if(size(A)<size(B)){
      swap(A,B);
      W=-W;
    }

    Parent[A] += Parent[B];//AのサイズにBのサイズを足す
    Parent[B] = A;//Bの親をAに変更する

    Diff_weight[B] = W;
    return true;
  }

  //AとBが同じグループかどうか調べる
  bool same(int A,int B){
    if(root(A)==root(B))return true;
    else return false;
  }

  int diff(int A,int B){
    return weight(B)-weight(A);
  }

};

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

  UnionFind Uni(N);

  int L,R,D,cnt=0;
  rep(i,M){
    cin >> L >> R >> D;
    L--;R--;
    //cout << R << " Weighht:" << Uni.weight(R) << " " << L << " Weight:" << Uni.weight(L) << " " << D << endl;
    cnt++;
    if(Uni.same(L,R)){
      if(Uni.diff(L,R)!=D){
        /*cout << R << " " <<L << endl;
        cout << Uni.weight(R) << " " << Uni.weight(L) << " " << D << endl;*/
        cout << "No" << endl;
        return 0;
      }
    }
    Uni.connect(L,R,D);
  }
  /*rep(i,N){
    cout << Uni.weight(i) << " "; 
  }*/
  cout << "Yes" << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll unsigned long long
#define ld long double
#define pi 3.14159
#define mx 9999999
using namespace std;
ll mark[mx];
map<ll,ll> m;
int main()
{
    string s,t;
    cin>>s>>t;
    ll c=0;
    for(int i=0;i<s.length();i++){
        if(s[i]==t[i]) c++;
    }
    cout<<c;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n; cin >> n;
    string in; cin >> in;

    bool res = (in.substr(0, n / 2) == in.substr(n / 2));
    cout << (res ? "Yes":"No") << endl;

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define LL long long
#define pb push_back

const int N = 305;
const int MOD = 998244353;
bitset<N> a[N];
vector<bitset<N>> base;
LL q_pow(LL n, LL k)
{
	return k ? (k & 1 ? n : 1)*q_pow((n*n)%MOD, k >> 1)%MOD : 1;
}
int main() {
	int n, m, t;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; ++i) {
		a[i].reset();
		for (int j = 0; j < m; ++j) {
			scanf("%d", &t);
			if (t) a[i].flip(j);
		}
	}
	for (int i = 0; i < n; i++) {
		for (bitset<N> b : base) {
			bitset<N> bb = b ^ a[i];
			for (int j = 0; j < m; j++) {
				if (bb[j] < a[i][j]) {
					a[i] = bb;
					break;
				}
				else if (bb[j] > a[i][j]) break;
			}
		}
		if (a[i].any()) base.pb(a[i]);
	}
	int cnt = (int)base.size();
	printf("%lld\n", ((q_pow(2, n + m - 1) - q_pow(2, n + m - 1 - cnt)) % MOD + MOD) % MOD);
	//system("pause");
	return 0;
}


Measured memory_bytes: 256
def main():
	n, m = map(int, input().split())
	rev = input()[::-1]
	ans = []
	cur = nxt = 0
	while cur < n:
		for i in range(cur + 1, cur + m + 1):
			if i==n:
				nxt = i
				break
			if rev[i]=="0":
				nxt = i
		if cur==nxt:
			print(-1)
			exit()
		ans += [str(nxt - cur)]
		cur = nxt
	print(" ".join(ans[::-1]))


if __name__=="__main__":
	main()


Measured memory_bytes: 10648
AC = 0
WA = 0 
TLE = 0
RE = 0

n = int(input())
for i in range(n):
  t = str(input()).upper()
  if t == "AC":
    AC += 1
  
  if t == "WA":
    WA += 1
  
  if t == "TLE":
    TLE += 1
  
  if t == "RE":
    RE += 1
    
print("AC x " + str(AC))
print("WA x " + str(WA))
print("TLE x " + str(TLE))
print("RE x " + str(RE))
  

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

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

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

const int MAX_E = 2000;
const int MAX_V = 2000;
struct edge{
  ll from,to,cost;
};

edge es[MAX_E];
ll d[MAX_V];

class Bellman_Ford{
  public:
  int V,E;
  const ll INF = 1LL << 50;
  Bellman_Ford(){};
  Bellman_Ford(ll v,ll e):V(v),E(e){};
  void shorter_path(int s){
    rep(i,V) d[i] = INF;
    d[s] = 0;
    rep(i,V-1){
      rep(i,E){
        auto e = es[i];
        if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
          d[e.to] = d[e.from] + e.cost;
        }
      }
    }
  }
  bool find_negative_loop(){
    memset(d,0,sizeof(d));
    rep(i,V){
      rep(j,E){
        auto e = es[j];
        if(d[e.to] > d[e.from] + e.cost){
          (d[e.to] = d[e.from] + e.cost);
          if(i == V - 1) return true;
        }
      }
    }
    return false;
  }
  bool check(){
    vector<bool> neg(V,false);
    rep(i,V){
      rep(j,E){
        auto e = es[j];
        if(d[e.from] == INF) continue;
        if(d[e.to] > d[e.from] + e.cost){
          (d[e.to] = d[e.from] + e.cost);
          neg[e.to] = true;
        }
        if(neg[e.from]){
          neg[e.to] = true;
        }
      }
    }
    return neg[V-1];
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll v,e;
  cin >> v >> e;
  Bellman_Ford bl(v,e); 
  ll a,b,c;
  rep(i,e){
    cin >> a >> b >> c;
    --a,--b;
    c *= -1;
    es[i] = edge{a,b,c};
  }
  bl.shorter_path(0);
  ll ans = d[v-1];
  if(bl.check()){
    cout << "inf" << endl;
  }
  else
    cout << -ans << endl;
  return 0;
}


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

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

using ll = long long;
using P = pair<int,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int a, b;
    cin >> a >> b;

    cout << a * b << "\n";


    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;

typedef pair<int,int> P;
const int MAX = 120;

int maze[MAX][MAX];
bool come[MAX][MAX];
P s,g;
int W,H,c;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};

void init(){
  memset(come,false,sizeof(come));
  memset(maze,0,sizeof(maze));
}


void input_B(){
  int n;
  cin >> n;
  while(n--){
    int c,d,x,y;
    cin >> c >> d >> x >> y;
    if(d){
      for(int i = y; i < y+4; i++)
	for(int j = x; j < x+2; j++)
	  maze[i][j] = c;
    }else{
      for(int i = y; i < y+2; i++)
	for(int j = x; j < x+4; j++)
	  maze[i][j] = c;
    }
  }
}


void solve(P p){
  
  if(come[p.second][p.first] == false){
    come[p.second][p.first] = true;
    for(int i = 0; i < 4; i++)
      if(0 < p.first+dx[i] && p.first+dx[i] <= W &&
	 0 < p.second+dy[i] && p.second+dy[i] <= H &&
	 maze[p.second+dy[i]][p.first+dx[i]] == c) solve(P(p.first+dx[i],p.second+dy[i]));
  }
}

void print(){
  for(int i = 1; i < H; i++){
    for(int j = 1; j < W; j++)// cout << come[i][j];
      cout << maze[i][j];
    cout << endl;
  }

}


int main(){
  while(cin >> W >> H && W+H){
    init();
    cin >> s.first >> s.second;
    cin >> g.first >> g.second;
    input_B();
    c = maze[s.second][s.first];
    solve(s);
    //print();
    if(come[g.second][g.first] && c) cout << "OK" << endl;
    else cout << "NG" << endl;
  }
  return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <set>
#include <cstdio>
using namespace std;
using ll = long long;


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

ll cost[2001];


int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    ll S;
    cin >> S;
    cost[3] = 1;
    for (int i = 4; i <= S; i++) {
        ll sum = 0;
        for (int p = i - 3; p >= 0; p--) {
            sum += cost[p];
            sum %= 1000000007;

        }
        
        cost[i] = sum+1;
    }
    
    cout << cost[S] << endl;;

}

Measured memory_bytes: 3640
N = gets.to_i
cards = gets.chomp.split(" ").map(&:to_i)
cards.sort!

a_p, b_p = 0, 0

N.times {|n|
  max = cards.pop
  if n % 2 != 0
    b_p += max
  else
    a_p += max
  end
}

puts a_p - b_p


Measured memory_bytes: 1788
/*
  AUTHOR:SOURABH
  CREATED:12:02:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //freopen("in.txt","r",stdin);
    //freopen(2 "out.txt","w",stdout);

    ll t,n,i,f,ma;
    string s;
    t=1;
    //cin>>t;
    map<string,ll> b;
    map<string,ll>::iterator it;
    W(t--)
    {
        cin>>n;
        //vector<string> v;
        fn(i,n)
        {
            cin>>s;
            b[s]++;
        }
        ma=0;
        fit(it,b)
        ma=max(it->se,ma);
        fit(it,b)
        {
            if(it->se==ma)
                cout<<it->fi<<"\n";
        }
    }
    return 0;
}













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

int main() {
  
  int N;
  cin >> N;
  vector<int> W(N);
  
  int sum = 0;
  for(int i=0; i<N; i++){
    cin >> W.at(i);
    sum += W.at(i);
  }
  
  int f_itr = 0;
  int b_itr = N-1;
  int front_sum=0, back_sum=0;
  
  while(f_itr <= b_itr){
    if(front_sum < back_sum){
      front_sum += W.at(f_itr);
      f_itr++;
    }else {
      back_sum += W.at(b_itr);
      b_itr--;
    }
  }
  
  cout << abs(front_sum-back_sum) << endl;
  
}

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

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	int a, b, c;
	cin >> a >> b >> c;

	if (a % 2 != 0 || b % 2 != 0 || c % 2 != 0) {
		cout << 0 << endl;
		return 0;
	}

	int ans = 0;
	for (;;) {
		int aVal = b / 2 + c / 2;
		int bVal = c / 2 + a / 2;
		int cVal = a / 2 + b / 2;

		a = aVal;
		b = bVal;
		c = cVal;

		ans++;
		if (a % 2 != 0 || b % 2 != 0 || c % 2 != 0) {
			break;
		}

		if (ans >= 1000000) {
			cout << -1 << endl;
			return 0;
		}
	}

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	string s, t;
	bool flag=true;
	cin >> s >> t;
	for(int i=0; i<s.size(); i++){
		int k=i, l=0;
		flag=true;
		while(l<s.size()){
			if(s[k]!=t[l]){
				flag=false;
				break;
			}
			k++;
			l++;
			if(k==s.size()){
				k=0;
			}
		}
		if(flag){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
#define MOD 1000000007 //998244353

void ANSWR(priority_queue<ll> Q){
    ll ans=0;
    while(!Q.empty()) {
        ans += Q.top();
        Q.pop();
    }
    cout << -ans << nl;
}

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

    // solution comes here

    ll N, M, A, B, C;
    cin >> N >> M;
    priority_queue<ll> Q;
    rep(i,N) {
        cin >> A;
        Q.push(-A);
    }
    vp CB(M);
    rep(i, M) {
        cin >> B >> C;
        CB[i] = {C, B};
    }

    sortdown(CB);

    ll cnt=0, t;
    rep(i, M){
        rep(_, CB[i].S){
            t = Q.top();
            if(-t < CB[i].F) {
                Q.pop();
                Q.push(-CB[i].F);
            }
            if(++cnt>=N or -t >= CB[i].F){
                ANSWR(Q);
                return 0;
            }
        }
    }

    ANSWR(Q);
}

Measured memory_bytes: 3572
/////////////////////////////
// Author: whatisit
// Date: 2020-05-23 15:45 
//////////////////////////////
#include <bits/stdc++.h>
using namespace std;

void solve() {
	int n, x, y;
	cin >> n >> x >> y;
	map<int, int> dist;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j < i; ++j) {
			int dist_ij = min(i-j, abs(i-y) + abs(j-x) + 1);
			dist_ij = min(abs(i-x) + abs(j-y) + 1, dist_ij);
			++dist[dist_ij];
		}
	}
	for (int i = 1; i < n; ++i) 
		cout << dist[i] << endl;
}

int main() {
	//cin.tie(0); ios_base::sync_with_stdio(0);
	solve();
	return 0;
}

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

const int mxn = 200010;

vector<int> G[mxn];

int main() {
    int N, M;
    cin >> N >> M;
    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    bool ans = false;
    for(auto nxt : G[1]) {
        for(auto nxt2 : G[nxt]) {
            if(nxt2 == N) ans = true;
        }
    }

    if(ans) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;

    return 0;
}

Measured memory_bytes: 12016
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		BigInteger[][] c = new BigInteger[110][110];
		c[0][0] = BigInteger.valueOf(1);
		for (int i = 0; i <= 105; ++i) {
			c[i][0] = c[i][i] = BigInteger.valueOf(1);
			for (int j = 1; j < i; ++j)
				c[i][j] = c[i - 1][j].add(c[i - 1][j - 1]);
		}
		Scanner in = new Scanner(System.in);
		int l = in.nextInt(), k = in.nextInt();
		BigInteger ans = BigInteger.valueOf(0);
		for (int i = 0; i <= 100; ++i)
			for (int j = 0; j <= i + 1; ++j)
				if(i + k * j + (i + 1 - j) <= l)
					ans = ans.add(c[i + 1][j]);
		System.out.println(ans);
		in.close();
	}
}



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

#define rep(i,n) for( (i)=0;(i)<(n);++(i) )
#define repr(i,n) for( (i)=(n);(i)>0;==(i) )
#define FOR(i,j,n) for( (i)=(j);(i)<(n);++(i) )
#define forr(i,j,n) for( (i)=(j);(i)>(n);--(i) )
#define debg(a) cout<<(a)<<endl;
#define INF 9999999
#define int long long 
#define str string
#define elif else if

int i,j,k;
int dx,dy;
int a,b,c,x,y,n,m,cnt=0,ans=0;
str s,t;

signed main(){ 
  cin>>s;
  str ans="";

  rep(i,s.length()){
    if(s[i]=='B'){
      if(ans!="") ans.erase(ans.length()-1);
    }
    else ans+=s[i];
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  string s;
  cin >> s;
  int num = 'z'-'a'+1;
  vector<int> cnt(num, 0);
  int siz = s.length();
  rep(i, siz) {
    cnt[s[i] - 'a'] = i+1;
  }
  if (siz < num){
    rep(i, num) {
      debug(cnt[i]);
      if (cnt[i] == 0) {
        s += ('a'+i);
        break;
      }
    }
    cout << s << endl;
    return 0;
  }
  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    cout << -1 << endl;
    return 0;
  }
  string t = s;
  next_permutation(all(t));
  string ans = "";
  rep(i,siz) {
    if (s[i] == t[i]) ans += t[i];
    else {
      ans += t[i]; break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;

int rec(int a, int b){
  if(b == 0) return a;
  return rec(b, a%b);
}

int main(){
  int A, B, C; cin >> A >> B >> C;
  int gcm = rec(A, B);
  if(C % gcm == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 4e18;

int main() {
    string s, t; cin >> s >> t;
    vector<vector<int>> ind(s.size(), vector<int>(26,INF));
    ind[s.size() - 1][s[s.size() - 1]-'a'] = s.size()-1;
    for (int i = s.size() - 2; i >= 0; i--) {
        REP(j, 26) {
            if (s[i] != 'a' + j) {
                ind[i][j] = ind[i + 1][j];
            }
            else {
                ind[i][j] = i;
            }
        }
    }
    ll ans = 0;
    int p = 0;
    REP(i, t.size()) {
        if (ind[p][t[i]-'a'] != INF) {
            ans += ind[p][t[i] - 'a'] - p + 1;
            p = ind[p][t[i] - 'a'] + 1;
            if (p == s.size()) p = 0;
        }
        else if (ind[0][t[i]-'a'] != INF){
            ans += s.size() - p;
            i--;
            p = 0;
        }
        else {
            ans = -1;
            break;
        }
    }
    cout << ans << endl;
    getchar(); getchar();
}

Measured memory_bytes: 13696
#include <iostream>
using namespace std;
 
int main(void){
    int x;
    cin >> x;
    int ans = 1;
    for(int i=1; i<=x; i++){
        for(int j=2; j<i; j++){
            int b = j*j;
            while(b <= i){
                if(b == i){
                    ans = i;
                    break;
                }
                b *= j;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
  int n; cin >> n;
  vector<int> a(n, 0);
  rep(i, n) cin>>a[i];
  rep(i, n) {
    if (a[i]%2==0 && a[i]%3!=0 && a[i]%5!=0) {
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;

  return 0;
}


Measured memory_bytes: 256