akhauriyash/Code-Regression huggingface dataset:
loop do
  a, b, c = gets.split
  case b
  when /\+/
    puts "#{a.to_i + c.to_i}"
  when /\-/
    puts "#{a.to_i - c.to_i}"
  when /\*/
    puts "#{a.to_i * c.to_i}"
  when /\//
    re = a.to_i / c.to_i
    puts "#{re.floor}"
  else
    break
  end
end


Measured memory_bytes: 6868
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;

struct UF{
	vector<int>par,sz;
	void init(int n){
		par.resize(n);
		sz.resize(n);
		for(int i=0;i<n;i++){
			par[i]=i;
			sz[i]=1;
		}
	}
	int find(int x){
		return x==par[x]?x:par[x]=find(par[x]);
	}
	void unite(int x,int y){
		x=find(x);y=find(y);
		if(x==y)return;
		sz[x]+=sz[y];
		par[y]=x;
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	int size(int x){
		return sz[find(x)];
	}
};

signed main(){
	int N;
	cin >> N;
	vector<int>a(N);
	REP(i,N){
		cin >> a[i];
	}
	int x = 0;
	REP(i,N)x ^= a[i];
	vector<int>ans(N);
	REP(i,N){
		ans[i] = x ^ a[i];
	}
	REP(i,ans.size())cout << ans[i] << " \n"[i+1 == ans.size()];
}

Measured memory_bytes: 6420
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define SZ(a) (int)(a).size()
#define FOR(i, a, b) for(int i=(a); i<=(b); ++i)
#define iFOR(i, a, b) for(int i=(a); i>=(b); --i)
#define make_unique(a) sort(all((a))), (a).resize(unique(all((a)))-(a).begin())

using namespace std;

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long UL; // ULLONG_MAX, %llu
typedef unsigned int UI; //UINT_MAX %u
typedef double DD;
typedef long double LD;
typedef pair<LL,LL> PLL;
typedef pair<DD,DD> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;

const int N =200005;
char s[N],t[N];
int main(){
    int n;
    scanf("%s %s",s+1,t+1);
    n = strlen(s+1);
    int cnt = 0;
    FOR(i, 1, n) cnt += s[i]!=t[i];
    printf("%d",cnt);
	return 0;
}
/*
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */


Measured memory_bytes: 4168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1e9+5;
const int N=2e5+5;
const int mod=1e9+7;

ll pref[N][2],suff[N][2];

ll poww(ll a,ll b,ll MOD){
	a%=MOD;
	ll r=1;
	while(b){
		if(b&1) r=r*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return r;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	string x;
	cin>>n>>x;
	x=" "+x;
	int cnt=0;
	for(int i=1;i<=n;++i){
		if(x[i]=='1') ++cnt;
	}
	for(int i=1;i<=n;++i){
		pref[i][1]=(pref[i-1][1]*2+x[i]-'0')%(cnt+1);
		if(cnt-1>0) pref[i][0]=(pref[i-1][0]*2+x[i]-'0')%(cnt-1);
	}
	vector<ll> base2(2,1);
	for(int i=n;i>=1;--i){
		suff[i][1]=(suff[i+1][1]+(x[i]-'0')*base2[1])%(cnt+1);
		base2[1]=base2[1]*2%(cnt+1);
		if(cnt-1>0){
			suff[i][0]=(suff[i+1][0]+(x[i]-'0')*base2[0])%(cnt-1);
			base2[0]=base2[0]*2%(cnt-1);
		}
	}
	for(int bit=1;bit<=n;++bit){
		if(x[bit]=='0'){
			ll num=(pref[bit-1][1]*poww(2,n-bit+1,cnt+1)+suff[bit+1][1]+poww(2,n-bit,cnt+1))%(cnt+1);
			ll ans=1;
			while(num){
				num%=__builtin_popcount(num);
				++ans;
			}
			cout<<ans<<endl;
		}
		else{
			if(cnt-1==0){
				cout<<0<<endl;
				continue;
			}
			ll num=(pref[bit-1][0]*poww(2,n-bit+1,cnt-1)+suff[bit+1][0])%(cnt-1);
			ll ans=1;
			while(num){
				num%=__builtin_popcount(num);
				++ans;
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 9968
#include <stdio.h>

int main(void)
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);

    int max = a + c;
    int min = b - c;
    for (int i = a; i <= b; i++)
    {
        if (i < max || i > min)
        {
            printf("%d\n", i);
        }
    }

    return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var array = "abcdefghijklmnopqrstuvwxyz";
            var r = Console.ReadLine();
            var nowPos = array.IndexOf(r);
            Console.WriteLine(array[nowPos + 1]);
        }
        
    }
}

Measured memory_bytes: 13404
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] from = new int[n][2];
        for (int i = 0; i < n; i++) {
            from[i][0] = sc.nextInt();
            from[i][1] = sc.nextInt();
        }
        int[][] to = new int[m][2];
        for (int i = 0; i < m; i++) {
            to[i][0] = sc.nextInt();
            to[i][1] = sc.nextInt();
        }
        
        int[] ans = new int[n];
        for (int i = 0; i < n; i++) {
            int min = 1001001009;
            int idx = -1;
            for (int j = 0; j < m; j++) {
                int tmp = Math.abs(from[i][0] - to[j][0]) + Math.abs(from[i][1] - to[j][1]);
                
                if (tmp < min) {
                    min = tmp;
                    idx = j;
                }
            }
            
            ans[i] = idx;
        }
        
        for (Integer i : ans) {
            System.out.println(i+1);
        }
    }
}

Measured memory_bytes: 22100
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string.h>
#include <fstream>
#include <cassert>
using namespace std;

#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define sz(a) int((a).size())
#define rep(i, s, n)  for(int i = s; i <= (n); ++i)
#define rev(i, n, s)  for(int i = (n); i >= s; --i)
#define fore(x, a) for(auto &&x : a)
typedef long long ll;
const int mod = 1000000007;
const int N = 100005;

ll a[N], b[N];

int main() {
#ifdef loc
  if(!freopen((string(FOLDER) + "inp.txt").c_str(), "r", stdin)) {
    assert(0);
  }
  freopen((string(FOLDER) + "out.txt").c_str(), "w", stdout);
#endif
  boost;
  int n;
  cin >> n;
  rep(i, 1, n) {
    cin >> a[i] >> b[i];
  }
  ll res = 0;
  rev(i, n, 1) {
    a[i] += res;
    ll y = a[i] % b[i];
    if (y) y = b[i] - y;
    res += y;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,s=0;
  cin>>n;
  for(int i=1;i<=n;i++){
    if(i%3!=0 && i%5!=0 && i%15!=0){
      s=s+i;
    }
  }
  cout<<s<<endl;
  
}


Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main{

    public static void main(String[] args) {

        try {
            InputStreamReader is = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(is);
            String []i = br.readLine().trim().split(" ");
            int a=Integer.parseInt(i[0]);
            int b=Integer.parseInt(i[1]);
            int c=Integer.parseInt(i[2]);
            int d=Integer.parseInt(i[3]);
            while(a>0||c>0){
                c=c-b;
                if(c<=0){
                    System.out.print("Yes");
                    break;
                }
                a=a-d;
                if(a<=0){
                    System.out.print("No");
                    break;
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}

Measured memory_bytes: 32508
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */


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

class DSumOfDivisors {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n;
        in >> n;
        vector<ll> f(n+1,0);
        ll ans=0L;
        if(n==1){
            out << 1 << endl;
            return ;
        }
        f[1]=1;
        f[2]=2;
        for(ll i=1L;i<n+1;i++){
            if(f[i]==0){
                f[i]=2;
            }else{
                for(ll j=1;i*j<=n;j++){
                    f[i*j]++;
                }
            }
            ans+=f[i]*i;
        }
        out <<ans-5 << endl;
	}
};


int main() {
	DSumOfDivisors solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;
#define int long long
const int N = 1e5 + 5, M = 5, inf = 1e15;
int dp[N][M], a[N];
char op[N];

int Sign(int x) {
    if (x % 2) return -1;
    return 1;
}

int32_t main() {
    for (int i = 0; i < N; i++) for (int j = 0; j < M; j++) dp[i][j] = -inf;
    int n; cin >> n >> a[0];
    for (int i = 1; i < n; i++) cin >> op[i] >> a[i];
    dp[0][0] = a[0];
    for (int i = 1; i < n; i++) for (int j = M - 1; j >= 0; j--) {
        if (op[i] == '+') dp[i][j] = dp[i - 1][j] + a[i] * Sign(j);
        else if (j) dp[i][j] = dp[i - 1][j - 1] + a[i] * Sign(j);
        if (j + 1 < M) dp[i][j] = max(dp[i][j], dp[i][j + 1]);
    }
    cout << dp[n-1][0] << "\n";
}


Measured memory_bytes: 4992
import math

class abc_163:
    
    def __init__(self):
        pass
    
    def A(self):
        r=int(input())
        print(2*math.pi*r)
    
    def B(self):
        NM=list(map(int,input().split()))
        A=list(map(int,input().split()))
        
        if NM[0]-sum(A)>=0:print(NM[0]-sum(A))
        else:print("-1")
    
if __name__=='__main__':
    obj=abc_163()
    obj.B()
    

Measured memory_bytes: 10040
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b

signed main(){
	ll n; cin>>n;
	ll memo1=2;
	ll memo2=1;
	if(n==1){
		cout<<1<<endl;
		return 0;
	}
	ll ans;
	rep(i,0,n-1){
		ans=memo2+memo1;
		memo1=memo2;
		memo2=ans;
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std ;
const int N = 1100 ;
typedef long long ll ;
ll a[N] ;
int main()
{
  ll n , m ;
  cin >> n >> m ;
  ll sum = 0 ;
  for(int i = 1; i <= n ;i ++) cin >> a[i] , sum += a[i] ;
  ll cnt = 0 ;
  for(int i = 1; i <= n ;i ++)
   if(a[i] * 4 * m >= sum) cnt ++ ;
  if(cnt >= m) puts("Yes") ;
  else puts("No") ;
  return 0 ;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    int a, b;
    cin>>a>>b;
    int ans = MAX3(a+b, a-b, a*b);
    cout<<ans;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

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

const int MOD = 1000000007;

int main() {
    string S;
    cin >> S;
    vector<ll> dp(13, 0);

    dp[0] = 1;
    int mul = 1;
    for(int i=int(S.length())-1; i>=0; i--) {
        vector<ll> nextdp(13, 0);
        if(S[i] == '?') {
            for(int j=0; j<10; j++) {
                for(int k=0; k<13; k++) {
                    nextdp[(j*mul+k)%13] += dp[k];
                    nextdp[k] %= MOD;
                }
            }
        } else {
            int c = int(S[i] - '0');
            for(int j=0; j<13; j++) {
                nextdp[(c*mul+j)%13] += dp[j];
                nextdp[j] %= MOD;
            } 
        }
        for(int j=0; j<13; j++) {
            dp[j] = nextdp[j];
        }
        mul *= 10;
        mul %= 13;
    }

    cout << dp[5]%MOD << endl;

    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int mymin(int x, int y)
{
  return (x < y ? x : y);
}

int main(void)
{
  int Q;

  scanf("%d", &Q);
  while (Q--) {
    int c, a, n;
    int can, cca, ccc;
    scanf("%d %d %d", &c, &a, &n);
    can = mymin(c, mymin(a, n));
    c -= can;
    a -= can;
    n -= can;
    cca = mymin(c / 2, a);
    c -= cca * 2;
    a -= cca;
    ccc = c / 3;
    printf("%d\n", can + cca + ccc);
  }
  return (0);
}

Measured memory_bytes: 600
#include<cstdio>
#include<complex>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>

#define EPS (1e-8)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)

using namespace std;

typedef complex<double> P;
typedef pair<P,P> L;
typedef pair<P,double> C;

const double PI = acos(-1);

P unit(P p){return p / abs(p);}
double dot(P x,P y){return real(conj(x)*y);}
double cross(P x,P y){return imag(conj(x)*y);}

P rotate(P v,double s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

double arg(P a,P b,P c){return acos(dot(b-a,c-a)/(abs(b-a)*abs(c-a)));}
double arg(double a,double b,double c){return acos( (b*b+c*c-a*a)/(2*b*c) );}

bool in_cir(C c,P x){return (abs(x-c.fs) +EPS < c.sc);}
bool on_cir(C c,P x){return EQ(abs(x-c.fs),c.sc);}

int cpr(C a,C b){
  double d = abs(a.fs-b.fs);
  if(a.sc+b.sc + EPS < d)return -1;
  if(b.sc+d + EPS < a.sc)return 1;
  if(a.sc+d + EPS < b.sc)return 2;
  if(abs(a.sc+b.sc - d) < EPS)return -3;
  if(abs(b.sc+d - a.sc) < EPS)return 3;
  if(abs(a.sc+d - b.sc) < EPS)return 4;
  return 0;
}

vector<P> cp_cir_to_cir(C a, C b){
  vector<P> v;
  int pos = cpr(a,b);
  if(pos==0){
    double s = arg(b.sc,abs(b.fs-a.fs),a.sc);
    P x = a.sc * unit(b.fs - a.fs);
    v.pb(a.fs + rotate(x,s));
    v.pb(a.fs + rotate(x,-s));
  }else if(abs(pos) >= 3){
    v.pb(a.fs + a.sc * unit(b.fs-a.fs));
  }
  return v;
}

double angle(P p, C c){
  P O = c.fs, A = P(c.fs.real(),c.fs.imag()+c.sc), B = p;
  double res = arg(O,A,B);
  if(cross(A-O,B-O)<-EPS)res = 2*PI-res;
  return res;
}

int n;
C c[110];
double x,y,r;

int main(){
  while(scanf("%d",&n),n){
    rep(i,n){
      scanf("%lf%lf%lf",&x,&y,&r);
      c[i] = C(P(x,y),r);
    }

    vector<double> cp_list[110];
    rep(i,n){
      FOR(j,i+1,n){
	vector<P> p = cp_cir_to_cir(c[i],c[j]);
	if((int)p.sz==2){
	  rep(k,2)cp_list[i].pb(angle(p[k],c[i]));
	  rep(k,2)cp_list[j].pb(angle(p[k],c[j]));
	}
      }
    }

    rep(i,n){
      sort(all(cp_list[i]));
      rep(j,(int)cp_list[i].sz-1){
	if(EQ(cp_list[i][j],cp_list[i][j+1])){
	  cp_list[i].erase(cp_list[i].begin()+j);
	  j--;
	}
      }
    }

    double ans = 0;
    rep(i,n){
      if(cp_list[i].empty()){
	bool f = true;
	rep(j,n){
	  if(i==j)continue;
	  if(in_cir(c[j],c[i].fs) && c[i].sc < c[j].sc)f = false;
	}
	if(f)ans += 2*PI*c[i].sc;
      }else{
	rep(j,cp_list[i].sz){
	  double s;
	  if(j+1<(int)cp_list[i].sz)s = (cp_list[i][j]+cp_list[i][j+1])/2;
	  else s = (cp_list[i][j]+cp_list[i][0]+2*PI)/2;

	  P p = rotate(P(0,c[i].sc),s) + c[i].fs;
	  bool f = true;
	  rep(k,n){
	    if(i==k)continue;
	    if(in_cir(c[k],p))f = false;
	  }
	  double seta = cp_list[i][(j+1)%cp_list[i].sz]-cp_list[i][j];
	  if(seta<0)seta += 2*PI;
	  if(f)ans += seta*c[i].sc;
	}
      }
    }
    printf("%.9lf\n",ans);
  }
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 3e5 + 55;

int p[MAXN], p_inv[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	REPN(i, 1, n) {
		scanf("%d", &p[i]);
		if ((p[i] + i) & 1) {
			printf("No\n");
			return;
		}
	}
	p[0] = 0, p[n + 1] = n + 1, p[n + 2] = n + 2;
	
	REPN(i, 0, n + 2) {
		p_inv[p[i]] = i;
	}
	
	for(int i = 1; i <= n; ) {
		if (p[i] == i) {
			i++;
			continue;
		}
		
		int j;
		
		for(j = i + 1; j <= n; j++) {
			if ((i + j) % 2 == 1 && p[j] != j) {
				break;
			}
			if ((i + j) % 2 == 0 && p[j] == j) {
				j--;
				break;
			}
		}
		j--;
		
		int last_min = -1, last_max = -1;
		for(int k = i; k <= j; k += 2) {
			if (p[k] > k) {
				if (p[k] < last_max) {
					printf("No\n");
					return;
				}
				last_max = p[k];
			}
			if (p[k] < k) {
				if (p[k] < last_min) {
					printf("No\n");
					return;
				}
				last_min = p[k];
			}
		}
		
		for(int k = i; k <= j; k += 2) {
			if (p_inv[k] < i || p_inv[k] > j) {
				printf("No\n");
				return;
			}
		}
		
		i = j + 1;
	}
	printf("Yes\n");
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

const char *disp[10] = {
  "1111110",
  "0110000",
  "1101101",
  "1111001",
  "0110011",
  "1011011",
  "1011111",
  "1110010",
  "1111111",
  "1111011",
};

char myxor(char a, char b){
  return (a != b)  ? '1' : '0';
}

int main(){
  int n;
  while(scanf("%d", &n), n != -1){
    char b[7]; REP(i,7) b[i] = '0';
    REP(i,n){
      int t;
      scanf("%d", &t);
      REP(j,7){
        putchar(myxor(b[6-j], disp[t][6-j]));
        b[6-j] = disp[t][6-j];
      }
      puts("");
    }
  }
  return 0;
}

Measured memory_bytes: 0
from collections import deque
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
points = {"r":r,"s":s,"p":p}
d = {"r":"p","s":"r","p":"s"}
que = deque([None]*k)
ans = 0
for ti in t:
    x = que.popleft()
    if d[ti] != x:
        #print(d[ti])
        que.append(d[ti])
        ans+=points[d[ti]]
    else:
        #print(None)
        que.append(None)
    #que.popleft()
    #print(que,ti)
print(ans)

Measured memory_bytes: 5540
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int a[4];
	cin>>a[0]>>a[1]>>a[2]>>a[3];
	if((a[1]<=a[2])||(a[3]<=a[0]))
        cout<<'0';
    else
    {
    	sort(a,a+4);
    	cout<<a[2]-a[1];
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n,a,b;
	cin>>n>>a>>b;
	int sum=0;
	for(int i=1;i<=n;i++){
		int t=i,tmp=0;
		while(t){
			tmp+=t%10;
			t/=10;
		}
		if(tmp>=a && tmp<=b)sum+=i;
	}	
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
//#define C
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var a = new int[N, 3];
        for (int i = 0; i < N; i++)
        {
            var l = ReadLine().Split().Select(int.Parse).ToArray();
            a[i, 0] = l[0];
            a[i, 1] = l[1];
            a[i, 2] = l[2];
        }

        var dp = new int[N, 3];
        dp[0, 0] = a[0, 0];
        dp[0, 1] = a[0, 1];
        dp[0, 2] = a[0, 2];
        for (int i = 1; i < N; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                dp[i, j] = Math.Max(dp[i - 1, (j + 1) % 3], dp[i - 1, (j + 2) % 3]) + a[i, j];
            }
        }

        WriteLine(new[] { dp[N - 1, 0], dp[N - 1, 1], dp[N - 1, 2] }.Max());
    }
}


Measured memory_bytes: 19512
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;


/* range: ± 3.27 * 10^4 */
using i16 = short int;
/* range: 0 to 65535 */
using u16 = short unsigned int;
/* range: ± 2.14 * 10^9 */
using i32 = int;
/* range: 0 to 4.29 * 10^9 */
using u32 = unsigned int;
/* range: ± 9.22 * 10^18 */
using i64 = long long int;
/* range: 0 to 1.84 * 10^19 */
using u64 = long long unsigned int;

i32 main() {
    i32 n, k;
    cin >> n >> k;

    vector<i32> stones(n);
    for (i32 i = 0; i < n; i++) {
        cin >> stones[i];
    }

    vector<bool> dp(k + 1, false);

    for (i32 i = 1; i <= k; i++) {
        for (auto stone : stones) {
            if (dp[i]) {
                break;
            } else if (i >= stone) {
                dp[i] = !dp[i - stone];
            }
        }
    }

    if (dp[k]) {
        cout << "First" << '\n';
    } else {
        cout << "Second" << '\n';
    }
}

Measured memory_bytes: 3624
N, M = [int(v) for v in input().split()]

cards = [0] * (N + 2)

for _ in range(M):
    l, r = [int(v) for v in input().split()]
    cards[l] += 1
    cards[r + 1] -= 1

for i in range(1, N + 1):
    cards[i] += cards[i - 1]
print(len([i for i in range(1, N + 1) if cards[i] == M]))


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

int main()
{
  while(true)
  {
    string s;
    cin>>s;
    if(s[0]=='-') return 0;
    int n=s.size();
    s+=s;
    int m,sum=0;
    cin>>m;
    for (int i = 0; i < m; ++i)
    {
      int h;
      cin>>h;
      sum+=h;
    }
    sum%=n;
    for (int i = sum; i < n+sum; ++i)
    {
      cout<<s[i];
    }
    cout<<endl;
  }
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
#define mx 100010
int a[mx],p[mx],k,koko[mx];

void sieve()
{
    a[1]=1;
    for(int i=2; i<sqrt(mx); i++)
    {
        if(!a[i])
        {
            p[k++]=i;
            for(int j=i*i; j<mx; j=j+i)
            {
                a[j]=1;
            }
        }
    }
}

int main()
{
    //sieve();
    int a,b;
    scanf("%d %d",&a,&b);
    char str[30];
    scanf("%s",str);
    int l=strlen(str);
    int cnt=0,id=-1;
    for(int i=0;i<l;i++)
    {
        if(str[i]<'0' || str[i]>'9') cnt++,id=i;
    }
    if(cnt==1)
    {
        if(str[id]=='-' && id+1==a+1) printf("Yes\n");
        else printf("No\n");
    }
    else
    {
        printf("No\n");
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 5e5+10;
int n,a[N];
char s[N];

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for (int i=1,j=1;i<=n;i=j){
		while (j<=n&&s[i]==s[j]) j++;
		if(s[i]=='<'){
			int l=0;
			a[i-1]=max(a[i-1],l);
			FOR(k,i,j) ++l,a[k]=max(a[k],l);
		} else if (s[i]=='>'){
			int l=-1;
			Dow(k,j-1,i) ++l,a[k]=max(a[k],l);
			++l,a[i-1]=max(a[i-1],l);
		}
	}
	ll ans=0;
	For(i,0,n) ans+=a[i];
	printf("%lld\n",ans);
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

string S;
int L;

bool can(int l){
    if(2 * l <= L){return true;}

    for(int i=L-l;i<=l-1;++i){
        if(S[i] != S[l-1]){return false;}
    }

    return true;
}

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    std::cin >> S;

    L = S.size();
    
    // if minimizing, lb satisfies lb > ub
    // if maximizing, lb satisfies lb < ub
    int64_t lb = 1, ub = L + 1;

    while(std::abs(ub - lb) > 1){
        int64_t mid = (lb + ub) / 2;

        if(can(mid)){
            lb = mid;
        }else{
            ub = mid;
        }
    }

    std::cout << lb << std::endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f;
const ll mod = 998244353LL;
clock_t TIME_START, TIME_END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME_END - TIME_START) / CLOCKS_PER_SEC);
    system("pause");
#endif
}
int n, m, q;
ll L, dis[305][305], d[305][305];

void floyd()
{
    for (int k = 1; k <= n; ++k)
        for (int i = 1; i <= n; ++i)
            for (int j = 1; j <= n; ++j)
                if (dis[i][j] > dis[i][k] + dis[k][j])
                    dis[i][j] = dis[i][k] + dis[k][j];
    memarray(d, llinf);
    for (int i = 1; i <= n; ++i)
        for (int j = i + 1; j <= n; ++j)
            if (dis[i][j] <=L)
                d[i][j] = d[j][i] = 1;
    for (int k = 1; k <= n; ++k)
        for (int i = 1; i <= n; ++i)
            for (int j = 1; j <= n; ++j)
                if (d[i][j] > d[i][k] + d[k][j])
                    d[i][j] = d[i][k] + d[k][j];
}

void solve()
{
    cin >> n >> m >> L;
    memarray(dis, llinf);
    for (int i = 1; i <= m; ++i)
    {
        int x, y;
        ll c;
        cin >> x >> y >> c;
        if (c > L)
            continue;
        dis[x][y] = dis[y][x] = min(dis[x][y], c);
    }
    floyd();
    cin >> q;
    while (q--)
    {
        int x, y;
        cin >> x >> y;
        if (d[x][y] >= llinf)
        {
            puts("-1");
            continue;
        }
        printf("%lld\n", d[x][y]-1);
    }
}

int main()
{
    TIME_START = clock();
    int Test = 1;
    // cin >> Test;
    while (Test--)
        solve();
    TIME_END = clock();
    program_end();
    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int K = nextInt();
  int Q = nextInt();
  vector<int> D(K);
  REP(i, K) D[i] = nextInt();

  vector<int> d(K);
  REP(qi, Q) {
    ll N = nextInt();
    ll X = nextInt();
    ll M = nextInt();
    REP(i, K) d[i] = D[i] % M;

    ll N1 = N - 1;
    ll Y = X;
    REP(i, K) {
      Y += d[i] * (N1 / K);
      if (i < N1 % K) Y += d[i];
    }
    int c = (Y/M) - (X/M);
    int zero = 0;
    REP(i, K) if (d[i] == 0) {
      zero += N1 / K;
      zero += (i < N1 % K) ? 1 : 0;
    }
    ll ans = N1 - zero - c;
    printf("%d\n", (int)ans);
  }
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 384
a = list(map(int, input()))
#print(a)
b=sum(a)
#print(b)
c=list(map(str,a))
#print(c)
d="".join(c)
#print(d)
e=int(d)
#print(e)
if e%b==0:
	print("Yes")
else:
	print("No")


Measured memory_bytes: 2940
import fractions

def main():
    mod = 10**9+7
    N = int(input())
    A = list(map(int,input().split()))
    lcm = 1
    for Ai in A:
        lcm = lcm*Ai//fractions.gcd(lcm,Ai)
    lcm %= mod
    ans = 0
    for Ai in A:
        ans += lcm*pow(Ai,mod-2,mod)%mod
        ans %= mod
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 67288
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);

            Console.WriteLine("{0}", ((a * b) % 2 == 0) ? "Even" : "Odd");
        }
    }
}


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

using namespace std;

#define ll long long
#define M 1005000
#define ii pair<ll, ll>
#define fi first
#define se second



int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    int x = a - b;
    if (c <= x) cout << 0;
    else cout << c - x;
    
    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
double temp(double,double);

double temp(double x,double q){
    x-=(x*x*x-q)/(3*x*x);
    return x;
}

int main(){
    double x[50],q;
    int i;
    for(i=0;i<50;i++){
        cin>>q;
        if(q==-1)break;
        x[i]=q/2;
        do{
            x[i]=temp(x[i],q);
        }while(fabs(x[i]*x[i]*x[i]-q)>=1e-5*q);
    }
    for(int j=0;j<i;j++){
        printf("%.6f\n",x[j]);
    }
}

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

using namespace std;

int a[301];

int main () {
	int n, m;
	cin >> m;
	n = m * 2;
	for (int i = 1;i <= n;i ++) {
		cin >> a[i];
	}
	sort (a + 1, a + n + 1 );
	int ans = 0;
	for (int i = 1;i <= n;i += 2) {
		ans += min (a[i], a[i + 1]);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    private void run() {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        long[] map = new long[1000000];
        int x = 0;
        char which = S.charAt(0);
        map[x] = 1;
        for (int i = 1; i < S.length(); i++) {
            if (S.charAt(i) == which) {
                map[x]++;
            } else {
                which = S.charAt(i);
                x++;
                map[x]++;
            }
        }
        long ans = 0;
        boolean bigger = false;
        if (S.charAt(0) == '<') bigger = true;
        if(!bigger) ans += map[0];
        for (int i = 0; 0 != map[i]; i++) {
            for (long j = 1; j < map[i]; j++) {
                ans += j;
            }
            if(bigger && map[i+1] != 0) {
                ans += Math.max(map[i], map[i+1]);
            }else if(bigger && map[i+1] == 0){
                ans += map[i];
                break;
            }
            bigger = !bigger;
        }

        System.out.println(ans);
    }

}


Measured memory_bytes: 36580
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int > P;
typedef pair <int,P > PP;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

int main(){
	int a,b,c;
	while(~scanf("%d %d %d",&a,&b,&c)){
		if(a==b && b==c && c==0) break;

		if (c == 0) {
			if (a != 1)
				printf("%d %d %d %d\n", a, b, 1, 0);
			else
				printf("%d %d %d %d\n", 1, max(0, b), 1, min(0, b));
			continue;
		}

		for(int r=1;r*r<=a;r++){
			if(a%r != 0) continue;
			int p = a/r;
			for(int s=-10000;s<=10000;s++){
				if(s==0) continue;
				if(s!=0 && c%s !=0) continue;
				int q=c/s;

				if(q*r != b - p*s) continue;
				if((p>0 && r>0) 
					&& (p>r || (p==r && q>=s))){
					printf("%d %d %d %d\n",p,q,r,s);
					goto next;
				}
			}
		}
		printf("Impossible\n");
next:;

	}
}

Measured memory_bytes: 880
c = [list(map(int,input().split())) for i in range(3)]
#change
c1_2 = []
for i in range(3):
    c1_1 = []
    for j in range(2):
        c1_1.append(c[i][j] - c[i][j+1])
    c1_2.append(c1_1)
c1_1 = []
for i in range(3):
    for j in range(1):
        c1_1.append(c1_2[i][j] - c1_2[i][j+1])
if(len(set(c1_1))==1):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9208
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int N;
  cin >> N;
  int max = 0;
  int ans = 0;
  rep(i, N){
    int h;
    cin >> h;
    if (h >= max) {
      ans++;
      max = h;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int long long
#define left left1
#define right right1
 
using namespace std;

int n, q;
set <int> g[31];
int a[1000001];

 main () {
    //freopen ("deleg.in", "r", stdin);
    //freopen ("deleg.out", "w", stdout);
	ios_base::sync_with_stdio (0);
	cin.tie (0), cout.tie (0);
    cin >> n;
    for (int i = 1;i <= 26;i ++) {
        g[i].insert (n + 1);
    }
    for (int i = 1;i <= n;i ++) {
        char x;
        cin >> x;
        a[i] = x - 'a' + 1;
        g[a[i]].insert (i);
    }
    cin >> q;
    while (q --) {
        int tp;
        cin >> tp;
        if (tp == 1) {
            int pos;
            cin >> pos;
            char xx;
            cin >> xx;
            int x = xx - 'a' + 1;
            if (a[pos] == x) continue;
            int was = a[pos];
            g[was].erase (g[was].find (pos));
            g[x].insert (pos);
            a[pos] = x;
        }
        else {
            int l, r;
            cin >> l >> r;
            int ans = 0;
            for (int i = 1;i <= 26;i ++) {
                int x = i;
                int qw = *g[x].lower_bound (l);
                if (qw <= r) ans ++;
            }
            cout << ans << '\n';
        }
    }
	return 0;   
}

Measured memory_bytes: 27904
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    // vector<int> a(n);
    int cnt=0;
    int high=0;
    rep(i,n){
        int m;
        cin >> m;
        if(high<=m){
            cnt++;
            high=m;
        }
    }
    cout << cnt;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

int main(){
   std::string s,t;
   std::cin >> s >> t;
   int tlen = t.length();
   int slen = s.length();
   int max_match = 0;
   for (int i=0; i< slen - (tlen-1); i++){
      int num_match = 0;
      for (int j=0; j<tlen; j++) {
         //std::cout << "s:" << s[i+j] << "t:" << t[j] << std::endl;
         if (s[i+j] == t[j]) num_match++;
      }
      //std::cout << "num_match" << num_match << std::endl;
      if (num_match > max_match) max_match = num_match;
   }
   //std::cout << tlen << "," << max_match << std::endl;
   int retval = tlen - max_match;
   std::cout << retval << std::endl;
   return 0;
}

Measured memory_bytes: 3600
s = input()
n = len(s)
ans = 0
for i in range(n):
    if i % 2 == 0:  # 自分はｇ
        if s[i] == "p":
            ans -= 1
    else:  # 自分はｐ
        if s[i] == "g":
            ans += 1
print(ans)

Measured memory_bytes: 66352
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(buffer.readLine());
        long cnt = 0;
        for (int fact = 1; fact <= n ; fact++) {
            cnt+=n/fact;
            if (n%fact == 0)
                cnt--;
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 32620
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
using lint = long long;

lint digit_num(lint x)
{
    lint out = 0;
    while (x > 0)
    {
        x /= 10;
        out++;
    }

    return out;
}

lint f(lint x, lint y)
{
    return std::max(digit_num(x), digit_num(y));
}

int main()
{
    lint n;
    scanf("%lld", &n);

    for (int i = sqrt(n) + 1; i >= 1; --i)
    {
        if (n % i == 0)
        {
            printf("%lld", f(i, n / i));
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
import sys

def end_program():
  print "No"
  sys.exit()

c11, c12, c13=map(int, raw_input().split())
c21, c22, c23=map(int, raw_input().split())
c31, c32, c33=map(int, raw_input().split())

a1=0
b1=c11
b2=c12
b3=c13

a2=c21-b1
if a2!=c22-b2: end_program()
if a2!=c23-b3: end_program()

a3=c31-b1
if a3!=c32-b2: end_program()
if a3!=c33-b3: end_program()

print "Yes"

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e10;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
int dy[4] = {0, 1, 0, -1};
int dx[4] = {1, 0, -1, 0};
int w, h;
void f(char mp[100][100], int y, int x, char a) {
  rep(i, 4) {
    int ny = y + dy[i];
    int nx = x + dx[i];
    if (0 <= ny && ny < h && 0 <= nx && nx < w && mp) {
      if (mp[ny][nx] == '.') {
        mp[ny][nx] = a;
        f(mp, ny, nx, a);
      } else if (mp[ny][nx] == 'w' && a == 'b' || mp[ny][nx] == 'b' && a == 'w') {
        mp[ny][nx] = '#';
        f(mp, ny, nx, a);
      }
    }
  }
}

signed main() {

  while (cin >> w >> h) {
    if (w == 0 && w == 0) break;
    char mp[100][100];
    rep(i, h) rep(j, w) cin >> mp[i][j];

    rep(i, h) {
      rep(j, w) {
        if (mp[i][j] == 'W') {
          f(mp, i, j, 'w');
        } else if (mp[i][j] == 'B') {
          f(mp, i, j, 'b');
        }
      }
    }
    // rep(i, h) {
    //   rep(j, w) cout << mp[i][j];
    //   cout << endl;
    // }
    int white = 0, black = 0;
    rep(i, h) rep(j, w) {
      if (mp[i][j] == 'w')
        white++;
      else if (mp[i][j] == 'b')
        black++;
    }
    cout << black << ' ' << white << endl;
  }
  return 0;
}



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

typedef complex<double> P;
typedef pair<P,P> L;

const double INF = 1e+12;
const double EPS = 1e-8;

double dot(P a, P b){ return real(conj(a)*b); }

double cross(P a, P b){ return imag(conj(a)*b); }

P rotate(P p, double rad){
  double x = real(p) * cos(rad) - imag(p) * sin(rad);
  double y = real(p) * sin(rad) + imag(p) * cos(rad);
  return P(x,y);
}

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

bool isIntersect(L s1, L s2){
  if(max(real(s1.first), real(s1.second)) + EPS < min(real(s2.first), real(s2.second)) ||
     max(imag(s1.first), imag(s1.second)) + EPS < min(imag(s2.first), imag(s2.second)) ||
     max(real(s2.first), real(s2.second)) + EPS < min(real(s1.first), real(s1.second)) ||
     max(imag(s2.first), imag(s2.second)) + EPS < min(imag(s1.first), imag(s1.second))) return false;

  return ( ccw(s1.first,s1.second,s2.first) * ccw(s1.first,s1.second,s2.second) <= 0 &&
           ccw(s2.first,s2.second,s1.first) * ccw(s2.first,s2.second,s1.second) <= 0 );
}

double getDistanceSP(L s, P p){
  if(dot(s.second - s.first, p - s.first) < -EPS) return abs(p - s.first);
  if(dot(s.first - s.second, p - s.second) < -EPS) return abs(p - s.second);
  return abs(cross(s.second - s.first, p - s.first) / abs(s.second - s.first));
}

double getDistanceSS(L s1, L s2){
  if(isIntersect(s1,s2)) return 0.0;
  return min( min(getDistanceSP(s1, s2.first), getDistanceSP(s1, s2.second)),
              min(getDistanceSP(s2, s1.first), getDistanceSP(s2, s1.second)));
}

vector<P> getStar(double x, double y, double a, double r){
  vector<P> res;
  P p = P(0,r);
  a *= M_PI / 180.0;
  for(int i=0;i<5;i++){
    res.push_back(p);
    p = rotate(p, 2.0 / 5.0 * (M_PI * 2.0));    
  }
  for(int i=0;i<5;i++){
    res[i] = rotate(res[i], a);
    res[i] += P(x,y);
  }
  return res;
}

int n,be,al;
vector<vector<P> > v;

void solve(){
  double G[100][100];

  fill(G[0],G[n],INF);
  for(int i=0;i<n;i++) G[i][i] = 0;

  for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++)
      for(int k=0;k<5;k++)
        for(int l=0;l<5;l++)
          G[i][j] = G[j][i] = min(G[i][j], getDistanceSS(L(v[i][k],v[i][(k+1)%5]), L(v[j][l],v[j][(l+1)%5])));

  for(int k=0;k<n;k++)
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)
        G[i][j] = min(G[i][j], G[i][k] + G[k][j]);

  printf("%.10f\n",G[be][al]);
}

int main(){
  while(cin >> n >> be >> al && (n|be|al)){
    v.clear();
    be--;
    al--;
    for(int i=0;i<n;i++){
      double x,y,a,r;
      cin >> x >> y >> a >> r;
      v.push_back(getStar(x,y,a,r));
    }
    solve();
  }
}

Measured memory_bytes: 1368