akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i < n; ++i)

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

void solve(ll N, ll D, vector<ll> X, vector<ll> Y) {
  ll ans(0);
  REP(i, N)
    if (X[i] * X[i] + Y[i] * Y[i] <= D * D)
      ans++;
  cout << ans << endl;
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;
  ll D;
  cin >> D;
  vector<ll> X(N);
  vector<ll> Y(N);
  REP(i, N) {
    cin >> X[i];
    cin >> Y[i];
  }

  solve(N, D, move(X), move(Y));

  return 0;
}


Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N;
  cin >> K;
  int dist = 0;
  int X;
  
  for (int i = 0; i < N; i++) {
    cin >> X;
    if (2 * X < K) {
      dist += 2 * X;
    } else {
      dist += 2 * (K - X);
    }    
  }
  
  cout << dist;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int n;
  int pow2[8] = {1, 2, 4, 8, 16, 32, 64, 128};
  cin >> n;
  int i;
  for(i = 0; i < 7; i++){
    if(pow2[i] <= n && n < pow2[i+1]) break;
  }
  cout << pow2[i] << endl;
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin>>n;
	vi A(n);
	rep(i, n){
		int a; cin>>a;
		A[a-1]++;
	}
	sort(all(A));
	vll sum(n+1);
	sum[0] = 0;
	rep(i, n) sum[i+1]=sum[i]+A[i];

	for(int k=1; k<=n; k++){
		int left=0, right=n/k+1;
		while(right-left>1){
			int mid = (left+right)/2;
			int idx = lower_bound(A.begin(), A.end(), mid)-A.begin();
			ll f = sum[idx] + mid*(n-idx);
			if (f>=mid*k){
				left = mid;
			}else{
				right = mid;
			}
		}
		cout << left << "\n";
	}
	return 0;
}


Measured memory_bytes: 4352
import sys
import math
from decimal import *
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def main():
    a, b, c = map(int, input().split())
    if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
        print('Yes')
    else:
        print('No')


main()


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll X, N;
  cin >> X >> N;
  set<ll> p;
  rep(i, N){
    ll a;
    cin >> a;
    p.insert(a);
  }
  ll ans = 1e18;
  ll val = 1e18;
  FOR(i, -100, 2000){
    if(p.count(i)==0){
      if(ans > abs(X - i)){
        ans = min(ans, abs(X - i));
        val = i;
      }
    }
  }
  cout << val;
  return 0;
}


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

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

    int n;
    cin >> n;
    for(int i = 1; i <= 100000; i++){
        int cnt = 0;
        for(int j = i; j >= 1; j--){
            if(i % j == 0) cnt++;
        }
        if(cnt == n){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3156
#include <cstdio>

int n;
int *a;

int solve(int i, int m) {
    if (m == 0) { return 1; }
    if (i >= n) { return 0; }
    int res = solve(i + 1, m) || solve(i + 1, m - a[i]);
    return res; 
}

int main() {
    scanf("%d", &n);
    a = new int[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

    int q;
    scanf("%d", &q);
    int m;
    for (int i = 0; i < q; i++) {
        scanf("%d", &m);
        if (solve(0, m)) { printf("yes\n"); }
        else { printf("no\n"); }
    }

    return 0;
}


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

using namespace std;

long long inf=1000000007;

int main(){
	long long n;
	cin>>n;
	map<long long,long long> num;
	long long sowa=0;

	for(long long i=0;i<n;i++){
		long long hoge;
		cin>>hoge;
		num[hoge]++;
		sowa+=hoge;
	}

	long long q;
	cin>>q;

	for(long long i=0;i<q;i++){
		long long b,c;
		cin>>b>>c;
		long long dis=c-b;
		sowa+=num[b]*dis;
		num[c]+=num[b];
		num[b]=0;
		cout<<sowa<<endl;
	}

	return 0;
}


Measured memory_bytes: 9360
import java.util.*;

public class Main {
	public static void main(String[] args) {  
  		Scanner sc = new Scanner(System.in);
		String b = sc.next();
      	Map<String, String> map = new HashMap<>();
      	map.put("A", "T");
      	map.put("T", "A");
      	map.put("C", "G");
      	map.put("G", "C");
      	System.out.println(map.get(b));
    }
}

Measured memory_bytes: 19924
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramB
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();

            var result = 0;

            for (var i = 0; i < s.Length - t.Length + 1; i++)
            {
                var count = 0;
                for (var j = 0; j < t.Length; j++)
                {
                    if (s[i + j] == t[j])
                    {
                        count++;
                    }
                }
                result = Math.Max(result, count);
            }
            Console.WriteLine(t.Length - result);
        }
    }
}


Measured memory_bytes: 25960
a = list(map(int, input().split()))
if (a[0] == a[1]) and (a[0] == a[2]):
    print("No")
elif (a[0] == a[1]) and (a[0] != a[2]):
    print("Yes")
elif (a[0] == a[2]) and (a[0] != a[1]):
    print("Yes")
elif (a[1] == a[2]) and (a[0] != a[1]):
    print("Yes")
else:
    print("No")


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

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define OK "Yes"
#define NO "No"

int main(){
    string s;cin>>s;
    int n=s.size();

    int N=0,W=0,S=0,E=0;
    rep(i,s.size()){
        if(s[i]=='N') N++;
        if(s[i]=='S') S++;
        if(s[i]=='W') W++;
        if(s[i]=='E') E++;
    }

    bool f1 = ((N>0 and S>0) or (N==0 and S==0));
    bool f2 = ((W>0 and E>0) or (W==0 and E==0));

    if(f1 and f2) cout << OK << endl;
    else cout << NO << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	var count int
	for n > 0 {
		count++
		n = n / k
	}
	fmt.Println(count)
}

func JoinInts(ints []int) string {
	return strings.Trim(strings.Join(strings.Fields(fmt.Sprint(ints)), ""), "[]")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define pb(n) push_back(n);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
vector<int> vi;
vector<lln> vl;
vector<pii> vii;
vector<pll> vll;


int arr[maxii];
int arr2[maxii];
bool check[maxii];
bool check2[1000][1000];
int n,m;
int x[]={1,-1,0,0};
int y[]={0,0,-1,1};
int x2[]={1,-1,0,0,1,-1,1,-1};
int y2[]={0,0,-1,1,1,-1,-1,1};
int bx[]={0,0,1,-1,-1,1,1,-1};
int by[]={1,-1,0,0,-1,-1,1,1};
int kx[] = {1,1,2,2,-1,-1,-2,-2};
int ky[] = {2,-2,1,-1,2,-2,1,-1};

bool isvisited(int x,int y)
{
    if(x<1 || y<1 || x>n ||y>m)
    {
        return false;
    }
    else if(check2[x][y]==true)
    {
        return false;
    }
    else true;
}
int gcd(int a,int b)
{
    if(b==0){
      return a;
     }
    return gcd(b,a%b);
}
int lcm(int a,int b)
{
    int res=(a*b)/gcd(a,b);
    return res;
}
int po(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b%2!=0)
        {
            res*=a;
            b--;
        }
        else
        {
            a*=a;
            b/=2;
        }
    }
    return res;
}

lln modMul(lln  a, lln b,lln mod){
    lln ans = 0;
    a = a % mod;
    while (b > 0){
        if ( b % 2 )ans = (ans%mod+ a%mod) % mod;
        a = (a%mod * 2%mod) % mod;
        b /= 2;
    }
    return ans % mod;
}
lln powerMod(lln a,lln b,lln mod){
	if(b==0)return 1LL%mod;
	lln x=powerMod( a,b/2,mod );
	x = ( x%mod * x%mod ) % mod;
	if( b%2==1 )x = ( x%mod * a%mod ) % mod;
	return x%mod;
}

int main()
{
    string a;
    cin>>a;
    set<char>st;
    int len=a.size();
    for(int i=0;i<len;i++)
    {
        st.insert(a[i]);
    }
    if(st.size()==len)cout<<"yes";
    else cout<<"no";
}





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

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> ans(n, pair<int, int>(make_pair(INT_MAX / 2, -1)));
    vector<vector<int>> path(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        path.at(a - 1).push_back(b - 1);
        path.at(b - 1).push_back(a - 1);
    }
    ans.at(0) = make_pair(0, 0);
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
    pq.push(ans.at(0));
    while(pq.size()) {
        pair<int, int> p = pq.top();
        pq.pop();
        rep(i, path.at(p.second).size()) {
            if(ans.at(path.at(p.second).at(i)).first > p.first + 1) {
                ans.at(path.at(p.second).at(i)) = make_pair(p.first + 1, p.second);
                pq.push(make_pair(p.first + 1, path.at(p.second).at(i)));
            }
        }
    }
    bool flag = true;
    rep(i, n) flag &= (ans.at(i).first < INT_MAX / 2);
    if(flag){
        cout << "Yes" << endl;
        rep(i, n - 1) cout << ans.at(i + 1).second + 1 << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 11104
import java.util.*;
public class Main {
    public static void main(String[] args) throws NumberFormatException {
        Scanner sc = new Scanner(System.in);

        String S = sc.nextLine().trim();
        String[] segments = S.split(" ");
        int N = Integer.parseInt(segments[0]);
        int K = Integer.parseInt(segments[1]);

        double result = 0;
        double np = (double)1.0 / N;
        for (int i = 1; i <= N; i++) {
            result += np * calcP(i, K);
        }
        System.out.println(result);
    }

    private static double calcP(int n, int k) {
        int score = n;
        int cnt = 0;
        while (score < k) {
            cnt++;
            score *= 2;
        }

        if (cnt > 0) {
            return Math.pow((double)0.5, cnt);
        } else {
            return 1;
        }
    }
}


Measured memory_bytes: 21716
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

const double EPS = 1e-9;

class Point {
public:
  double x;
  double y;

  Point(double x = 0.0, double y = 0.0) {
    this->x = x;
    this->y = y;
  }

  Point operator+(Point p) { return Point(x + p.x, y + p.y); }

  Point operator-(Point p) { return Point(x - p.x, y - p.y); }

  Point operator*(double a) { return Point(a * x, a * y); }

  Point operator/(double a) { return Point(x / a, y / a); }

  double norm() { return x * x + y * y; }

  double abs() { return sqrt(norm()); }

  double arg() { return atan2(y, x); }

  bool operator<(const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator==(const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};

typedef Point Vector;

class Circle {
public:
  Point c;
  double r;

  Circle(Point c = Point(), double r = 0.0) {
    this->c = c;
    this->r = r;
  }

  pair <Point, Point> getCrossPoints(Circle c2) {
    double d = (c - c2.c).abs();
    double a = acos((r * r + d * d - c2.r * c2.r) / (2 * r * d));
    double t = (c2.c - c).arg();

    return make_pair(c + polar(r, t + a), c + polar(r, t - a));
  }

private:

  Vector polar(double a, double r) {
    return Point(cos(r) * a, sin(r) * a);
  }
};

double getDistance(Point a, Point b) {
  return (a - b).abs();
}

bool intersect(Circle c1, Circle c2) {
  return abs(c1.r - c2.r) <= getDistance(c1.c, c2.c) && getDistance(c1.c, c2.c) < c1.r + c2.r + EPS;
}

int main() {
  int c1x, c1y, c1r;
  int c2x, c2y, c2r;

  cin >> c1x >> c1y >> c1r;
  cin >> c2x >> c2y >> c2r;

  Circle c1(Point(c1x, c1y), c1r);
  Circle c2(Point(c2x, c2y), c2r);

  pair <Point, Point> res = c1.getCrossPoints(c2);

  Point p3 = res.first;
  Point p4 = res.second;

  if (p3.x < p4.x) {
    cout << fixed << setprecision(10) << p3.x << " " << p3.y << " " << p4.x << " " << p4.y << endl;
  } else if (p3.x == p4.x) {
    if (p3.y < p4.y) {
      cout << fixed << setprecision(10) << p3.x << " " << p3.y << " " << p4.x << " " << p4.y << endl;
    } else {
      cout << fixed << setprecision(10) << p4.x << " " << p4.y << " " << p3.x << " " << p3.y << endl;
    }
  } else {
    cout << fixed << setprecision(10) << p4.x << " " << p4.y << " " << p3.x << " " << p3.y << endl;
  }

  return 0;
}


Measured memory_bytes: 3660
N = int(input())


def func(n):
    if (N % n > 0):
        return 11
    else:
        # print("n = " + str(n) + ' ' + str(N // n))
        return len(str(N // n))

nn = min(range(1, int(N**(0.5) + 1)), key=func)
ans = len(str(N // nn))

print(ans)


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

int n;
string s;

string maxs(string a,string b){
  if(a=="invalid")return b;
  if(b=="invalid")return a;
  if(a.length()==b.length()){
    return a>b?a:b;
  }else return a.length()>b.length()?a:b;
}

string dfs(int l,int r){
  if(l>=r)return "invalid";
  bool isnum=true;
  string res="invalid";
  repl(i,l,r){
    if(s[i]=='('||s[i]==')'||s[i]=='L'||s[i]=='R'||s[i]==',')isnum=false;
  }
  if(isnum){
    if(s[l]=='0'&&r-l>1)return "invalid";
    res="";
    repl(i,l,r){
      if(s[i]=='?')res+="9";
      else res+=s[i];
    }
  }else{
    if(r-l<4)return "invalid";
    if(s[l]!='L'&&s[l]!='R'&&s[l]!='?')return "invalid";
    if(s[l+1]!='('&&s[l+1]!='?')return "invalid";
    if(s[r-1]!=')'&&s[r-1]!='?')return "invalid";
    repl(i,l+3,r-2){
      if(s[i]!=','&&s[i]!='?')continue;
      string ln=dfs(l+2,i);
      string rn=dfs(i+1,r-1);
      if(ln!="invalid"&&rn!="invalid"){
        if(s[l]=='L')res=maxs(res,ln);
        else if(s[l]=='R')res=maxs(res,rn);
        else res=maxs(res,maxs(ln,rn));
      }
    }
  }
  return res;
}

int main(){
	cin.sync_with_stdio(false);
  cin>>s;
  n=s.length();
  cout<<dfs(0,n)<<endl;
	return 0;
}

Measured memory_bytes: 3208
var btc_rate = 380000.0;
function main(input){
  var sum = 0;
  input.split("\n").filter((v,i)=>i>0).forEach(v=>{
    var a = Number(v.split(" ")[0]);
    var b = v.split(" ")[1];
    sum += Number(b=='JPY'?a:a*btc_rate);
  });
  console.log(sum);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
int d[100005],a[100005],n,m;
void add(int &a,int b){
	a = (a + b)%mod;
}
signed main(){
	d[0] = 1;
	cin >> n >> m;
	for(int i = 0 ; i < m ; i ++){
		int x; cin >> x;
		a[x] = 1;
	}
	for(int i = 0 ; i < n ; i ++){
		if(!a[i + 1]) add(d[i + 1], d[i]);
		if(!a[i + 2]) add(d[i + 2], d[i]);
	}
	cout << d[n];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
int diff = abs(a-b);

if(diff%2 !=0) // odd number{
	{
		cout << "IMPOSSIBLE" << endl;
}

else{
	cout << min(a,b) + (diff/2) << endl;
}

return 0;

}


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

int main()
{
    string s;
    cin>>s;
    int max = 0;
    int curr =0;
    for(int i=0;i<s.length() ;i++)
    {
        if( s[i] != 'A' && s[i] != 'C'&& s[i] != 'T' && s[i] !='G' )
        {
            curr =0;
        }
        else
        {
            curr++;
            if( curr> max)
                max = curr;
        }
    }
    cout<<max;
}

Measured memory_bytes: 3564
package main

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

var sc *bufio.Scanner

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 0), 1000000001*3)
	sc.Split(bufio.ScanWords)
	a, b := nextInt(), nextInt()
	gcd := gcd(a, b)

	ans := 1
	gcdCopy := gcd
	for d := 2; d*d <= gcd; d++ {
		if gcdCopy%d != 0 {
			continue
		}
		ans++
		for gcdCopy%d == 0 {
			gcdCopy /= d
		}
	}
	if gcdCopy > 1 {
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

	string S, T;
	cin >> S >> T;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] != T[i]) {
			cout << "No" << endl;
			goto EndPoint;
		}
	}
	cout << "Yes" << endl;

EndPoint:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG

	return 0;
}




Measured memory_bytes: 3076
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	map<string, bool> memo;
	string s;
	int n, m;
	cin >> n;
	rep(i, n){
		cin >> s;
		memo[s] = 1;
	}
	cin >> m;
	int cnt = 0;
	rep(i, m){
		cin >> s;
		if(memo[s])cnt++;
	}
	FIN(cnt);

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Measured memory_bytes: 6688
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
alist = [a1[0] ,a1[1] ,a1[2], a2[0], a2[1], a2[2], a3[0], a3[1], a3[2]]
n = int(input())
b = [int(input()) for _ in range(n)]
ans = 'No'
for i in b:
    for ji, jv in enumerate(alist):
        if i == jv:
            alist[ji] = 0

if sum(alist[0:3]) == 0:
    ans = 'Yes'
if sum(alist[3:6]) == 0:
    ans = 'Yes'
if sum(alist[6:9]) == 0:
    ans = 'Yes'
if sum(alist[0::3]) == 0:
    ans = 'Yes'
if sum(alist[1::3]) == 0:
    ans = 'Yes'
if sum(alist[2::3]) == 0:
    ans = 'Yes'
if (alist[0] + alist[4] + alist[8]) == 0:
    ans = 'Yes'
if (alist[2] + alist[4] + alist[6]) == 0:
    ans = 'Yes'
print(ans)

Measured memory_bytes: 38608
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

const int INF = 1 << 30;
const uint64_t MOD = 1000000000 + 7;

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

	vector<vector<int>> a(n, vector<int>(3));

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			cin >> a.at(i).at(j);
		}
	}

	vector<vector<uint64_t>> dp(n + 1, vector<uint64_t>(3));

	int p = -1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			for (int k = 0; k < 3; k++)
			{
				if (j == k)
				{
					continue;
				}
				dp.at(i).at(k) = max(dp.at(i).at(k), dp.at(i - 1).at(j) + a.at(i - 1).at(k));
			}
		}
	}

	uint64_t out = 0;
	for (int i = 0; i < 3; i++)
	{
		out = max(out, dp.at(n).at(i));
	}
	cout << out << endl;
}


Measured memory_bytes: 11136
using System;
using System.Collections.Generic;
using System.Text;


namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 1;
            while (true)
            {
              string s = Console.ReadLine();

              if (s == "0")
                {
                    break;
                }
              Console.WriteLine("Case "+n+": "+s);
              n++;
            }

          

        }
    }
}

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

class Main {
	
	public static int[][] paper = new int[16][16];
	
	public static void small (int x, int y) {
		
		paper[y][x]++;
		paper[y - 1][x]++;
		paper[y + 1][x]++;
		paper[y][x - 1]++;
		paper[y][x + 1]++;
		
	}
	
	public static void middle (int x, int y) {
		
		small(x,y);
		paper[y - 1][x - 1]++;
		paper[y - 1][x + 1]++;
		paper[y + 1][x - 1]++;
		paper[y + 1][x + 1]++;
		
	}
	
	public static void big (int x, int y) {
		
		middle(x,y);
		paper[y - 2][x]++;
		paper[y + 2][x]++;
		paper[y][x - 2]++;
		paper[y][x + 2]++;
		
	}
	
	public static void main(String[] args) throws IOException {

		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		
		while (true) {
			
			String s = br.readLine();
			if (s == null) break;
			StringTokenizer st = new StringTokenizer(s,",");
			int x = Integer.parseInt(st.nextToken()) + 3;
			int y = Integer.parseInt(st.nextToken()) + 3;
			int size = Integer.parseInt(st.nextToken());
			
			switch (size) {
				case 1 : small(x,y);  break;
				case 2 : middle(x,y); break;
				case 3 : big(x,y);    break;
			}
			
		}
		
		int max = 0;
		int cnt = 0;
		
		for (int i = 3; i < paper.length - 3; i++) {
			for (int j = 3; j < paper.length - 3; j++) {
				max = Math.max(max, paper[i][j]);
				if (paper[i][j] == 0) cnt++;
			}
		}
		System.out.printf("%d\n%d\n", cnt, max);
	}

}

Measured memory_bytes: 11000
//https://atcoder.jp/contests/abc043/tasks/abc043_b

//struct cmp {bool operator()(const pair<int, char> &a, const pair<int, char> &b) {if (a.first == b.first) {return a.second > b.second;} else {return a.first > b.first;}}};
#include<bits/stdc++.h>
#define endl "\n"
#define _  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define min_heap priority_queue <int, vector<int>, greater<int> >
#define max_heap priority_queue <int>
#define ll long long
//#define int long long
#define MOD 1000000007#define deb3(x,y,z) cout << #x << "=" << x << "\t"<<#y<<"="<<y<< "\t"<<#z<<"="<<z<<endl;
#define DEBUG cout<<"Hello1\n";
#define deb(x) cout << #x << " " << x << endl;
#define deb2(x,y) cout << #x << "=" << x << "\t\t"<<#y<<"="<<y<<endl;
#define deb3(x,y,z) cout << #x << "=" << x << "\t"<<#y<<"="<<y<< "\t"<<#z<<"="<<z<<endl;
#define all(v) (v).begin(),(v).end()
using namespace std;

void solve() {
	string s;
	cin >> s;

	vector<bool> ans(s.length(), true);

	for (int i = 1; i < s.length(); i++) {
		if (s[i] == 'B') {
			ans[i] = false;
			for (int j = i - 1; j >= 0 ; j--) {
				if (ans[j]) {
					ans[j] = false;
					break;
				}
			}
		}
	}

	for (int i = 0; i < s.length(); i++) {
		if (ans[i] && s[i] != 'B') {
			cout << s[i];
		}
	}
}

int32_t main() {
	_


	solve();
}



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

using namespace std;

#define allof(x) (x).begin(), (x).end()

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

int N;
string str;

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

    cin >> N >> str;

    int numW = 0, numE = 0;
    for(int a = 0; a < N; a++){
        numE += str[a] == 'E';
    }

    int best = 1e9;
    for(int a = 0; a < N; a++){
        numE -= str[a] == 'E';

        best = min(best, numE + numW);

        numW += str[a] == 'W';
    }

    cout << best;
}


Measured memory_bytes: 720
def main():
    L = int(input())
    A = [int(input()) for _ in range(L)]
    dp = [[0] * 5 for _ in range(L+1)]
    for i in range(L):
        dp[i+1][0] = dp[i][0] + A[i]
        dp[i+1][1] = min(dp[i][:2]) + A[i] % 2 + (2 if A[i] == 0 else 0)
        dp[i+1][2] = min(dp[i][:3]) + (A[i]+1) % 2
        dp[i+1][3] = min(dp[i][:4]) + A[i] % 2 + (2 if A[i] == 0 else 0)
        dp[i+1][4] = min(dp[i][:5]) + A[i]
    print(min(dp[L]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 84304
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
char c[100][101]={};
int main(){ _;
  int a,b;cin>>a>>b;
  for(int y=0;y<50;y++){
    REP(x,100)
      c[y][x]='#';
  }
  for(int y=50;y<100;y++){
    REP(x,100)
      c[y][x]='.';
  }
  int asum=1,bsum=1;
  for(int y=0;y<50;y+=2){
    for(int x=0;x<100;x+=2){
      if(asum==a)break;
      c[y][x]='.';
      asum++;
    }
    if(asum==a)break;
  }
  for(int y=51;y<100;y+=2){
    for(int x=0;x<100;x+=2){
      if(bsum==b)break;
      c[y][x]='#';
      bsum++;
    }
    if(bsum==b)break;
  }
  cout<<"100 100"<<endl;
  REP(y,100)
    cout<<c[y]<<endl;
}


Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8'); 
var lines = [];
var reader = require('readline').createInterface({
	input: process.stdin,
	output: process.stdout
});
 
reader.on('line', (line) => {
	lines.push(line);
});

reader.on('close', () => {
	"use strict"
	const ABC = lines[0].split(" ").map(Number);
	const A = ABC[0];
	const B = ABC[1];
	const C = ABC[2];
	
	console.log((A<C&&C<B)||(A>C&&C>B) ? "Yes":"No");
});

Measured memory_bytes: 7500
n,m = map(int,input().split())
def getDivisor(inte):
    Ans1 = [1]
    Ans2 = [inte]
    for i in range(2,int(inte**(0.5))):
        if inte % i == 0:
            Ans1.append(i)
            Ans2.append(int(inte/i))
    if inte % inte**(0.5) == 0:
        Ans1.append(int(int(inte**(0.5))))
    Ans = Ans1 + Ans2[::-1]
    return Ans

limit = int(m/n)
for i in reversed(getDivisor(m)):
    if i <= limit:
        print(i)
        break


Measured memory_bytes: 3188
//
// Created by Debajyoti Dasgupta on 11-04-2020.
//

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define fr(i, n) for(int i=0;i<n;i++)
#define frr(i, n) for(int i=n;i>=0;i--)
#define fra(i, a, n) for(int i=a;i<n;i++)
#define frra(i, a, n) for(int i=a;i>=n;i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define ff first
#define ss second
#define endl '\n'

typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef set<int> si;
typedef unordered_map<int, int> uii;
typedef unordered_set<int> usi;
typedef vector<int> vi;

const int mod = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int inf = LONG_LONG_MAX;

using point = pair<pii, pii>;

void solve() {
    //CODE BEGIN
    int n;
    cin >> n;
    string s;
    cin >> s;
    unordered_map<char, vector<int>> m;
    for (int i = 0; i < (int) s.length(); ++i) {
        m[s[i]].eb(i);
    }
    int ans = 0;
    char a[] = {'R', 'B', 'G', 'R'};
    char comp[] = {'G', 'R', 'B'};
    for (int k = 0; k < 3; ++k) {
        char x = a[k], y = a[k + 1], z = comp[k];
        for (int i = 0; i < m[x].size(); ++i) {
            for (int j = 0; j < m[y].size(); ++j) {
                if (m[x][i] < m[y][j]) {
                    ans += m[z].end() - ub(all(m[z]), m[y][j]);
                    auto it = lb(all(m[z]), 2 * m[y][j] - m[x][i]);
                    if (it != m[z].end() && *it == 2 * m[y][j] - m[x][i])ans--;
                } else {
                    ans += m[z].end() - ub(all(m[z]), m[x][i]);
                    auto it = lb(all(m[z]), 2 * m[x][i] - m[y][j]);
                    if (it != m[z].end() && *it == 2 * m[x][i] - m[y][j])ans--;
                }
            }
        }
    }
    cout << ans << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
//    cin >> t;
    for (int i = 0; i < t; ++i) {
//        cout << "Case #" << i + 1 << ": " << endl;
        solve();
    }
    return 0;
}

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

int main()
{
    long long N,sum=0,sum2=0;
    string S;
    cin >> N >> S;
    for(int i=0; i<N; i++){
        if(S[i] == 'E'){
            sum++;
        }
    }
    long long ans = N + 1;
    long long num = N -1;
    for(int i=0; i<N; i++){
        if(S[i] == 'E'){
            sum--;
        }
        ans = min(ans,sum+sum2);
        if(S[i] == 'W'){
            sum2++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#include <algorithm>
#include <array>
#include <chrono>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>
#define FOR(i, n, m) for (ll i = n; i < (ll)m; i++)
#define FORr(i, m, n) for (ll i = n; i >= (ll)m; i--)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define sortAl(v) sort(v.begin(), v.end())
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())
#define cout(n) cout << fixed << setprecision(n)

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

  ll N, M;
  cin >> N >> M;

  vector<pair<ll, ll>> requests(M);
  FOR(i, 0, M) { cin >> requests[i].first >> requests[i].second; }

// firstは降順、secondは昇順
#if 0
  sort(requests.begin(), requests.end(),
       [](pair<ll, ll> const& l, pair<ll, ll> const& r) {
         if (l.first > r.first) return true;
         if (l.first == r.first && l.second < r.second) return true;
         return false;
       });
#endif

  sortAlr(requests);

  ll cnt = 0;

  while (requests.size() > 0) {
    // requests[0].firstとrequests[0].first+1の間の橋を破壊
    ll t = requests[0].first;
    auto result = remove_if(requests.begin(), requests.end(),
                            [=](pair<ll, ll> r) { return t < r.second; });
    // remove_ifでは実際に削除はされていなく、最終的にeraseする必要がある
    requests.erase(result, requests.end());

    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint x;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> x;
	
	for(llint i = -1000; i <= 1000; i++){
		llint a = i*i*i*i*i;
		for(llint j = -1000; j <= 1000; j++){
			llint b = j*j*j*j*j;
			if(a - b == x){
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		Console.WriteLine("{0}",s[0]<=s[1]?"unsafe":"safe");
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < n; i++)
#define REP(n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using INT64 = long long;
using UINT64 = unsigned long long;
#define MOD 1000000007

int main(void)
{
    IOS
    int n,k; cin >> n >> k;
    vector<int> v(n);
    REP(n) cin >> v[i];

    int jmax = min(n,k+1);
    vector<int> dp(n+1,-1);
    dp[0] = 0;

    FOR(i,0,n) {
        FOR(j,1,jmax) {
            if (i+j == n) break;
            if (dp[i+j] == -1) {
                dp[i+j] = dp[i] + abs(v[i+j] - v[i]);
            } else {
                dp[i+j] = min(dp[i+j], dp[i] + abs(v[i+j] - v[i]));
            }
        }
    }

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

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long
#define popcount __builtin_popcount
signed main(){
  int h,w,k,res;
  cin>>h>>w>>k;
  res=h+w;
  vector<vector<bool>> ch(h,vector<bool>(w));
  for(int i=0;i<h;++i){
    string s;
    cin>>s;
    for(int j=0;j<w;++j)ch[i][j]=s[j]=='1';
  }
  for(int i=0;i<1<<(h-1);++i){
    vector<int> cnt(popcount(i)+1,0),rst(cnt);
    int cut=popcount(i);
    bool flw=false,first=true;
    for(int j=0;cut<res&&j<w;++j){
      int c=i,cl=0;
      for(int l=0;l<h;c>>=!!l++){
        if(l&&c&1)++cl;
        if(k<(cnt[cl]+=ch[l][j]))flw=true;
      }
      cerr<<"["<<i<<","<<j<<":"<<cut<<"]";
      for(auto i:cnt)cerr<<" "<<i;
      if(flw)cerr<<"!";
      cerr<<endl;
      if(flw){
        if(first){
          cut=res;
          continue;
        }
        ++cut;
        cnt=rst;
        --j;
        first=true;
        flw=false;
      }
      else first=false;
    }
    if(cut<res)res=cut;
  }
  cout<<res;
}

Measured memory_bytes: 256
#include<iostream>
int main()
{
	int a;
	int b;
	int c;
	std::cin >> a;
	std::cin >> b;
	std::cin >> c;
	if (a < b&&b < c) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}

}



Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
int a[2000100];
int main()
{
	int n,q;scanf("%d%d",&n,&q);
	while (q--)
	{
		int u,v;scanf("%d%d",&u,&v);
		a[u]^=1;a[v]^=1;
	}
	for (int i=1;i<=n;i++) if (a[i]) {printf("NO\n");return 0;}
	printf("YES\n");
}

Measured memory_bytes: 640
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0

N,K = I()
h = l()
for i in range(N):
    if h[i] >= K:
        count += 1

print(count)


Measured memory_bytes: 19616
#include <cstdio>
typedef long long int64;
static const int MAXN = 1e5 + 4;
static const int MODULUS = 1e9 + 7;
#define _  %  MODULUS
#define __ %= MODULUS

int n;
int x[MAXN];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d", &x[i]);

    int64 ans = 1;
    int s = 0;
    for (int i = 0, j; i < n; i = j + 1) {
        for (j = i; j < n; ++j)
            if (x[j] >= 2 * s + 1) ++s;
            else { (ans *= (s + 1))__; break; }
    }

    for (int i = 1; i <= s; ++i) (ans *= i)__;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 512
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
answer = 0
if N%2 == 0:
    lower = A[:N//2]
    upper = A[N//2:]
    x = 2 * sum(upper) - upper[0]
    y = 2 * sum(lower) - lower[-1]
    answer = x - y
else:
    mid = A[N//2]
    lower = A[:N//2]
    upper = A[N//2 + 1:]
    r1 = 2 * sum(upper) - mid - (2 * sum(lower) - lower[-1])
    r2 = 2 * sum(upper) - upper[0] + mid - 2 * sum(lower)
    answer = max(r1, r2)
print(answer)    


Measured memory_bytes: 7764
#[正の約数]の1次元リスト

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


#[素因数]の1次元リスト

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


L = list(map(int,input().split()))
A = max(L)
B = min(L)

D_A = divisors(A)
D_B = divisors(B)

common_div = []
for _ in D_B:
	if _ in D_A:
		common_div.append(_)

m = max(common_div)
f = factorize(m)
print(len(f))

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

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

  int max_a = va.front(), idx = 0;
  for (int i = 0; i < va.size(); ++i) {
    if (abs(max_a) < abs(va[i])) {
      max_a = va[i];
      idx = i;
    }
  }

  cout << (n - 1) * 2 << '\n';
  for (int i = 0; i < n; ++i) {
    if (idx != i) {
      cout << idx + 1 << ' ' << i + 1 << '\n';
    }
  }

  if (max_a >= 0) {
    for (int i = 0; i < n - 1; ++i) {
      cout << i + 1 << ' ' << i + 2 << '\n';
    }
  } else if (max_a < 0) {
    for (int i = n - 1; i > 0; --i) {
      cout << i + 1 << ' ' << i << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    string S;
    cin >> S;
    // R *** L
    // R Lで往復する
    // Rの連続の移動とLの連続の移動は RL が現れるまで続く
    //Rにより RL に到達した数とLにより RL に到達した数を数える
    vector<long> Rpos(S.size());
    long Rcount=0;
    for(size_t i=0;i<S.size(); i++)
    {
        if(S[i] == 'R') Rcount++;
        else Rcount = 0;
        if(S.substr(i, 2) == "RL")
        {
            Rpos[i]  =  Rcount / 2 + Rcount % 2;
            Rpos[i+1] = Rcount / 2;
        }
    }
    vector<long> Lpos(S.size());
    long Lcount=0;
    for(size_t i=S.size()-1;i>0; i--)
    {
        if(S[i] == 'L') Lcount++;
        else Lcount = 0;
        if(S.substr(i-1, 2) == "RL")
        {
            Lpos[i-1]  = Lcount / 2;
            Lpos[i]    = Lcount / 2 + Lcount % 2;
        }
    }
    for(size_t i=0;i<S.size(); i++)
    {
        cout << Rpos[i] + Lpos[i] << " ";
    }
    cout << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 2256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	string s;
	string t;
	cin>>s>>t;
	int maxx=0;
	int a=0;
	int b=0;
	int c=0;
	int w;
	for(int i=0;i<=(s.size()-t.size());i++){
		c+=a;
		b=0;
		for(int j=0;j<t.size();j++){
            if(s[c]==t[j]){
				b++;
			}
			c++;
		}
		c=0;
		a++;
		maxx=max(maxx,b);
	}
	w=t.size();
	cout<<w-maxx<<endl;
    return 0;
}


Measured memory_bytes: 3604
import sys, string
alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
  while not('the' in s or 'this' in s or 'that' in s):
    s = s.translate(tbl)
  print s[:-1]

Measured memory_bytes: 4368
#include <bits/stdc++.h>
#define prob "E"
#define N 100001
#define ii pair< int, int>
#define fi first
#define se second
#define pb push_back
#define ll long long
#define io freopen(prob".inp","r",stdin); freopen(prob".out","w",stdout);
using namespace std;
int n,a[N];
ii est[N],er[N];
void Est()
{
    stack<int>st;
    for(int i=1; i<=n; i++)
    {
        while(!st.empty()&&a[st.top()]<a[i]) st.pop();
        if(st.empty()) est[i].fi=1;
        else est[i].fi=st.top()+1;
        st.push(i);
    }
    while(!st.empty()) st.pop();
    for(int i=n; i>=1; i--)
    {
        while(!st.empty()&&a[st.top()]<a[i]) st.pop();
        if(st.empty()) est[i].se=n;
        else est[i].se=st.top()-1;
        st.push(i);
    }
 //   for(int i=1; i<=n; i++) cout<<est[i].fi<<'*'<<est[i].se<<"  ";
  //  cout<<endl;
}
int it[N*4],itt[N*4],pos[N];
void update(int i,int l,int r,int x)
{
    if(l>x||r<x) return;
    if(l==r)
    {
        if(l==x) it[i]=itt[i]=x;
        //   cout<<l<<' '<<r<<' '<<it[i]<<endl;
        return;
    }
    int mid=(l+r)>>1;
    update(i*2,l,mid,x);
    update(i*2+1,mid+1,r,x);
    it[i]=min(it[i*2],it[i*2+1]);
    itt[i]=max(itt[i*2],itt[i*2+1]);
    // cout<<l<<' '<<r<<' '<<it[i]<<endl;
}
int get(int i,int l,int r,int u,int v)
{
    //  cout<<u<<'*'<<v<<endl;
    if(l>v||r<u) return n+1;
    if(l>=u&&r<=v) return it[i];
    int mid=(l+r)>>1;
    return min(get(i*2,l,mid,u,v),get(i*2+1,mid+1,r,u,v));
}
int gett(int i,int l,int r,int u,int v)
{
    if(u>v) return 0;
    if(l>v||r<u) return 0;
    if(l>=u&&r<=v) return itt[i];
    int mid=(l+r)>>1;
    return max(gett(i*2,l,mid,u,v),gett(i*2+1,mid+1,r,u,v));
}
void solve()
{
    ll ans=0;
    int er,p;
    for(int i=1; i<=n*4; i++) it[i]=n+1,itt[i]=0;
    for(int i=n; i>=1; i--)
    {
        p=pos[i];
       // cout<<p<<endl;
        if(est[p].fi>1)
        {
            er=gett(1,1,n,est[est[p].fi-1].fi,est[p].fi-2);
            if(er==0) er=est[est[p].fi-1].fi-1;
         //   cout<<"1 "<<er<<endl;
            ans+=(ll)max(0,est[p].fi-1-er)*(ll)max(0,est[p].se-p+1)*(ll)a[p];
           // cout<<ans<<endl;
        }
        if(est[p].se<n)
        {
            er=get(1,1,n,est[p].se+2,est[est[p].se+1].se);
            if(er==n+1) er=est[est[p].se+1].se+1;
           // cout<<"2 "<<er<<' '<<endl;
            ans+=(ll)max(0,p-est[p].fi+1)*(ll)max(0,(er-est[p].se-1))*(ll)a[p];
           // cout<<ans<<endl;
        }
        update(1,1,n,p);
    }
    cout<<ans;
}
void read()
{
    cin>>n;
    for(int i=1; i<=n; i++) cin>>a[i],pos[a[i]]=i;
    Est();
    solve();
}
int main()
{
//    io
    read();
}


Measured memory_bytes: 5608