akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll 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(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  ll ans=0;
  ll cnt=0;
  for(int i=1;i<len(s);i++){
    if(s[i]=='E') cnt++;
  }
  ans=cnt;
  for(int i=1;i<len(s);i++){
    if(s[i]=='E') cnt--;
    if(s[i-1]=='W') cnt++;
    mins(ans,cnt);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3928
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#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;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int brute(vi v){
  while(v.size()>=2){
    vi cur;
    for(int i=0;i<v.size()-1;i++){
      cur.pb(abs(v[i]-v[i+1]));
    }
    v = cur;
  }
  return v[0];
}

vi reduce(vi v, int len){
  vi res;
  for(int i=0;i<v.size();i++){
    if(i+len>=v.size())break;
    res.pb(abs(v[i]-v[i+len]));
  }
  return res;
}

int n;
string s;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  cin >> n >> s;
  vi v;
  for(int i=0;i<n;i++){
    v.pb(s[i]%48);
  }
  // cout << brute(v) << endl;
  int cnt = __builtin_popcount(n);
  int cur = n-1;
  // if(cnt==1){
  //   cur--;
  // }
  if(cur%2==0)cur--;
  for(int i=24;i>=0;i--){
    // cout << v << endl;
    // cout << cur << endl;
    if(v.size()==1)break;
    // if(cur&(1<<i) && __builtin_popcount(cur)==1 ){
    //   if(cur!=1)cur--;
    // }
    if(cur<=5000){
      cout << brute(v) << endl;
      return 0;
    }
    if(cur&(1<<i)){
      cur-=(1<<i);
      v = reduce(v,(1<<i));
    }
  }
  cout << v[0] << endl;


return 0;
}
///....


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

using namespace std;

typedef long long int ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    int n, a, b;
    
    cin >> n >> a >> b;
    
    cout << min(n * a, b) << endl;
	
	return 0;
}




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

const int mxn=200005;
int dx[mxn],dy[mxn];
struct UnionFind{
    int data[mxn]; 
    void init(int n){memset(data,-1,sizeof(data));}
    int find(int x){return data[x]<0?x:data[x]=find(data[x]);}
    void unite(int x, int y){
        x=find(x);y=find(y);       
        if(x!=y){
            if(data[y]<data[x]) swap(x,y);
            data[x]+=data[y];data[y]=x;
            dx[x]+=dx[y],dy[x]+=dy[y];
        }
        return;
    } 
    bool same(int x, int y){return (find(x) == find(y));}
    int size(int x){return -data[find(x)];}
};
int n;
int main(){
    cin>>n;
    UnionFind uf;
    uf.init(n);
    int xi,yi;
    rep(i,100000) dx[i]=1,dy[i+100000]=1;
    rep(i,n){
        cin>>xi>>yi;
        --xi,--yi;
        uf.unite(xi,yi+100000);
    }
    ll ans=0;
    rep(i,mxn)if(uf.find(i)==i){
        ans+=(ll)dx[i]*dy[i];
    }
    cout<<ans-n<<endl;
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef long long LL;
const int INF = 999999999;

struct UnionFind{
    vector<int> data;

    UnionFind(int sz){
        data.assign(sz, -1);
    }

    bool unite(int x, int y){
        x = find(x), y = find(y);
        if(x == y) return(false);
        if(data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return(true);
    }

    int find(int k){
        if(data[k] < 0) return(k);
        return(data[k] = find(data[k]));
    }

    int size(int k){
        return(-data[find(k)]);
    }
};

struct edge{
    int src, to, cost;
};
using Edges = vector<edge>;

int kruskal(Edges &E, int V)
{
    sort(all(E), [](const edge &a, const edge &b)
    {
        return (a.cost < b.cost);
    });
    UnionFind tree(V);
    int res = 0;
    for(auto &e : E) {
        if(tree.unite(e.src, e.to)) res += e.cost;
    }
    return (res);
}

int main(){
    int n, m;
    cin >> n >> m;
    Edges E;
    rep(i, m){
        int s, t, w;
        cin >> s >> t >> w;
        E.emplace_back((edge){s, t, w});
    }
    cout << kruskal(E, n) << endl;
}



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

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << endl;
    return 0;
}


Measured memory_bytes: 3620
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let mut xy: Vec<(i64, i64)> = (0..n).map(|_| (input(), input())).collect();
    xy.sort();

    let mut m = std::collections::HashMap::new();
    let mut mx = 0;
    for i in 0..n - 1 {
        for j in i + 1..n {
            let (xi, yi) = xy[i];
            let (xj, yj) = xy[j];
            let (p, q) = (xj - xi, yj - yi);
            let e = m.entry((p, q)).or_insert(0);
            *e += 1;

            mx = std::cmp::max(mx, *e);
        }
    }

    println!("{}", n - mx);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout<<fixed<<setprecision(20);
    double r,pi=3.141592653589793238;
    cin>>r;
    cout<<2*pi*r;
    return 0;
}

Measured memory_bytes: 3760
M=10**9+7
dp={"TTTT"=>1}
gets.to_i.times do
  nex=Hash.new{|h,k|h[k]=0}
  dp.each do |k,v|
    "AGCT".chars.each do |c|
      s=(k+c)[1..-1]
      next if s.match(/AGC|GAC|ACG|A.GC|AG.C/)
      nex[s]+=v
      nex[s]%=M
    end
  end
  dp=nex
end
p dp.values.inject(:+)%M

Measured memory_bytes: 2300
import sys
S=input()
for i in range(len(S)):
  if S[i] == 'U':
    pass
  elif S[i] == 'D':
    pass
  elif S[i] == 'R':
    if i % 2 == 1:
      print('No')
      sys.exit()
  elif S[i] == 'L':
    if i % 2 == 0:
      print('No')
      sys.exit()
print('Yes')

Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
#include<cstring>
#define MN 100005
using namespace std;
int n,a[MN],px[MN];long long ans[MN];
bool cmp(int x,int y){return a[x]==a[y]?x<y:a[x]>a[y];}
int main(){	
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),px[i]=i;sort(px+1,px+n+1,cmp);int now=px[1],sum=0;
	for(int i=1,j=1;i<=n;i=j){
		for(;j<=n;j++)if(a[px[j+1]]!=a[now])break;now=min(now,px[i]),sum+=j-i+1;
		ans[now]+=1ll*(a[px[i]]-a[px[j+1]])*sum;j++;
	}
	for(int i=1;i<=n;i++)printf("%lld\n",ans[i]);
}



Measured memory_bytes: 2560
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
# import statistics
import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


n, m = MI()
a = sorted(LI())
bc = sorted([LI() for _ in range(m)], key=lambda x:x[1] , reverse=True)
index = 0

for b, c in bc:
    for _ in range(b):
        if a[index] < c:
            a[index] = c
            index += 1
        else:
            print(sum(a))
            exit()

        if index == n:
            print(sum(a))
            exit()
print(sum(a))


Measured memory_bytes: 101652
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int mod = 1E9 + 7;
const int inf = 1 << 29;

int main() {
  float x, y;
  cin >> x >> y;
  float b = 2 * x - y / 2;
  float t = -x + y / 2;
  if (b < 0 | b != int(b)) {
    cout << "No" << endl;
    return 0;
  }
  if (t < 0 | t != int(t)) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}

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

using namespace std;


int main() {
    int n;
    cin >> n;
    vector<int> v = {0, 0, 0, 0};
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if(s == "AC") {
            v[0]++;
        }
        else if(s == "WA") {
            v[1]++;
        }
        else if(s == "TLE") {
            v[2]++;
        }
        else {
            v[3]++;
        }
    }
    cout << "AC x " << v[0] << "\n" << "WA x " << v[1] << "\n" << "TLE x " << v[2] << "\n" << "RE x " << v[3] << "\n";
    return 0;
}

Measured memory_bytes: 3640
import math
def int_ceil(src, range):
    return int(math.ceil(src/float(range)) * range)

def main():
    week = int(input())
    debt = 100000
    for _ in range(week):
        risi = debt * 0.05
        debt = int_ceil(debt + risi, 1000)
    print(debt)

if __name__ == "__main__":
    main()


Measured memory_bytes: 4732
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
AGC025 B
"""

import itertools
from functools import reduce

cut = 998244353


n, a, b, k = map(int, input().split())


def modInverse(a, b, divmod=divmod):
    r0, r1, s0, s1 = a, b, 1, 0
    while r1 != 0:
        q, rtmp = divmod(r0, r1)
        s0, s1 = s1, s0-q*s1
        r0, r1 = r1, rtmp
    return s0 % b


# def modInverse2(a, b, divmod=divmod):
#     b2 = b-2
#     tmp0 = a
#     tmp1 = 1
#     while b2 != 0:
#         if b2 & 0b1:
#             tmp1 = tmp1*tmp0
#         tmp0 = tmp0*tmp0 % b
#         b2 = b2 >> 1
#     return(tmp1 % b)


def GCD(a, b):
    r0, r1 = a, b
    while r1 != 0:
        r0, r1 = r1, r0 % r1
    return r0


binom = [1, n]
tmp = n
for i in range(1, n):
    tmp = (tmp*(n-i) % cut)*modInverse(i+1, cut) % cut
    binom.append(tmp)


a, b = max(a, b), min(a, b)
gcdab = GCD(a, b)
ahat, bhat = a//gcdab, b//gcdab
flag = False
for i in range(0, bhat+1):
    if (k-i*a) % b == 0:
        iinit = i
        flag = True
        break


if not flag:
    print(0)
    exit()

ans = 0
for i in range(iinit, min(n+1, k//a+1), bhat):
    ib, bmod = divmod(k-i*a, b)
    if bmod == 0 and ib <= n:
        ans = (ans+binom[i]*binom[ib]) % cut

print(ans)


Measured memory_bytes: 61020
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int w,h,n;
  cin >> w >> h >> n;
  vector<int>x(n),y(n),a(n);
  for(int i=0; i<n; i++){
    cin >> x[i] >> y[i] >> a[i];
  }
  
  int lx=0,rx=w,dy=0,uy=h;
  for(int i=0; i<n; i++){
    if(a[i]==1 && x[i]>lx)lx=x[i];
    if(a[i]==2 && x[i]<rx)rx=x[i];
    if(a[i]==3 && y[i]>dy)dy=y[i];  
    if(a[i]==4 && y[i]<uy)uy=y[i];
  }
  
  int ans = (rx-lx)*(uy-dy);
  if(lx>rx || dy>uy) cout << 0 << endl;
  else cout << ans << endl;
  
  return 0;
  
  
}

Measured memory_bytes: 256
N = int(input())
list = [int(input()) for i in range(N)]
if sorted(list)[-1] == sorted(list)[-2]:
    list2 = [max(list)]*N
    print("\n".join(map(str,list2)))
else:
    list2 = [max(list)]*list.index(max(list))
    list2.append(sorted(list)[-2])
    list3 = [max(list)]*(N-list.index(max(list))-1)
    list2.extend(list3)
    print("\n".join(map(str,list2)))

Measured memory_bytes: 28340
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 200002;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()



int32_t main()
{ 
   IOS
  

  int n;
  cin >> n;
  vector<pair<int,int>> ed;
  for(int i = 1;i<=n-1;i++){
    int u,v;
    cin >> u >> v;
    ed.push_back({u,v});
  }
  int ans =0;
  for(int i = 1;i<=n;i++){
    ans += i*(n-i+1);
  }
  for(int i = 1;i<n;i++){
    int u,v;
    tie(u,v) = ed[i-1];
    if(u>v)
      swap(u,v);
    int p = (u)*(n-v+1);
    ans -=  p;
  }
  cout<<ans<<endl;

  

  


  

  



  
  

 
}

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

int w, h;
char gr[N][N], a1[N][N], a2[N][N];
int main() {
	scanf("%d %d", &h, &w);
	fo(i,0,h) scanf("%s", gr[i]);
	fo(i,0,h) fo(j,0,w) a1[i][j] = a2[i][j] = '.';
	fo(i,0,h) a1[i][0] = a2[i][w-1] = '#';
	fo(i,0,h) fo(j,1,w-1) {
		if (i%2) a1[i][j] = '#';
		else a2[i][j] = '#';
	}
	fo(i,0,h) fo(j,0,w) if (gr[i][j] == '#') a1[i][j] = a2[i][j] = '#';
	fo(i,0,h) puts(a1[i]);
	puts("");
	fo(i,0,h) puts(a2[i]);

	return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main() {
  char a[201],b[101],c[101];
  scanf("%s %s", a, c);
  strcpy(b,a);
  strcat(a,b);
  if(strstr(a,c) == NULL) cout << "No\n";
  else cout << "Yes\n";
  return 0;
}



Measured memory_bytes: 3152
import heapq
N, M = map(int, input().split())
L = list(map(int, input().split()))
q = []

for money in L:
    tmp = money*(-1)
    heapq.heappush(q, tmp)

for i in range(M):
    kakaku = heapq.heappop(q)*(-1)
    kakaku = int(kakaku/2)
    kakaku = kakaku*(-1)
    heapq.heappush(q, kakaku)

ans=0
while len(q)>0:
    ans += heapq.heappop(q)*(-1)

print(ans)

Measured memory_bytes: 14180
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class M>
struct SegmentTree{
    using T = typename M::T;
    int sz;
    vector<T> seg;
    explicit SegmentTree(int n) {
        sz = 1;
        while(sz < n) sz <<= 1;
        seg.assign(2*sz, M::e());
    }

    void set(int k, const T &x){ seg[k + sz] = x; }

    void build(){
        for (int i = sz-1; i > 0; --i) seg[i] = M::f(seg[2*i], seg[2*i+1]);
    }

    void update(int k, const T &x){
        k += sz;
        seg[k] = x;
        while (k >>= 1) seg[k] = M::f(seg[2*k], seg[2*k+1]);
    }

    T query(int a, int b){
        T l = M::e(), r = M::e();
        for(a += sz, b += sz; a < b; a >>=1, b>>=1){
            if(a & 1) l = M::f(l, seg[a++]);
            if(b & 1) r = M::f(seg[--b], r);
        }
        return M::f(l, r);
    }

    T operator[](const int &k) const { return seg[k + sz]; }
};


struct Monoid{
    using T = int;
    static T f(T a, T b) { return min(a, b); }
    static T e() { return INF<int>; }
};

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    for (auto &&i : v) scanf("%lld", &i);
    for (int i = 0; i < n; ++i) {
        v[i] = v[i]*n+n-i-1;
    }
    set<ll> s;
    s.emplace(-1);
    for (int i = 0; i < n; ++i) {
        auto x = --s.lower_bound(v[i]);
        if(*x == -1){
            s.emplace(v[i]);
        }else {
            s.erase(x);
            s.emplace(v[i]);
        }
    }
    cout << s.size()-1 << "\n";
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=40005;
int bit[max_n];
void update(int i,int x){
    for(;i<max_n;i+=i&-i)bit[i]+=x;
}
int query(int i){
    int res=0;
    for(;i;i-=i&-i)res+=bit[i];
    return res;
}
int n,a[max_n],b[max_n],c[max_n];
vector<double> v;
int p[max_n];
typedef pair<double,int> P;
P d[max_n];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d%d%d",&a[i],&b[i],&c[i]);
    for(int cas=0;cas<2;cas++){
        for(int i=1;i<=n;i++)if(b[i]<0)b[i]=-b[i],a[i]=-a[i],c[i]=-c[i];
        for(int i=1;i<=n;i++)p[i]=i;
        sort(p+1,p+n+1,[&](int x,int y){return a[x]*b[y]<a[y]*b[x];});
        auto check=[&](double x){
            for(int i=1;i<=n;i++)d[i].first=(c[p[i]]-x*a[p[i]])*1.0/b[p[i]],d[i].second=i;
            sort(d+1,d+n+1);
            ll res=0;
            for(int i=1;i<=n;i++)bit[i]=0;
            for(int i=1;i<=n;i++){
                res+=query(n)-query(d[i].second);
                update(d[i].second,1);
            }
            return res>=(1ll*n*(n-1)/2+1)/2;
        };
        double l=-1e9,r=1e9;
        double mid,ans;
        for(int i=0;i<64;i++){
            mid=(l+r)/2;
            if(check(mid))ans=mid,r=mid;
            else l=mid;
        }
        v.push_back(ans);
        for(int i=1;i<=n;i++)swap(a[i],b[i]);
    }
    printf("%.9f %.9f\n",v[0],v[1]);
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;

int main()
{
    int a;
    string s;
    cin>>a>>s;
    if(a>=3200){
        log(s);
    }
    else{
        cout<<"red";
    }
}


Measured memory_bytes: 256
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
#N=int(input())
#S=[list(map(int,input().split())) for i in range(N)]
idle=10**13
xs,ys,xt,yt=map(int,input().split())
N=int(input())
XYR=[list(map(int,input().split())) for i in range(N)]
XYR.append([xt,yt,0])#終点
XYR.append([xs,ys,0])#開始
"""for i in range(len(XYR)):
    XYR[i][0]*=idle
    XYR[i][1]*=idle
    XYR[i][2]*=idle"""
kyori=[[0 for i in range(len(XYR))] for n in range(len(XYR))]
for i in range(len(XYR)):
    for m in range(i,len(XYR)):
        if i==m:
            t=0
        else:
            x1,y1,r1=XYR[i]
            x2,y2,r2=XYR[m]
            t=max(((x2-x1)**2+(y2-y1)**2)**.5-r1-r2,0)

        kyori[i][m]=t
        kyori[m][i]=t
stack=sorted(kyori[-1])
heapify(stack)
Pdic={}
dic={}
kyoriset=set()
for i in range(len(XYR)):
    a=kyori[-1][i]
    Pdic.update({i:a})
    if not a in kyoriset:
        kyoriset.add(a)
        dic.update({a:[i]})
    else:
        dic[a].append(i)
visited=set([len(XYR)-1])
while stack:
    m=heappop(stack)
    a=dic[m].pop()
    if a==len(XYR)-2:
        print(m)
        exit()
    if not a in visited:
        visited.add(a)
        for i in range(len(XYR)):
            nm=kyori[a][i]+m
            if Pdic[i]>nm:
                Pdic[i]=nm
                heappush(stack,nm)
                if not nm in kyoriset:
                    kyoriset.add(nm)
                    dic.update({nm:[i]})
                else:
                    dic[nm].append(i)


Measured memory_bytes: 168312
n=int(input())
arr=list(map(int,input().split()))
if n<=3:
  print(max(arr))
  exit()
lim=n%2+2
dp=[[0]*lim for _ in range(n+1)]
for i in range(n):
  dp[i+1][0]=dp[i-1][0]+arr[i]
  dp[i+1][1]=max(dp[i-1][1]+arr[i],dp[i-2][0]+arr[i])
  if lim==3:
    dp[i+1][2]=max(dp[i-1][2]+arr[i],dp[i-2][1]+arr[i],dp[i-3][0]+arr[i])
print(max(dp[-1][:lim]))

Measured memory_bytes: 113100
import java.util.*;

public class Main {

	public static void main(String[] args) {

		// 入力
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		int p[];
		p = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			p[i] = Integer.parseInt(sc.next());
		}

		// ループしながら出力
		for (int i = k + 1; i <= n; i++) {

			int right = p[i];
			int left = p[i - k];
			System.out.println(left < right ? "Yes" : "No");
		}

	}

}

Measured memory_bytes: 60496
#include<bits/stdc++.h>
		using namespace std;
		#define ll long long
		#define endl "\n"
		void solve();
		int main()
		{
			ios_base::sync_with_stdio(false);
			cin.tie(NULL);

		/*#ifndef ONLINE_JUDGE
			freopen("input.txt","r",stdin);
			freopen("output.txt","w",stdout);
		#endif*/
		
			int t=1;
			//cin>>t;
			while(t--){
			solve();
			cout << endl;
			}

			cerr << "time taken : "	<< (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
			return 0;		
		}
		void solve(){
			int n,x=0,ans=0;
			cin>>n;
			string s;
			cin>>s;
			for (int i = 0; i < s.size(); ++i)
			{
				if(s[i]=='I'){
					x++;
				}
				if(s[i]=='D'){
					x--;
				}
				ans=max(ans,x);
			}
			cout<<ans;
		}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int D;
    cin >> D;
    vector<int>c(26);
    for(int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    vector<vector<int>>s(D,vector<int>(26));
    for(int i = 0; i < D; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int>t(D);
    for(int i = 0; i < D; i++) {
        cin >> t[i];
    }
    int ans = 0;
    vector<int>Last(26);
    for(int i = 0; i < D; i++) {
        ans+=s[i][t[i]-1];
        Last[t[i]-1] = i+1;
        for(int j = 0; j < 26; j++) {
            ans-=c[j]*(i+1-Last[j]);
        }
        cout << ans << endl;
    }
}



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

int main()
{
    int a[5];
    int i;

    rep(i, 5) cin >> a[i];
    for (i = 0; i < 5; i++)
    {
        if (a[i] == 0)
        {
            break;
        }
    }
    cout << i + 1 << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main(){
   int h, w, n, now_h, now_w, count, flag;

   cin >> h >> w;
   cin >> n;

   vector<vector<int>> v(h, vector<int>(w));

   now_h = 0;
   now_w = 0; 
   flag = 0;//右方向：0 左方向：1
   for(int i = 0; i < n; i++){
      cin >> count;
      while(count > 0){
         v[now_h][now_w] = i + 1;
         if(flag == 0 && now_w == w - 1){
            now_h++;
            flag = 1;
         }else if(flag == 1 && now_w == 0){
            now_h++;
            flag = 0;
         }else{
            if(flag == 0){//右方向に進んでいる時
               now_w++;
            }else{//左方向
               now_w--;
            }
         }
         count--;
      }
   }

   for(auto i : v){
      for(auto j : i){
         cout << j << ' ';
      }
      cout << endl;
   }
}

Measured memory_bytes: 3604
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
    int a,b,c,count=0;
    cin>>a;cin>>b;cin>>c;
    for(a;a<=b;a++){
        if(c%a==0)count++;
    }
    cout<<count;cout<<endl;

    return 0;
}


Measured memory_bytes: 3124
using System;
using System.Collections.Generic;
using System.Linq;
using static Constans;

public static class Constans
{
    public const long Mod = (long)1e9 + 7;
}

public struct ModInt
{
    public long Num;

    public ModInt(long num)
    {
        Num = num;
    }

    // x^n
    public static long Power(long x, long n)
    {
        long pow = 1;
        while (n > 0)
        {
            if (n % 2 == 0)
            {
                x *= x;
                x %= Mod;
                n /= 2;
            }
            else
            {
                pow *= x;
                pow %= Mod;
                n--;
            }
        }

        return pow;
    }

    public static ModInt GetInv(long f)
    {
        // フェルマーの小定理 a^(-1) = a^(mod-2)
        return new ModInt(Power(f, Mod - 2));
    }

    public ModInt GetInv()
    {
        return GetInv(Num);
    }

    public override string ToString()
    {
        return Num.ToString();
    }

    public static ModInt operator +(ModInt l, ModInt r)
    {
        l.Num += r.Num;
        if (l.Num >= Mod)
        {
            l.Num -= Mod;
        }
        return l;
    }

    public static ModInt operator -(ModInt l, ModInt r)
    {
        l.Num -= r.Num;
        if (l.Num < 0)
        {
            l.Num += Mod;
        }
        return l;
    }

    public static ModInt operator *(ModInt l, ModInt r)
    {
        return new ModInt(l.Num * r.Num % Mod);
    }

    public static implicit operator ModInt(long n)
    {
        n %= Mod;
        if (n < 0)
        {
            n += Mod;
        }
        return new ModInt(n);
    }
}

public class Solution
{
    public static void Main()
    {
        var L = Console.ReadLine();
        var dp1 = new ModInt(1); // 下の桁は何でも良い (0,0)
        var dp2 = new ModInt(2); // 下の桁はL以下 (0,1) (1,0)
        foreach (var c in L.Skip(1))
        {
            if (c == '1')
            {
                // dp1に0,1を付加 dp2に0を付加
                dp1 = dp1 * 3 + dp2;
                // dp2に1を付加
                dp2 = dp2 * 2;
            }
            else
            {
                // dp1に0,1を付加 
                dp1 = dp1 * 3;
                // 0を付加
                // dp2 = dp2;
            }
        }

        Console.WriteLine(dp1 + dp2);
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = (int)1e5 + 7;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    map <string, int> mp;
    cin >> n;
    vector <string> str({"AC", "WA", "TLE", "RE"});
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        mp[s]++;
    }

    for (int i = 0; i < 4; ++i) {
        cout << str[i] << " x " << mp[str[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int ans=0;
	cin >> s;
	for (int i=0; i<s.size(); i++)
	{
		if (s[i]=='+')
			ans++;
		else
			ans--;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
using namespace std;
// bitset<8>set1(p);
// __builtin_popcountll(x);
// bitset<100> b("1010");
long long power(long long a, long long b) {
    //a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
    }
  ll int binomial(ll int n, ll int k) 
{ 
    ll int C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll int i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (int j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 
  vector<int> pr;
  bool prime[10000000];
void Sieve(ll int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            pr.push_back(p);
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
}
 

int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
// Function to find gcd of array of 
// numbers 
int find(int arr[], int n) 
{ 
    int result = arr[0]; 
    for (int i = 1; i < n; i++) 
    { 
        result = gcd(arr[i], result); 
  
        if(result == 1) 
        { 
           return 1; 
        } 
    } 
    return result; 
} 


//It reurns Fn,Fn+1
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}
void reverse(string& str) 
{ 
    int n = str.length(); 
  
    // Swap character starting from two 
    // corners 
    for (int i = 0; i < n / 2; i++) 
        swap(str[i], str[n - i - 1]); 
} 

string fun(string s)
{
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='O' || s[i]=='o')
        {
            s[i]='0';
        }
        else if(s[i]=='l' || s[i]=='I' || s[i]=='L' || s[i]=='i')
        {
            s[i]='1';
        }
        else if(isupper(s[i]))
        {
            s[i]=tolower(s[i]);
        }
    }
    return s;
}
  
int main() {
    ios;
  ll int n;
  cin>>n;
  ll int a[n];
  int p=0;
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
  }
  for(int i=0;i<n;i+=2)
  {
      if(a[i]%2!=0)
      {
          p++;
      }
  }
  cout<<p<<endl;
}


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
typedef long long ll;
int main(){
  ll x,y;
  cin >> x >> y;
  ll a = 0;
  if(x > 0){
    if(y <= -x){
      a = - y - x + 1;
    }
    else if(y >= x){
      a = y - x;
    }
    else if(y > 0 && y < x){
      a = 2 - y + x;
    }
    else{
      a = 1 + y + x;
    }
  }
  else if(x < 0){
    if(y < x){
      a = 2 - y + x;
    }
    else if(y >= -x){
      a = 1 + y + x;
    }
    else if(y > 0 && y < -x){
      a = 1 - y - x;
    }
    else{
      a =y - x;
    }
  }
  else{
    if(y >= 0){
      a = y - x;
    }
    else{
      a = -y - x + 1;
    }
  }
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <string>
#include<iomanip>
#include<limits>
using namespace std;
int main(void){
   int N;
   cin>>N;
   for(int i=1;i<10;i++){
       for(int j=1;j<10;j++){
           if(i*j==N){
               cout<<"Yes"<<endl;
               return 0;
           }
       }
   }
   cout<<"No"<<endl;
}


Measured memory_bytes: 256
using System;
class Program
{
	static void Main(string[] args)
	{
		// スペース区切りの整数の入力
		string[] input = Console.ReadLine().Split(' ');
		int N = int.Parse(input[0]);
		int X = int.Parse(input[1]);
        string[] xlist = Console.ReadLine().Split(' ');

        int res = Math.Abs(int.Parse(xlist[0]) - X);

        // 最大公約数
        for (int i = 1; i < N; i++){
            int x = Math.Abs(int.Parse(xlist[i]) - X);
            res = Gcd(res, x);
        }

		//出力
		Console.WriteLine(res);
	}
    // ユークリッドの互除法 
    public static int Gcd(int a, int b) {
        if (a < b)
            // 引数を入替えて自分を呼び出す
            return Gcd(b, a);
        while (b != 0) {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }
}

Measured memory_bytes: 18016
#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#pragma optimize("TKACHENKO-GORYACHENKO")
#define psl pair <string, ll>
#define pls pair <ll, string>
#define x first
#define y second
#pragma GCC optimize("O3")
#define plll pair <pair <ll, ll>, ll>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
 
typedef long long ll;
 
typedef long double ld;
 
using namespace std;
 
const ll maxn = 4e5;
const ll inf = 1e9;

ll n, m, k, t;

int main()
{
	pyshnapyshnakaa;
	ll q, w, e, a, b, c;
	cin >> n >> m >> k;
	cout << (k + max(n, m) - 1) / max(n, m);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main ()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b && a!=c)
	cout<<"Yes";
	else if(a==c && a!=b)
	cout<<"Yes";
	else if(b==c && b!=a)
	cout<<"Yes";
	else if(b==c && b==a)
	cout<<"No";
	else if(b!=c && b!=a && a!=c)
	cout<<"No";
return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<iterator>
#include<cmath>
#include<string>
#include<algorithm>
#include<sstream>
#include<queue>
#include<list>
#include<deque>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<chrono>


/*  auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
auto duration = duration_cast<milliseconds>(stop - start);
pr(duration.count());    */


#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define siz         100009
#define mp          make_pair
#define ll          long long int
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define pi          acos(-1.0)
#define all(x)      x.begin(),x.end()
#define ull		    unsigned long long int
#define m(a)	    memset(a,0,sizeof(a))
#define f(i,n)	    for(ll i=0;i<n;i++)
#define sc(a)	    scanf("%lld",&a)
#define pr(a)	    printf("%lld\n",a)
const ll inf = 5000000000000000;
ll in = 1000000000000000000;
using namespace std;

int main()
{
	FastIO;
	ll a,b,c,d, co, t, i, j, k, n,m,r;
	string s('.',150),tmp[150];
	char ans[150][150];
	cin >> r >> c;
	k = 0;
	f(i, r)
	{
		cin >> s;
		f(j, s.size())
		{
			if (s[j] == '#')
			{
				tmp[k] = s;
				k++;
				break;
			}
		}
	}
	co = 0;
	n = 0;
	f(i, c)
	{
		f(j, k)
		{
			if (tmp[j][i] == '#')
			{
				co++;
				for (d = 0; d < k; d++)
				{
					ans[d][n] = tmp[d][i];
				}
				n++;
				break;
			}
		}
	}
	for (i = 0; i < k; i++)
	{
		for (j = 0; j < co; j++)
		{
			cout << ans[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------
ll a[201010], b[201010];
ll N, M, K;

int main() {
  cin >> N >> M >> K;
  rep(i, 0, N) {
    ll A;
    cin >> A;
    a[i + 1] = a[i] + A;
  }
  rep(i, 0, M) {
    ll B;
    cin >> B;
    b[i + 1] = b[i] + B;
  }

  ll ans = 0;
  repe(i, 0, N) {
    ll rest = K - a[i];
    if (rest < 0) continue;

    auto ub = upper_bound(b, b + M + 1, rest);
    ll bsum = ub - b - 1;

    chmax(ans, i + bsum);
  }

  cout << ans;
}


Measured memory_bytes: 6732
l=[]
while True:
    n,x=map(int,input().split())
    if n==0 and x==0: break
    l.append((n,x))

for n,x in l:
    ans=0
    for h in range(1,n-1):
        for i in range(h+1,n):
            for k in range(i+1,n+1):
                if h+i+k==x: ans+=1
    print(ans)


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define vi vector<int>

using ll = long long;
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
inline ll inv(ll x, ll div){return pow(x, div - 2, div);}
#define chmax(a,b) a=max(a,b)
int gcj_out_cnt = 1;
#define gcj_put cout<<"Case #"<<gcj_out_cnt++<<": ";

/*Coding Space*/

int main(){
  string s; cin >> s;
  rep(i,s.size())if(s[i] == '?')s[i] = 'D';
  cout << s << endl;
}


Measured memory_bytes: 3716
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int MOD = 1000000007;

long long a, b;
long long s[100100];
long long dp[100100];
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;

long long sum[100100];
long long get(int l, int r) { //[l, r)
        if (l > r) return 0;
        if (l == 0) return sum[r];
        return sum[r] - sum[l - 1];
}

int main() {
        int n;
        scanf("%d", &n);
        scanf("%lld%lld", &a, &b);
        if (a > b) swap(a, b);
        s[0] = -INFL;
        for (int i = 1; i <= n; i ++) scanf("%lld", &s[i]);
        s[n + 1] = INFL;
        n += 2;
        dp[0] = 1, sum[0] = 1;
        int l = 0, r = 0;
        for (int i = 1; i < n; i ++) {
                dp[i] = get(l, r);
                if (i + 1 == n) break;
                while (s[i + 1] - s[r + 1] >= b) r ++;
                if (s[i] - s[i - 1] >= a) ;
                else if (s[i] - s[i - 2] >= a) l = i - 1;
                else l = i;
                (sum[i] = sum[i - 1] + dp[i]) %= MOD;
        }
        long long ans = ((dp[n - 1] % MOD) + MOD) % MOD;
        printf("%lld\n", ans);
        return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n;
    cin >> n;
    vector<vector<P>> psn(n, vector<P>());

    rep(i, n){
        int a; cin >> a;
        rep(j, a){
            int ta, tb; cin >> ta >> tb;
            ta--;
            psn[i].push_back({ta, tb});
        }
    }

    int ans = 0;
    rep(i, 1<<n){
        vector<int> human(n, -1); 
        int isng = false;
        int cnt = 0;
        rep(j, n){
            if ((i>>j)&1 == 1){
                human[j] = 1;
            } else {
                human[j] = 0;
            }
        }
        rep(j, n){
            if (human[j] == 1){
                //j人目の証言を有効と扱う
                rep(k, psn[j].size()){
                    if (human[psn[j][k].first] != psn[j][k].second){
                        isng = true;
                        break;
                    }
                }
                cnt++;
            }
        }
        if (!isng){
            ans = max(ans, cnt);
        }
    }

    cout << ans << endl;
}



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>;

void Main()
{
  ll N,M; cin >> N >> M;
  if (M/2 <= N) {cout << M/2 << endl; return;}
  ll ans = 0;
  ans += N; 
  ll res = M - 2*N;
  ans += res / 4;
  cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int S,h,m,s;
   
   cin >> S;
   h = S/3600;
   m = ( S % 3600) / 60;
   s = S - 3600 * h - 60 * m;
   cout << h <<":"<< m <<":"<< s << endl;

}

Measured memory_bytes: 1164
#!/usr/bin/env python3

S = input()

if len(S) % 2 == 0:
    len_half = len(S) // 2
else:
    len_half = len(S) // 2 + 1

S_front = S[:len_half]
S_back = S[len_half:][::-1]
cnt = 0

for i, j in zip(S_front, S_back):
    if i == j:
        continue
    else:
        cnt += 1

print(cnt)

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

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int64_t> P(n), C(n);
    copy_n(istream_iterator<int64_t>(cin), n, P.begin());
    copy_n(istream_iterator<int64_t>(cin), n, C.begin());

    for (auto &p: P)
        p--;

    vector<int> L_size(n);
    vector<int64_t> S(n);
    for (int i = 0; i < n; i++){
        if (L_size[i] != 0)
            continue;
        int cur = i;
        int cnt = 0;
        do {
            cur = P[cur];
            S[i] += C[cur];
            cnt++;  
        } while(cur != i);
        L_size[i] = cnt;
        do {
            cur = P[cur];
            S[cur] = S[i];
            L_size[cur] = cnt;  
        } while(cur != i);
    }

    int64_t ans = -1e15;
    for (int i = 0; i < n; i++){
        int64_t res = 0;
        int cur = i;
        int m = L_size[i];
        for (int j = 0; j < min(2 * m, k); j++){
            cur = P[cur];
            res += C[cur];
            ans = max(ans, res);
        }
        res = 0;
        if (S[i] > 0){
            res += S[i] * max(k / m - 2, 0);
            ans = max(ans, res);
        }
        cur = i;
        for (int j = 0; j < min(2 * m + k % m, k); j++){
            cur = P[cur];
            res += C[cur];
            ans = max(ans, res);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3764
N = int(input())
bN = [int(i) for i in input().split()]

def f():
    bN_ = [a - (n + 1) for n, a in enumerate(bN)]
    bN_.reverse()
    # print(bN_)
    bN.reverse()

    l = []
    while bN_:
        i_0 = [i for i, a in enumerate(bN_) if a == 0]
        if not i_0:
            return [-1]

        i = i_0[0]
        # print(bN_, i)
        for j in range(i):
            bN_[j] += 1
        bN_.pop(i)
        a = bN.pop(i)
        # print("->", bN_, "pop", a)
        l.append(a)
    return l
    # i_0 = [i for i, a in enumerate(bN_) if a == 0]
    # print(n, b, i_0)
    # if not i_0:
    #     return
    # for i in reversed(i_0):
    #     for j in range(i, len(b)):
    #         bN_[j] += 1
    #     b.pop(i)
    #     print(b)
    #     f(b[i:], N, i)

for i in list(reversed(f())):
    print(i)


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

using namespace std;

int main(){
  int n;
  cin>>n;
  int mod = 1000000007;
  vector<int>a(n);
  long long sum=0;
  long long ans=0;
  for(int i=0;i<n;++i){
    cin>>a[i];
    sum+=a[i];
    sum%=mod;
  }
  for(int i=0;i<n;++i){
    sum-=a[i];
    if(sum<0)
      sum+=mod;
    ans+=sum*a[i];
    ans%=mod;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4008
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const ll mod = 1e9 + 7;
int main()
{
	SPEED
	string s;
	cin >> s;
	bool found = false;
	for (int i = 0; i < s.size(); ++i)
	{
		if (s[i]=='7')
		{
			found = true;
			break;
		}
	}
	if (found)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <ctype.h>
using namespace std;

int main() {
    string s, p, ans;
    
    cin >> s >> p;
    s += s;
    s.find(p) != -1 ? ans = "Yes" : ans = "No";
    cout << ans << endl;
    return 0;
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
int main(){
    
    int n=1,x=1;
    cin>>n>>x;
    while(n||x){
    
    int ans=0;
    for(int i=1;i<=n-2;i++){
        for(int k=i+1;k<=n-1;k++){
            for(int j=k+1;j<=n;j++){
                if(i+k+j==x)ans++;
            }
        }
    }
    cout<<ans<<endl;
    cin>>n>>x;
    }
    return 0;

}
/*


*/



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) (x.begin(), x.end())

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ll n;
    cin >> n;
    if(n&1) cout << n*2 << endl;
    else cout << n << endl;
}

Measured memory_bytes: 256