akhauriyash/Code-Regression huggingface dataset:
import sys
import bisect

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


class Bit:

    def __init__(self, a):
        if hasattr(a, "__iter__"):
            le = len(a)
            self.n = 1 << le.bit_length()  # le を超える最小の 2 冪
            self.values = values = [0] * (self.n + 1)
            values[1:le + 1] = a[:]
            for i in range(1, self.n):
                values[i + (i & -i)] += values[i]
        elif isinstance(a, int):
            self.n = 1 << a.bit_length()
            self.values = [0] * (self.n + 1)
        else:
            raise TypeError

    def add(self, i, val):
        n, values = self.n, self.values
        while i <= n:
            values[i] += val
            i += i & -i

    def sum(self, i):  # (0, i]
        values = self.values
        res = 0
        while i > 0:
            res += values[i]
            i -= i & -i
        return res

    def bisect_left(self, v):  # self.sum(i) が v 以上になる最小の i
        n, values = self.n, self.values
        if v > values[n]:
            return None
        i, step = 0, n >> 1
        while step:
            if values[i + step] < v:
                i += step
                v -= values[i]
            step >>= 1
        return i + 1


def main():

    N, D, A = in_nn()
    XH = sorted(in_nl2(N))
    X = [0] * N
    H = [0] * N

    for i in range(N):
        x, h = XH[i]
        X[i] = x
        H[i] = h

    bit = Bit(N)

    ans = 0
    for i in range(N):

        x, h = X[i], H[i]
        j = bisect.bisect_right(X, x + 2 * D)
        cnt_bomb = bit.sum(i + 1)

        h -= A * cnt_bomb
        if h <= 0:
            continue

        cnt = -(-h // A)
        ans += cnt
        bit.add(i + 1, cnt)
        bit.add(j + 1, -cnt)

    print(ans)


if __name__ == '__main__':
    main()


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

long double distance(vector<int> a, vector<int> b, vector<int> p){
long double D = 0;
   for(int i = 0; i < p.size() - 1; i++){

   D += sqrtl( pow(( b.at(p.at(i + 1)) - b.at(p.at(i)) ), 2) +
                     pow(( a.at(p.at(i + 1)) - a.at(p.at(i)) ), 2) );

   }
return D;
}

int main() {
int N;cin >> N;
long double sum = 0, Ans;
vector<int> A(N);
vector<int> B(N);
vector<int> P(N);

   for(int i = 0; i < N; i++){

   cin >> A.at(i) >> B.at(i);
   P.at(i) = i;

}

   do{
   
   sum += distance(A, B, P);

   }while(next_permutation(P.begin(), P.end()));

long int n = 1;

for(int i = 1; i <= N; i++)n *= i;

Ans = sum/n;

cout << fixed << setprecision(10) << Ans << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
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;
}
using namespace std;

void solve(){
    int n;
    cin>>n;
    vector<int>a(n);
    int even=0;
    rep(i,n){
        cin>>a[i];
        if(a[i]%2==0)++even;
    }
    cout<<(int)pow(3,n)-(int)pow(2,even)<<"\n";
}
 
signed main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    int k,t; cin >> k >> t;
    vector<int> a(t);
    for(int i = 0;i < t;i ++) cin >> a.at(i);

    sort(a.begin(),a.end());
    int m = a.at(t-1);

    int ans;
    if(m <= (k+1)/2) ans = 0;
    else ans = (m- (k+1)/2) * 2;

    if(ans > 0) ans -= (k+1) % 2;

    cout << ans << endl;

}

Measured memory_bytes: 3668
//Littleboy123 Template 1.7
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

//pragmas

// #pragma comment(linker, "/stack:200000000")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")


typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef unsigned long long int ull;
typedef long double ld;
typedef unsigned long long ull;

const long double pi = acos(-1.0);

#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define TC(n) cout << "Case #" << (n) << ": "
#define DEBUG(x) cout << "DEBUG " << #x << ' ' << x << '\n';
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>

void init(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void infile(){
    freopen("fenwick.in", "r", stdin);
}

void outfile(){
    freopen("fenwick.out", "w", stdout);
}

ll modex(ll a, ll b, ll mod){
    if(b == 0)
        return 1;
    if(b == 1)
        return a;
    ll tmp = modex(a, b/2, mod);
    tmp = (tmp * tmp) % mod;
    if(b & 1)
        tmp = (tmp * a) % mod;
    return tmp;
}

//End of template

int main(){
    init();

    string s;
    cin >> s;
    int maks = 0;
    int len = s.length();
    int cnt = 0;
    FOR(i, 0, len){
        if(s[i] == 'R'){
            cnt++;
        }
        else{
            cnt = 0;
        }
        maks = max(maks, cnt);
    }
    cout << maks << endl;
    return 0;
}


Measured memory_bytes: 3584
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iostream>
#include <set>
#include <string>

using namespace std;

long long x;

bool check_answer(long long b, long long b_5) {
  // A^5を求める
  long long a_5 = b_5 + x;

  // A^5が1ならそれが答え
  if (a_5 == 1) {
    cout << 1 << " " << b << endl;
    return true;
  }

  // A^5が5乗数かどうか判定
  long long a = pow(a_5, 0.2);

  if (pow(a, 5) == a_5) {
    cout << a << " " << b << endl;
    return true;

  } else if (pow(a + 1, 5) == a_5) {
    cout << a + 1 << " " << b << endl;
    return true;
  }

  return false;
}

int main() {
  cin >> x;

  // 0を確認
  if (check_answer(0, 0)) {
    return 0;
  }

  // 1から順に全探査
  for (long long b = 1; true; b++) {
    // B^5を求める
    long long b_5 = b * b * b * b * b;

    // 正、負両方確認
    if (check_answer(b, b_5)) {
      break;
    } else if (check_answer(-b, -b_5)) {
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;


void printVector(const vector<int>& vec) {
	 for (int value : vec) {
		 cout << value << " ";
	 }
	 cout << endl;
}

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

	for (int i=0; i<1000; i++) {
		vector<int> ans(1, i%10);
		int ni = i / 10;
		while (ni>0) {
			ans.push_back(ni%10);
			ni = ni / 10;
		}
		reverse(ans.begin(), ans.end());
		if (ans.size() != n) continue;
		// printVector(ans);
		bool valid_ok = true;
		for (int j=0; j<m; j++) {
			if (ans[s[j]-1] != c[j]) {
				valid_ok = false;
				break;
			}
		}
		if (valid_ok) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 888
w = input()
D = {}

for i in range(len(w)):
    if w[i] in D:
        D[w[i]] += 1
    else:
        D[w[i]] = 1
for x in D.values():
    if x % 2 == 1:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 9116
dice = [0,1,2,3,4,5,6]


def north():
    ret = [0]
    global dice
    ret.append(dice[2])
    ret.append(dice[6])
    ret.append(dice[3])
    ret.append(dice[4])
    ret.append(dice[1])
    ret.append(dice[5])

    dice = ret.copy()


def east():
    ret = [0]
    global dice
    ret.append(dice[4])
    ret.append(dice[2])
    ret.append(dice[1])
    ret.append(dice[6])
    ret.append(dice[5])
    ret.append(dice[3])

    dice = ret.copy()


def west():
    ret = [0]
    global dice
    ret.append(dice[3])
    ret.append(dice[2])
    ret.append(dice[6])
    ret.append(dice[1])
    ret.append(dice[5])
    ret.append(dice[4])

    dice = ret.copy()


def south():
    ret = [0]
    global dice
    ret.append(dice[5])
    ret.append(dice[1])
    ret.append(dice[3])
    ret.append(dice[4])
    ret.append(dice[6])
    ret.append(dice[2])

    dice = ret.copy()


def right():
    ret = [0]
    global dice
    ret.append(dice[1])
    ret.append(dice[3])
    ret.append(dice[5])
    ret.append(dice[2])
    ret.append(dice[4])
    ret.append(dice[6])

    dice = ret.copy()

def left():
    ret = [0]
    global dice
    ret.append(dice[1])
    ret.append(dice[4])
    ret.append(dice[2])
    ret.append(dice[5])
    ret.append(dice[3])
    ret.append(dice[6])

    dice = ret.copy()

total_score = 1

while True:
    n = int(input())
    if n == 0:
        break

    for i in range(n):
        input_str = input()

        if input_str == 'North':
            north()
        elif input_str == 'East':
            east()
        elif input_str == 'West':
            west()
        elif input_str == 'South':
            south()
        elif input_str == 'Right':
            right()
        else:
            left()
        total_score += dice[1]

    print(total_score)
    total_score = 1
    dice = [i for i in range(0, 7)]



Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
	cin >> s >> t;
	for(int i = 0; i < s.size(); i++){
		if(s[i] != t[i]){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int S = scan.nextInt();
		int h, m, s;
		h = S / 3600;
		m = (S - h * 3600) / 60;
		s = S - (h * 3600 + m * 60);
		System.out.println(h + ":" + m + ":" + s);

	}

}

Measured memory_bytes: 26284
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  int h,w;
  cin>>h>>w;
  int a[h][w],b[h][w],c[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a[i][j];
      if(a[i][j]%2==1) b[i][j]=c[i][j]=1;
      else b[i][j]=c[i][j]=0;
    }
  }
  int count=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(j!=w-1){
        if(b[i][j]==1){
          count++;
          b[i][j+1]++;
          b[i][j+1]%=2;
        }
      }
      else{
        if(i!=h-1){
          if(b[i][j]==1){
            count++;
            b[i+1][j]++;
            b[i+1][j]%=2;
          }
        }
      }
    }
  }
  
  cout<<count<<endl;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      
      if(j!=w-1){
        if(c[i][j]==1){
          cout<<i+1<<" "<<j+1<<" "<<i+1<<" "<<j+2<<endl;
          c[i][j+1]++;
          c[i][j+1]%=2;
        }
      }
      
      else{
        if(i!=h-1){
          if(c[i][j]==1){
            cout<<i+1<<" "<<j+1<<" "<<i+2<<" "<<j+1<<endl;
            c[i+1][j]++;
            c[i+1][j]%=2;
          }
        }
      }
      
    }
  }
      
}

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

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



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

using ll = long long;
using ld = long double;

int main()
{
    int n, y;
    cin >> n >> y;
    int a=-1,b=-1,c=-1;

    
    for(int i = 0; i <= n; i++)
    {
        
        for(int j = 0; j <= n - i; j++)
        {
            int k = n-i-j;
            if(i*10000+j*5000+k*1000 == y)
            {
                a=i;
                b=j;
                c=k;
                break;
            }
        }
        if(a>=0)
        {
            break;
        }
    }
    cout << a << " " << b << " " << c << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){

    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H){
        printf("Yes\n");
        }
    else{
        printf("No\n");
    }

    return 0;

}

Measured memory_bytes: 584
#include <cstdio>
#include <cstdlib>

int main(){
    int a,b,c,d;
    bool ans = false;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d))ans=true;
    if(ans)printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
   int i, x;
   for(i = 1; i <= 10001; i++)
   {
       
       cin >> x;
       if(x != 0){
       cout << "Case " << i << ": " << x << endl;
       }
       else
       {
           break;
       }
           
       }
   
   
   
   
   return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

map<ll, ll> memo;
ll n, a, b, c, d;

ll dfs(ll myn) {
    if (memo.find(myn) != memo.end()) return memo[myn];
    if (myn == 0) return 0;
    if (myn == 1) return d;

    ll u2 = (myn + 1) / 2, d2 = myn / 2;
    ll u3 = (myn + 2) / 3, d3 = myn / 3;
    ll u5 = (myn + 4) / 5, d5 = myn / 5;

    ll ret = HIGHINF + 7;
    chmin(ret, (u2 * 2LL - myn) * d + a + dfs(u2));
    chmin(ret, (myn - d2 * 2LL) * d + a + dfs(d2));
    chmin(ret, (u3 * 3LL - myn) * d + b + dfs(u3));
    chmin(ret, (myn - d3 * 3LL) * d + b + dfs(d3));
    chmin(ret, (u5 * 5LL - myn) * d + c + dfs(u5));
    chmin(ret, (myn - d5 * 5LL) * d + c + dfs(d5));
    if (myn < ret / d) chmin(ret, myn * d);
    return memo[myn] = ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t; cin >> t;
    while (t-->0) {
        cin >> n >> a >> b >> c >> d;
        memo.clear();
        cout << dfs(n) << '\n';
    }
    return 0;
}


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


int main(){
	string S;
	cin >> S;
	vector<int> alphabet(26);
	int N = S.size();
	rep(i,N){
		alphabet[S[i] - 'a']++;
	}
	rep(i,26){
		if(alphabet[i] >= 2){
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
	return 0;
			

}












Measured memory_bytes: 3628
import math
def dice_and_coin(n,k):
    ans = 0.0
    for i in range(1,n+1):
        if i >= k:
            ans += 1/float(n)
        else:
            flip = math.log(k,2) - math.log(i,2)
            ans += 1/float(n) * (0.5 ** math.ceil(flip))
#        print("%f = 1/%d * (1/2 ** %d)"%(ans, n,math.ceil(flip)))
    print("{0:.10f}".format(ans))

if __name__ == '__main__':
    n,k = map(int,raw_input().split())

    dice_and_coin(n,k)

Measured memory_bytes: 5764
#include <iostream>
	#include <string>
	#include <stdio.h>
	#include <queue>
	#include <stack>
	#include <string.h>
	#include <algorithm>
	#include <math.h>
	//#include <bits/stdc++.h>
	#define ll long long
	#define wtcl return
	using namespace std;
	
	inline int read()
	{
	    ll s = 0, f = 1;
	    char ch = getchar();
	    for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = - 1;
	    for(; ch >= '0' && ch <= '9'; ch = getchar()) s = ((s << 3ll) + (s << 1ll) + (ch ^ 48ll));
	    return s * f ;
	}
	
	int main()
	{
	    ll a,b;
	    while(cin>>a>>b)
	    {
	    	ll x = (a-2)*(b-2);
	    	if(x<0)
	    	x = -x;
	    	cout<<x<<endl;
		}
	    wtcl 0;
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    int n;
    cin >> n;
    pair<ll, ll> p[n], pp[n];
    rep(i, n){
        ll l, r;
        cin >> l >> r;
        p[i].first = l;
        p[i].second = r;
    }

    rep(i, n){
        pp[i] = p[i];
    }

    sort(p, p+n);

    ll ul[n], ur[n], dl[n], dr[n];
    
    ul[0] = p[0].first;
    ur[0] = p[0].second;

    rep(i, n-1){
        ul[i+1] = max(ul[i], p[i+1].first);
        ur[i+1] = min(ur[i], p[i+1].second);
    }

    // rep(i, n-1){
    //     printf("%d %d \n",ul[i], ur[i]);
    // }

    dl[0] = p[n-1].first;
    dr[0] = p[n-1].second;
    rep(i, n-1){
        dl[i+1] = max(dl[i], p[n-i-2].first);
        dr[i+1] = min(dr[i], p[n-i-2].second);
    }

    // rep(i, n-1){
    //     printf("%d %d \n",dl[i], dr[i]);
    // }


    ll ans = 0;
    rep(i, n-1){
        chmax(ans, (ur[i]-ul[i]+1)+(dr[n-i-2]-dl[n-i-2]+1));
        // printf("%d %d \n",(ur[i]-ul[i]+1), (dr[n-i-2]-dl[n-i-2]+1));
    }

    rep(i, n){
        chmax(ans, (p[i].second-p[i].first+1) + max(0LL, (min(ur[i-1], dr[n-i-2])-max(ul[i-1], dl[n-i-2])+1)));
        // printf("%d %d \n",(ur[i]-ul[i]+1), (dr[n-i-2]-dl[n-i-2]+1));
    }


    rep(i, n){
        swap(p[i].first, p[i].second);
    }
    sort(p, p+n);
    rep(i, n){
        swap(p[i].first, p[i].second);
    }

    ul[0] = p[0].first;
    ur[0] = p[0].second;

    rep(i, n-1){
        ul[i+1] = max(ul[i], p[i+1].first);
        ur[i+1] = min(ur[i], p[i+1].second);
    }

    // rep(i, n-1){
    //     printf("%d %d \n",ul[i], ur[i]);
    // }

    dl[0] = p[n-1].first;
    dr[0] = p[n-1].second;
    rep(i, n-1){
        dl[i+1] = max(dl[i], p[n-i-2].first);
        dr[i+1] = min(dr[i], p[n-i-2].second);
    }

    rep(i, n-1){
        chmax(ans, (ur[i]-ul[i]+1)+(dr[n-i-2]-dl[n-i-2]+1));
        // printf("%d %d \n",(ur[i]-ul[i]+1), (dr[n-i-2]-dl[n-i-2]+1));
    }

    rep(i, n){
        chmax(ans, (p[i].second-p[i].first+1) + max(0LL, (min(ur[i-1], dr[n-i-2])-max(ul[i-1], dl[n-i-2])+1)));
        // printf("%d %d \n",(ur[i]-ul[i]+1), (dr[n-i-2]-dl[n-i-2]+1));
    }

    cout << ans << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 6528
#include<iostream>
#include<functional>
#include<algorithm>
static const int N=3;
using namespace std;

int main(){
	int a[3],sum=0,b,c,d,maxv=0;
  	for(int i=0;i<N;++i){
      cin>>a[i];
    }b=abs(a[2]-a[1]);c=abs(a[2]-a[0]);d=abs(a[1]-a[0]);
	maxv=max(b,c);maxv=max(maxv,d);
	cout<<b+c+d-maxv<<endl;
  	return 0;
}

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

int a[12][12];

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int> (m));
    rep(i,n) {
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }

    int lim = 1;
    rep(i,n) lim *= 2;
    int ans = 1001001001;

    for (int i = 1; i < lim; ++i) {
        int money = 0;
        vector<int> tot(m);
        rep(j,n) {
            if ((i>>j)&1) {
                money += c[j];
                rep(k,m) tot[k] += a[j][k];
            }
        }
        bool flag = true;
        rep(k,m) if (tot[k] < x) flag = false;
        if (flag) ans = min(ans, money);
    }
    if (ans == 1001001001) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
import copy

def main():
    H,W = map(int, input().split())
    c = [[int(i) for i in input().split()] for i in range(10)]
    a = [[int(i) for i in input().split()] for i in range(H)]
    d = copy.deepcopy(c)

    # ワーシャルフロイド法
    for k in range(10):
        for i in range(10):
            for j in range(10):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    
    ans = 0
    for i in a:
        for j in i:
            if j > 1 or j == 0:
                ans += d[j][1]
    
    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
  long long int n,a,b,c,d,x,y,kotae=1;
  cin>>n>>a>>b;
  x=max(a,b);
  y=min(a,b);
  c=2;
  d=1;
  if((x-y)%c==0){
    cout<<(x-y)/c;
  }else{
    kotae+=min(n-x,y-d);
    kotae+=(x-y-d)/c;
    cout<<kotae;
  }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define Reverse(x) reverse(all(x));
#define Sort(x) sort(all(x));
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli x, y;
    cin >> x >> y;
    out(x + y / 2);
}

Measured memory_bytes: 3576
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


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


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


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


def mt(f):
    import time

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

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

    return wrap


@mt
def slv(S):
    dp = [0] * 4
    MOD = 10**9 + 7
    dp[0] = 1
    for c in S:
        if c == '?':
            for i in range(3, 0, -1):
                dp[i] = dp[i]*3 + dp[i-1]
                dp[i] %= MOD
            dp[0] = dp[0]*3
            dp[0] %= MOD
        elif c == 'A':
            dp[1] += dp[0] % MOD
        elif c == 'B':
            dp[2] += dp[1] % MOD
        elif c == 'C':
            dp[3] += dp[2] % MOD
    return dp[3] % MOD


def main():
    S = read_str().strip()
    print(slv(S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 61164
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<int, int>;
using Pc = pair<double, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

//////////////////////////////////

vector<vector<int>> bingo(3, vector<int>(3));
vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;

	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i - 1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

int main() {

	ll N, K;
	cin >> N >> K;

	ll min = -1;
	while (true) {
		if(K < N)N %= K;
		else N = abs(N - K);
		if (min == N)break;
		if (min == -1 || N < min)min = N;
	}
	cout << N << endl;
}



Measured memory_bytes: 2560
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
class Wunion_find{
  int n;
  vector<int> par,rk,size,diff_w;
  public:
  Wunion_find(int max_n){
    n = max_n+1;
    for(int i=0;i<=n;i++){
      par.emplace_back(i);
      rk.emplace_back(0);
      size.emplace_back(1);
      diff_w.emplace_back(0);
    }
  }
  int root(int x){
    if(par[x]==x){
      return x;
    }
    int r = root(par[x]);
    diff_w[x] += diff_w[par[x]];
    return par[x] = r;
  }
  void unite(int x,int y,int w){
    w += weight(x);
    w -= weight(y);
    x = root(x);
    y = root(y);
    if(x==y) return;
    if(rk[x]<rk[y]){
      par[x] = y;
      size[y] += size[x];
      diff_w[x] = -w;
    }else{
      par[y] = x;
      if(rk[x]==rk[y]) rk[x]++;
      size[x] += size[y];
      diff_w[y] = w;
    }
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
  int weight(int x){
    root(x);
    return diff_w[x];
  }
  int diff(int x,int y){
    return weight(y)-weight(x);
  }
  int treesize(int x){
    return size[root(x)];
  }
};
signed main(){
  init_io();
  ll n,q,x,y,z,p;
  cin >> n>>q;
  Wunion_find wuf(n);
  for(int i=0;i<q;i++){
    cin >> p;
    if(p==0){
      cin >> x >> y >> z;
      wuf.unite(x,y,z);
    }else{
      cin >> x>> y;
      if(wuf.same(x,y)){
        cout << wuf.diff(x,y)<<endl;
      }else{
        cout <<"?\n";
      }
    }
  }
}



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

public class Main {
	static int[][] memo;
	static String s, t;
	static HashMap<String, String> hs = new HashMap<String, String>();
	static void trace(int i, int j){
		if(i > s.length() || j > t.length())
			return ;
		if(dp(i,j)==1+dp(i+1,j+1) &&s.charAt(i)==t.charAt(j))
		{
			System.out.print(s.charAt(i));
			trace(i+1,j+1);
		}
		else if(dp(i,j) == dp(i+1,j))
			trace(i+1,j);
		else if(dp(i,j) == dp(i,j+1))
			trace(i,j+1);
	}

	static int dp(int i, int j) {
		if (i >= s.length() || j >= t.length()) {
			return 0;
		}
		if ( memo[i][j] != -1)
			return memo[i][j];

		if (s.charAt(i) == t.charAt(j))
			return memo[i][j] = 1 + dp(i + 1, j + 1);

		int iPlus = 0, jPlus = 0;
		iPlus = dp(i + 1, j);
		jPlus = dp(i, j + 1);
		int ret = Math.max(iPlus, jPlus);
		return memo[i][j] = ret;

	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		s = sc.next();
		t = sc.next();
		memo = new int[s.length() + 5][t.length() + 5];
		for (int[] a : memo)
			Arrays.fill(a, -1);
		trace(0,0);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}


Measured memory_bytes: 81248
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define fi first
#define se second
#define int long long
#define pii pair<int,int>
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans; 
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int ans=a*c;
	ans=max(ans,b*c);
	ans=max(ans,b*d);
	ans=max(ans,a*d);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();
    ll h,w,a,b;
    cin>>h>>w>>a>>b;
    ll ans=0;
    for(ll i=1;i<=w-b;i++){
    	ll now=COM(b+i+h-a-2,h-a-1)*COM(a+w-b-1-i,a-1);
    	ans+=now;
    	ans%=inf;
    }
    cout <<ans;
}

Measured memory_bytes: 12160
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    c = input()
    an = ["a","i","u","e","o"]
    
    if c in an:
        print("vowel")
    else:
        print("consonant")
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 38640
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if (N == 1) {
        cout << 1 << endl << 0 << endl;
    }
    else if (N == 2) {
        cout << 2 << endl << 0 << endl << 11 << endl;
    }
    else {
        cout << N - 1 << endl;
        rep(i, 0, N - 1) {
            cout << 0;
            rep(j, 0, i) {
                cout << 1;
            }
            cout << 0 << endl;
        }
    }
    return 0;
}


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

int main(int argc, char *argv[]){
	int count;
	int nums[100];
	cin >> count;
	for(int i = 0; i < count; i++){
		cin >> nums[i];
	}
	if (count > 0){
		cout << nums[count - 1];
	}

	for(int i = count - 1; i > 0; i--){
		cout << " " << nums[i - 1];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
long long int mod = 1e9+7;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
//////////////////////////////////

int main(){
    long long s; cin >> s;
    long long x[3];
    long long y[3];
    long long z = 1e9;
    x[0] = 0;
    y[0] = 0;
    x[1] = z;
    y[1] = 1;
    x[2] = (z-s%z) % z;
    y[2] = (s+x[2]) / z;
    printf("%ld %ld %ld %ld %ld %ld\n", x[0], y[0], x[1], y[1], x[2], y[2]);
    return 0;
}

// EOF



Measured memory_bytes: 256
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;             \
                                   c > 0 ? i < b : i > b; \
                                   i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << endl
#else
const bool test = false;
#define dump(x) 
#endif

#else
const bool test = false;
#define dump(x) 
#endif

int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep))
	{
		v.push_back(buffer);
	}
	return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
	return accumulate(begin, end, 0ll);
}

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

class Solver {
public:
	int A, B, C;

	void solve() {
		cin >> A >> B >> C;
		int ans = [&]() {
			if (A == B) return C;
			if (B == C) return A;
			if (C == A) return B;
		}();
		cout << ans << endl;
	}
};

signed main()
{
	srand(time(NULL));
	cout << fixed << setprecision(20);
	auto ptr = new Solver();
	ptr->solve();
	delete ptr;
	//while (true) {
	//	if (cin.eof() == true) break;
	//	auto ptr = new Solver();
	//	ptr->solve();
	//	delete ptr;
	//}
	return 0;
}

// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;

// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;

// #define cin mycin
// #define cout mycout
// #define endl '\n'

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

int main() {
    vector<char> v = {'a', 'e', 'i', 'o', 'u'};
    char c;
    cin>>c;
    bool ok = false;
    rep(i,5) if(v[i] == c) ok = true;
    cout<<(ok ? "vowel" : "consonant")<<endl;
}

Measured memory_bytes: 256
# 2019-11-12 22:21:08(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    b = sys.stdin.readline().rstrip()
    if b == 'A':
        ans = 'T'
    elif b == 'T':
        ans = 'A'
    elif b == 'G':
        ans = 'C'
    else:
        ans = 'G'
    
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

void ABC139C()
{
	int N;
	cin >> N;
	vector<ll> H(N);
	for (auto& x : H)
		cin >> x;

	int maxCt = 0;
	int ct = 0;
	for (int i = 0; i < N-1; ++i)
	{
		if (H[i] >= H[i + 1])
			++ct;
		else
		{
			maxCt = max(maxCt,ct);
			ct = 0;
		}
	}
	maxCt = max(maxCt, ct);
	cout << maxCt << endl;
}
int main()
{
	ABC139C();
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)

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

	vector<tuple<string, int, int>> restaurants(N);
	rep(i, N){
		string name;
		int points;
		cin >> name >> points;
		restaurants.at(i) = make_tuple(name, 100 - points, i + 1);
	}
	sort(restaurants.begin(), restaurants.end());

	rep(i, N) cout << get<2>(restaurants.at(i)) << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int x;
  cin>>x;
  
  cout<<x*x*x<<endl;
  
  
  return 0;
}


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

int main(){
  string S,T;
  int cnt = 0;
  bool b = 0;
  cin >> S >> T;
  for(int i=0;i<S.size();++i){
    string C = "";
    for(int j=i;j<T.size();++j){
      C.push_back(T.at(j));
    }
    T.push_back(T.at(i));
    if(S==C){
      b = 1; break;
    }
  }
  if(b){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<int> v;
	for(int i = 0; i < n; ++i)
		if(s[i] == 'W')
			v.push_back(i);
	int ptr = 0, answer = 0;
	for(int i = n - 1; ~i; --i) {
		if(ptr == (int)v.size() || v[ptr] > i)
			break;
		if(s[i] == 'R') {
			++answer;
			swap(s[i], s[v[ptr++]]);
		}
	}
	cout << answer;
}


Measured memory_bytes: 4444
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int l[200005],r[200005],x[505][505],c[505][505];
int main(){
    int n,m,q; cin >> n >> m >> q;
    for(int i = 1; i <= m; i++){
        cin >> l[i] >> r[i];
        x[l[i]][r[i]]++;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            c[i][j] = c[i][j-1] + x[i][j];
        }
    }
    for(int i = 1; i <= q; i++){
        int s,t; cin >> s >> t;
        int ans = 0;
        for(int j = s; j <= t; j++) ans += c[j][t] - c[j][s-1];
        cout << ans << endl;
    }
}


Measured memory_bytes: 4480
alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
ma = 26

n = int(input())
s = input()

res = ''

for a in s:
    index = alpha.index(a) + n
    # print(alpha[index + n])
    if index >= ma:
        index = index % ma
    
    res  += alpha[index]

print(res)


Measured memory_bytes: 3064
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, r;
	cin >> n >> r;
	int ans = 0;
	if(n >= 10) ans = r;
	else ans = r + (100 * (10 - n));
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque

N, Q = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    G[a].append(b)
    G[b].append(a)
point = [0]*N
for _ in range(Q):
    p, x = map(int, input().split())
    point[p-1] += x
q = deque([[0, -1, point[0]]])
done = [-1]*N
while q:
    cur, fr, p = q.popleft()
    done[cur] = p
    for nex in G[cur]:
        if nex == fr: continue
        q.append([nex, cur, p+point[nex]])
ans = []
for i in range(N):
    ans.append(done[i])
print(*ans)


Measured memory_bytes: 147476
using System;

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var N = long.Parse(Console.ReadLine());

            var result = 0L;
            for (int i = 1; i <= N; i++)
            {
                if (i % 3 > 0 && i % 5 > 0)
                {
                    result += i;
                }
            }
            Console.WriteLine(result);
        }
    }
}


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

using namespace std;

#define ll long long
#define pii pair<int,int>

int main()
{
        int n;
        cin>>n;
        int nax =0,temp=0;
        int x,y;
        for(int i=0;i<n;i++)
        {
            cin>>x>>y;
            if(x == y)
            {
                temp++;
                nax = max(nax,temp);
            }
            else
            {
                temp =0;
            }
        }
        if(nax >= 3)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
}

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

int a[205];

int main(){
	int n, ans;
	scanf("%d",&n);
	for (int i = 1; i <= n * 2; i++) scanf("%d",&a[i]);
	sort(a + 1, a + n * 2 + 1);
	ans = 0;
	for (int i = 1; i <= n * 2; i += 2) ans += a[i];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    let s1: String;
    let s2: String;
    input! {
        s1: String,
        s2: String,
    }

    let s2_prepare = &s2[0..s1.len()];

    if &s1 == s2_prepare {
        println!("Yes")
    } else {
        println!("No")
    }
}


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

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = 0; i < k; i++){
        if (a + i <= b)
            cout << a + i << endl;
    }
    for (int i = 0; i < k; i++){
        if (a + k <= b - k + i + 1)
            cout << b - k + i + 1 << endl;
    }
    return 0;   
}

Measured memory_bytes: 256