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

int main(){
    int h,w,ans=0;cin>>h>>w;
    vector<string> s(h);
    REP(i,h) cin>>s.at(i);
    vector<vector<int>> hh(h,vector<int>(w,0)),ww(h,vector<int>(w,0));

    REP(i,h){
        int l=0;
        while(l<w){
            if(s.at(i).at(l)=='#') l++;
            else{
                int r=l,count=0;
                while(r<w&&s.at(i).at(r)=='.'){
                    r++;
                    count++;
                }
                for(int j=l;j<r;j++) hh.at(i).at(j)=count;
                l=r;
            }
        }
    }

    REP(j,w){
        int l=0;
        while(l<h){
            if(s.at(l).at(j)=='#') l++;
            else{
                int r=l,count=0;
                while(r<h&&s.at(r).at(j)=='.'){
                    r++;
                    count++;
                }
                for(int i=l;i<r;i++) ww.at(i).at(j)=count;
                l=r;
            }
        }
    }

    REP(i,h) REP(j,w) ans=max(ans,hh.at(i).at(j)+ww.at(i).at(j));
    cout<<ans-1;
}


Measured memory_bytes: 35712
N = int(input())
T,A = map(int, input().split())
H = list(map(int, input().split()))
keep = 0

for i in range(len(H)):
  if( abs( T-0.006*H[keep] -A ) > abs( T-0.006*H[i] -A )):
    keep = i

print(keep+1)

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

int main(){
  int d; cin >> d;
  if(d == 25) cout << "Christmas" << endl;
  else if(d == 24) cout << "Christmas Eve" << endl;
  else if(d == 23) cout << "Christmas Eve Eve" << endl;
  else if(d == 22) cout << "Christmas Eve Eve Eve" << endl;
 return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define INF 10000000
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int N;
    cin>>N;
    vector<ll> C(N-1),S(N-1),F(N-1);
    rep(i,N-1) cin >> C.at(i) >> S.at(i) >> F.at(i);
    rep(i,N){
        int now_station = i;
        ll total_time = 0;
        while(now_station<N-1){
            if(total_time < S.at(now_station)){
                //始発に乗る
                total_time=S.at(now_station);
            }else if(total_time%F.at(now_station)==0){
                //そのまま乗れる
            }else{
                //始発後についたときはtotal_time+t%Fi==0を満たすt秒待つ
                total_time=total_time+F.at(now_station)-total_time%F.at(now_station);
            }
            total_time+=C.at(now_station);
            now_station++;
        }
        cout<<total_time<<endl;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int d = Integer.parseInt(sc.next());
        int g = Integer.parseInt(sc.next());
        int[] p = new int[d];
        int[] c = new int[d];
        for(int i = 0; i < d; i++){
            p[i] = Integer.parseInt(sc.next());
            c[i] = Integer.parseInt(sc.next());
        }
        
        int min = 1000;
        for(int i = 0; i < 1<<d; i++){
            int ac = 0;
            int point = 0;
            int a = -1;
            for(int j = 0; j < d; j++){
                if((i>>j & 1) == 1){
                    ac += p[j];
                    point += (j+1)*100*p[j] + c[j];
                }else{
                    a = j;
                }
            }
            if(point < g && a != -1){
                if(g - point <= (a+1)*100*(p[a]-1)){
                    int b = (g - point + (a+1)*100 -1) / ((a+1)*100);
                    ac += b;
                    point += (a+1)*100*b;
                }
            }
            if(point >= g && ac < min){
                min = ac;
            }
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 23380
main::IO()
main = do
  [a,b] <- map read . words <$> getLine
  putStrLn $ show $ solve a b

solve :: Int -> Int -> Int
solve s c = do
  let c2 =  c `div` 2
  case s > c2 of
    True -> c2
    False -> (c2 + s) `div` 2

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

const int M =10000001;
ll a[M];
int main(){
    int N; cin >> N;
    fill(a, a + M, 1);
    for(long long i = 2; i < M; i++){
        for(long long j = 1; j * i < M; j++){
            a[i*j]++;
        }
    }
    long long ans = 0;
    for(long long i = 1; i <= N; i++){
        ans += i * a[i];
    }
    cout << ans << endl;
    return 0;
}




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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	vector<int>v={8,8,7,7,6,6,5,5,4,4,3,3,2,2,1,1};
	int x; cin>>x;
	cout<<v.at(x/100-4)<<"\n"s;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include<chrono>
using namespace std;
#define ff first
#define pb push_back
#define ss second
#define ll long long
#define MAX 5000
#define mpi map<int, int>
#define mpll map<ll, ll>
#define pll pair<ll, ll>
#define plld pair<ll, double>
#define SKILLER ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vi std::vector<int>
#define vll std::vector<ll>
#define vs std::vector<string>
#define vvi std::vector<std::vector<int>>
#define vvll std::vector<std::vector<ll>>
#define all(v) v.begin(), v.end()
#define loop(i, a, b) for(int i = a; i < b; i++)
const int Maxn = 1e5+1, Mod = 1e9 + 7;
int main(){
    SKILLER;

           
         double d = 3.141592;
         ll n; cin >> n;
         d = 2*d*n;
         cout << fixed << setprecision(5) << d;
    return 0;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e18;
using namespace std;
typedef long long ll;
int main() {
  ll N;
  cin >> N;
  ll p[N];
  REP(i, N) { cin >> p[i]; }

  ll cnt = 0;
  REP(i, N) {
    ll diff = p[i] - (i + 1);
    if (diff != 0) {
      cnt++;
    }
  }
  if (cnt == 0 || cnt == 2) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}

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

int main(){
	double l;
	cin >> l;
	
	double h = l/3;
	double w = l/3;
	double y = l/3;
	
	double ans = h*w*y;
	
	printf("%.10f", ans);
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		ArrayDeque<Integer> a = new ArrayDeque<Integer>();

		for(int i=0; i<N; i++){
			if((i+1)%2!=N%2){
				a.addLast(sc.nextInt());
			}else{
				a.addFirst(sc.nextInt());
			}
		}
		String ans = "";
		for(int i=0; i<N; i++){
			System.out.println(a.removeFirst());
		}
		
    }
}


Measured memory_bytes: 66196
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(input())
S = list(sorted(map(int, input().split())))
q = int(input())
T = list(map(int, input().split()))

ans = 0
for t in T:
    left = -1
    right = n
    while (right - left > 1):
        mid = left + (right - left) // 2
        if S[mid] >= t:
            right = mid
        else:
            left = mid
    if S[right] == t:
        ans += 1
print(ans)



Measured memory_bytes: 16644
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll ; 
typedef long double ld ;
typedef pair<ll , ll> pll ;

const ll N = 2e5 + 30 , Mod = 1e9 + 7 ;
const ll SQ = 330 ;

ll a[N], ps[N], sf[N];
int main () {
    ios::sync_with_stdio(0), cin.tie(0) ;
    ll n;
    cin >> n;
    for (int i = 1; i <= n; i ++) {
    	cin >> a[i];
    	ps[i] = __gcd(a[i], ps[i - 1]);
	}
	if (n == 1) {
		return cout << a[1], 0;
	}
	for (int i = n; i; i --) sf[i] = __gcd(sf[i + 1], a[i]);
	ll ans = 0;
	for (int i = 1; i <= n; i ++)
		ans = max(ans, __gcd(ps[i - 1], sf[i + 1]));
	cout << ans;
    
    return (0) ;
}

Measured memory_bytes: 3584
N = int(input())
S = input()

left_s = 0
right_d = 0

right_d = S.count('.')
ans = right_d

for i in range(N):
    if S[i] == '#':
        left_s += 1
    else:
        right_d -=1
    ans_tmp = left_s + right_d
    if ans > ans_tmp:
        ans = ans_tmp
print(ans)

Measured memory_bytes: 3500
#!/usr/bin/env python3
import sys


def solve(N: int, X: "List[int]"):
    ans = 10000000
    for i in range(1, 101):
        s = 0
        for x in X:
            s += (x - i)*(x - i)
        ans = min(ans, s)

    print(ans)



    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define REP(i,n) for(long long i = 0; i < long long(n); i++)
#define FOR(i, m, n) for(long long i = lng long(m);i < long long(n);i++)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template<class T> void corner(bool flg, T hoge) {
	if (flg) {
		cout << hoge << endl;
		exit(0);
	}
	else return;
}

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {
	o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;
}

template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;
}

template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {
	o << "{" << obj.first << ", " << obj.second << "}"; return o;
}

template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

void YN(bool flg) {
	cout << ((flg) ? "YES" : "NO") << endl;
}

void Yn(bool flg) {
	cout << ((flg) ? "Yes" : "No") << endl;
}

void yn(bool flg) {
	cout << ((flg) ? "yes" : "no") << endl;
}

int main() {
	ll A,B,C; cin >> A >> B >> C;
	print(B + min(A + B + 1,C));
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
 
 
int main() {
 
  int n,G[101][101];
  int i,j,k,l,u,a,t;
 
 
  scanf("%d",&n);
 
  for(i=0;i<n+1;i++)
    for(j=0;j<n+1;j++) {
      G[i][j] = 0;
 
    }
 
  for(i=0;i<n;i++){
 
    scanf("%d %d ",&k,&u);
    //    printf("u = %d\n",u);
 
    for(j=0;j<u;j++) {
      scanf("%d",&a);
      G[k -1][a-1] = 1;
      // printf("G[%d][%d] = 1\n",i,k-1);
    }
  }
     
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) {
      printf("%d",G[i][j]);
      if(j != n-1) printf(" ");
    }
    printf("\n");
  }
 
 
  return 0;
 
     
     
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);



ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    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;
    }
}


#define comuse Comuse()

ll combi(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;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

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

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  ll n;
    cin>>n;
  vll A(n);
  ll ans=0;
  FOR(i,0,n){
    cin>>A[i];
  }

  FOR(i,0,n){
    if(A[i]==i+1){
      ans++;
      i++;
    }
  }

  cout<<ans<<"\n";
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e17;



// 各ノードの情報
template <typename T>
struct node {
	T v, lazy;
	node(){
		v = 0;
		lazy = 0;
	}
	// ノードの値の更新
	void merge(T vl, T vr){
		v = max(vl, vr);
	}
	// ノードの値の更新(lazy適用)
	T add(int l, int r, T _v=0){
		T sum = lazy + _v;
		v += sum;
		lazy = 0;
		return sum;
	}
	// 遅延分の変更(加算)
	void addLazy(T v){
		lazy += v;
	}
};

template <typename T, typename NODE=node<T> >
class SegTree{
	// 遅延分の適応と伝播(現在のノードの値を確定させてLazyを伝搬させる)
	void propLazy(int a, int b, int k, T v=0){
		T lazy = data[k].add(a, b, v);
		if( k < N ){
			data[k*2+0].addLazy(lazy);
			data[k*2+1].addLazy(lazy);
		}
	}
	// セグメントツリーをたどる
	T prop(int l, int r, T v, int a, int b, int k=1){
		// 今いるノードの値を確定させる
		propLazy(a, b, k);
		// たどる
		NODE nd;	// 結果保存用(範囲外の場合は初期値が返る)
		if( l <= a && b <= r ){
			// 完全に範囲内の場合
			propLazy(a, b, k, v);
			return data[k].v;
		}else if( l < b && a < r ){
			// 中途半端に含まれる場合
			int m = (a+b) / 2;
			T vl = prop(l,r,v, a, m, k*2);
			T vr = prop(l,r,v, m, b, k*2+1);
			data[k].merge( data[k*2].v, data[k*2+1].v );
			nd.merge( vl, vr );
		}
		return nd.v;
	}

	public:
	vector<NODE> data;
	int N;
	SegTree(int _N){
		// _N <= (N = 2^k) を満たすNを見つける
		N = 1;
		while( N < _N ) N<<=1;
		data.resize(N*2);
	}
	// セグメントツリーの更新(指定した場所の値をvに変更)
	void update(int l, T v){
		prop(l, l+1, v-get(l), 0, N);
	}
	// セグメントツリーの更新(範囲に加算)
	T add(int l, int r, T v){
		return prop(l,r,v,0,N);
	}
	// 値を取得 [l,r)
	T get(int l, int r){
		return prop(l,r,0,0,N);
	}
	// 値を取得 [l,l+1)
	T get(int l){
		return prop(l,l+1,0,0,N);
	}
};




int main(){
	//ios_base::sync_with_stdio(0);
	ll N, M, ans=0;
	ll a[100005];

	cin >> N >> M;
	rep(i,N) cin >> a[i];

	ll loop = 1;
	rep(i,N-1) if(a[i] > a[i+1]) loop++;

	SegTree<ll> sg(100005);
	rep(i,100005) sg.update(i, (ll)i*loop);
	rep(i,N-1){
		if( a[i] < a[i+1] ){
			sg.add( a[i]+1, a[i+1]+1, -(a[i]+1) );
		}else{
			sg.add( a[i]+1, M+2, -(a[i]+1) );
			sg.add( 0, a[i+1]+1, M-a[i]-1 );
		}
		//rep(i,M+1) cout << sg.get(i) << " "; cout << endl;
	}
	
	//cout << endl;
	//rep(i,M+1) cout << sg.get(i) << " "; cout << endl;
	rep(i,M+1) if(i <= a[0] ) sg.add(i, i+1, -i);
	rep(i,M+1) if(a[N-1] < i) sg.add(i, i+1, -i);
	
	//rep(i,M+1) cout << sg.get(i) << " "; cout << endl;

	ans = -sg.get(1, M+1);
	ans += loop * M - a[0] - (M - a[N-1]);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define int long long
using namespace std;
int dp[105][100005];
int n;
int f(int idx,int w,int weight[],int value[]){
    if(idx>=n || w==0){
        return 0;
    }
    int &ans=dp[idx][w];
    if(ans!=-1){
        return ans;
    }
    ans=0;
    int sum1=0,sum2=0;
    if(weight[idx]<=w){
        sum1=value[idx]+f(idx+1,w-weight[idx],weight,value);
    }
    sum2=f(idx+1,w,weight,value);
    ans=max(sum1,sum2);
    return ans;
}

int32_t main() {
    memset(dp,-1,sizeof(dp));
	int w;
	cin>>n>>w;
	int weight[n];
	int value[n];
	for(int i=0;i<n;i++){
	    cin>>weight[i]>>value[i];
	}
	cout<<f(0,w,weight,value)<<endl;
}


Measured memory_bytes: 85636
#include <iostream>                            
#include <cmath>                               
using namespace std;                           
                                               
int main(void) {                               
  int x;                                       
  cin >> x;                                    
  int X_Cubic = pow(x,3);                      
  cout << X_Cubic << endl;                     
  return 0;                                    
}                                              
                      

Measured memory_bytes: 3252
import math

K = int(input())
A = list(map(int,input().split()))[::-1]

mi = 2
ma = 2
res = 0

for i in range(K) :
    if (mi % A[i]) and (ma % A[i]) and ((mi // A[i]) == (ma // A[i])) :
        res = -1
        break
    
    mi = math.ceil(mi / A[i]) * A[i]
    ma = math.floor(ma / A[i]) * A[i] + A[i] - 1

if res == -1 :
    print(res)
else :
    print(mi,ma)

Measured memory_bytes: 15020
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    vector<vector<bool> > dp(4, vector<bool>(1000, false));
    dp[0][0] = true;
    for(int i=0; i<n; ++i){
        for(int j=2; j>=0; --j){
            for(int k=0; k<1000; ++k){
                if(!dp[j][k])
                    continue;
                dp[j+1][k*10+(s[i]-'0')] = true;
            }
        }
    }

    int ans = 0;
    for(int i=0; i<1000; ++i){
        if(dp[3][i])
            ++ ans;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main(){
  var s string
  fmt.Scanf("%s", &s)

  var max, count int
  for _, rune := range s{
    c := string(rune)
    if c == "R"{
      count++
    } else {
      count = 0
    }
    if max < count {
      max = count
    }
  }

  fmt.Println(max)

}

Measured memory_bytes: 1832
import math

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

ab = list(map(int,input().split()))
a = ab[0]
b = ab[1]
ab = int(str(a)+str(b))

if is_integer_num(math.sqrt(ab)):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
const long double pi = 3.14158265358979l;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  vector<ll> a(n);
  ll ma = 0; ll mi = LINF;
  rep(i,n){
    cin >> a[i];
    ma = max(ma, a[i]);
    mi = min(mi, a[i]);
  }
  if(ma-mi>1){
    cout << "No" << endl;
    return 0;
  }
  if(ma==mi){
    if(n >= 2 * ma || ma==n-1){
      cout << "Yes" << endl;
    }else{
      cout <<"No" << endl;
    }
    return 0;
  }
  ll l = 0, s = 0;
  rep(i,n){
    if(a[i]==ma)l++;
    else s++;
  }
  if(s<ma && l >= 2 * (ma-s)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}



Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <list>
#include <map> //連想配列
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector> //動的配列

#define rep(i, N) for (int i = 0; i < N; i++)

using namespace std;
int main()
{
  string x;
  cin >> x;
  if (x == "ABC")
    cout << "ARC";
  else
    cout << "ABC";
  return 0;
}


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

int main(void){
    const int num = 3;
    int inputNum[] = {5,19,10};
    
    for(int i = 0; i < num; i++) {
        std::cin >> inputNum[i];
    }
    
    for(int i = 0; i < num - 1; i++) {
        for(int j = i + 1; j < num; j++)
            if(inputNum[j] < inputNum[i]) {
                int tempNum = inputNum[j];
                inputNum[j] = inputNum[i];
                inputNum[i] = tempNum;
            }
    }
    
    // for(int i = 0; i < num; i++) {
    //     std::cout << inputNum[i] << " ";
    // }
    cout << inputNum[0] << " " << inputNum[1] << " " << inputNum[2] << endl;
}

Measured memory_bytes: 3080
N = int(input())
A = [int(i) for i in input().split()]
AA = [(0,0) for i in range(N)]

for i in range(N):
  AA[i] = (A[i], i+1)
  
AA.sort()

for i in range(N-1):
  print(AA[i][1], end = " ")
  
print(AA[N-1][1])


Measured memory_bytes: 59244
function main(input) {
    var args = input;
	
	switch (parseInt(args)) {
		case 25:
			console.log("Christmas");
			break;
			
		case 24:
			console.log("Christmas Eve");
			break;
			
		case 23:
			console.log("Christmas Eve Eve");
			break;
			
		case 22:
			console.log("Christmas Eve Eve Eve");
			break;
		
	}
	
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  ll n; cin >> n;
  
  if(n < 1000) cout << "ABC" << endl;
  else cout << "ABD" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <queue>
#include <tuple>

using namespace std;

using TUP = tuple<int, int, int, int>;

using VD = vector<double>;
using VVD = vector<VD>;
using VVVD = vector<VVD>;

int n;

VVVD memo; //ijk -> 000 となる期待値

void dfs(int n1, int n2, int n3) {
	if (memo[n1][n2][n3] != 0) {
		return;
	}
	if (n1 == 0 && n2 == 0 && n3 == 0) {
		// 0,0,0の値は0で初期化済み
		return;
	}

	if (n1 > 0) { dfs(n1-1, n2, n3); }
	if (n2 > 0) { dfs(n1+1, n2-1, n3); }
	if (n3 > 0) { dfs(n1, n2+1, n3-1); }

	double val = n;
	if (n1 > 0) { val += memo[n1-1][n2][n3] * n1; }
	if (n2 > 0) { val += memo[n1+1][n2-1][n3] * n2; }
	if (n3 > 0) { val += memo[n1][n2+1][n3-1] * n3; }
	val /= (n1 + n2 + n3);
	memo[n1][n2][n3] = val;

}

int main() {
	cin >> n;

	int a;
	int n1, n2, n3;
	n1 = n2 = n3 = 0;
	for (int i = 0; i < n; i++) {
		cin >> a;
		switch (a) {
			case 1: n1++; break;
			case 2: n2++; break;
			case 3: n3++; break;
			default: break;
		}
	}
	memo.assign(n+1, VVD(n+1, VD(n+1, 0)));
	dfs(n1, n2, n3);

	printf("%.12f\n", memo[n1][n2][n3]);
	return 0;
}

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

string s;

main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin>>s;
    for(int i=0;i<4;i++){
        if(s[i]==s[i-1]){
            cout<<"Bad";
            break;
        }
        if(i==3) cout<<"Good";
    }
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

const int INF = int(1e9);

int n, m, r;
int t[8];
int dist[200][200];

int main() {
    scanf("%d%d%d", &n, &m, &r);
    forn(i, r) {
        scanf("%d", t + i);
        --t[i];
    }
    forn(i, n) forn(j, n) {
        if (i == j) dist[i][j] = 0;
        else dist[i][j] = INF;
    }
    forn(i, m) {
        int from, to, w;
        scanf("%d%d%d", &from, &to, &w), --from, --to;
        dist[from][to] = min(dist[from][to], w);
        dist[to][from] = min(dist[to][from], w);
    }
    forn(k, n) forn(i, n) forn(j, n) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
    }
    sort(t, t + r);
    int ans = INF;
    do {
        int cur = 0;
        forn(i, r - 1) {
            cur += dist[t[i]][t[i + 1]];
        }
        ans = min(ans, cur);
    } while (next_permutation(t, t + r));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  long long L=0;
  long long F=0;
  long long M=0;
  cin>>N;
  vector<long long>vec(N);
  for(int X=0;X<N;X++){
    cin>>vec.at(X);
  }
  sort(vec.rbegin(),vec.rend());
  for(;;){
    if(L==0){
      M+=vec.at(F);
      L++;
      F++;
    }
    else if(L==N-2){
      M+=vec.at(F);
      L++;
      F++;
    }
    else if(L<N-2 && L>0){
      M+=vec.at(F)*2;
      L+=2;
      F++;
    }
    if(L>=N-1){
      break;
    }
  }
  cout<<M<<endl;
}


Measured memory_bytes: 4816
import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf-8");

const main = (input: string): void => {
  const [nm, ...ab] = input.split("\n");
  const [n, m] = nm.split(" ");
  const N = parseInt(n, 10);
  const M = parseInt(m, 10);
  const A = ab.slice(0, N);
  const B = ab.slice(N, -1);
  let flag = false;
  let flag2 = false;

  A.forEach((a, i) => {
    const index = a.indexOf(B[0]);
    if (index !== -1) {
      if (N - i >= M) {
        for (let j = 1; j < M; j++) {
          const index2 = A[i + j].indexOf(B[j]);
          if (index === index2) flag = true;
          else flag = false;
        }
        if (flag || M === 1) flag2 = true;
      }
    }
  });

  if (flag2) console.log("Yes");
  else console.log("No");
};

main(input);


Measured memory_bytes: 29632
var
	N,L,R,M:Longint;
	S,T,U:String;
begin
	readln(N);
	writeln(0);
	flush(output);
	readln(S);
	if S='Vacant' then exit;
	writeln(N div 2);
	flush(output);
	readln(T);
	if T='Vacant' then exit;
	if S=T then begin
		if N div 2 mod 2=0 then begin
			L:=N div 2;
			R:=N;
			U:=T;
			T:=S;
			S:=U;
		end else begin
			L:=0;
			R:=N div 2;
		end;
	end else begin
		if N div 2 mod 2=0 then begin
			L:=0;
			R:=N div 2;
		end else begin
			L:=N div 2;
			R:=N;
			U:=T;
			T:=S;
			S:=U;
		end;
	end;
	while True do begin
		M:=(L+R)div 2;
		writeln(M);
		flush(output);
		readln(U);
		if U='Vacant' then exit;
		if S=U then begin
			if (M-L)mod 2=0 then begin
				L:=M;
				S:=U;
			end else begin
				R:=M;
				T:=U;
			end;
		end else begin
			if (M-L)mod 2=0 then begin
				R:=M;
				T:=U;
			end else begin
				L:=M;
				S:=U;
			end;
		end;
	end;
end.


Measured memory_bytes: 756
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const ll MOD=1e9+7;
typedef pair<int,int> P;
const int ALP=26;    
char tab[26];
bool flg[26];

int main(){
  string S,T;
  cin>>S>>T;
  int n=S.size();
  bool f=true  ;
  REP(i,n){
    char &c=tab[S[i]-'a'];
    if(c!=0 && c!=T[i]){
      f=false;
      
    }else {
      c=T[i];
    }
  
  }
  
  REP ( i,26) {
    if(tab[i]!=0){
      if(flg [tab[i]-'a']){
        f=false ;
      }
      flg [tab[i]-'a']=true ;
    }
  }
  cout<<(f ? "Yes" : "No")<<endl;
  return 0;
}

Measured memory_bytes: 776
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <map>

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

int main(void){
    char a[15];
    scanf("%s",a);
    a[3] = '8';
    cout << a << endl;
}


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

int main(){
  int k, x; cin >> k >> x;
  int start=max(-1000000,x-k+1);
  int end=min(1000000,x+k-1);
  for (int i=start; i<=end; i++){
    cout<<i<<" ";
  }
  cout<<endl;
}

Measured memory_bytes: 256
import sys


def solve_it_chameleons(n, l, t, x, w):
    initial_color = [i for i in range(n)]

    chameleons = [[x[i], w[i], initial_color[i]] for i in range(n)]
    initial_color_clockwise = [chameleons[i][2] for i in range(n)]

    x0, w0, color0 = chameleons[0]
    for i in range(n):
        if w[i] != w0:
            d = (w0 * (x[i] - x0)) % l
            meet = 0
            if 2 * t >= d:
                meet = (2 * t - d) // l + 1
            color0 += w0 * meet
            color0 %= n

    # The chameleon (let's call him chameleon 0) initially at x0 is at (x0 + w0 * t) % l at the end,
    # Initially, its color is color0 and it changed <meet> times.
    # The final clockwise colors are a translation of the initial clockwise colors.

    x_final = [(x[i] + w[i] * t) % l for i in range(n)]
    x_final.sort()

    # In the special case where chameleon meets just at the end, they swap their colors.
    # The index need to be incremented if he walks clockwise.
    i = x_final.index((x0 + w0 * t) % l)
    if i + 1 < n and x_final[i] == x_final[i + 1]:
        if w0 == 1:
            i += 1
    res = [0] * n
    for k in range(n):
        color = (color0 + k) % n
        res[color] = x_final[(i+k) % n]
    return res


if __name__ == '__main__':

    n, l, t = map(int, input().split())
    x = []
    w = []
    for i in range(n):
        _x, _w = map(int, input().split())
        if _w == 2:
            _w = -1
        x.append(_x)
        w.append(_w)

    res = solve_it_chameleons(n, l, t, x, w)
    for i in range(n):
        print(res[i])


Measured memory_bytes: 27616
#include <stdio.h>

int main(void)
{
    char s[10]={};
    int a,b;
    scanf("%d%d",&a,&b);
    scanf("%s",s);
    int judge=0;
    for(int p=0;p<a+b+1;p++)
    {
        if(p==a)
        {
            if(s[p]=='-')judge++;
        }
        else
        {
            if(s[p]<='9'&&s[p]>='0')judge++;
        }
    }
    if(judge==a+b+1)printf("Yes");
    else printf("No");
}

Measured memory_bytes: 128
//#pragma GCC optimize "trapv"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand rng
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define M_PI 3.14159265358979323846
typedef long long ll;



int main() {
	//fios;
	ll n;
	cin >> n;
	unordered_map<ll, ll> mp;
	if(n == 1) {
		puts("0");
		return 0;
	}
	
	ll ans = 0;

	ll f = 2;
	while(n % f == 0) {
		mp[f]++;
		n /= f;
		f *= 2;
	}
	
	for(ll i = 3; i * i <= n; i+=2) {
		ll t = i;
		while(n % t == 0) {
			mp[t]++;
			ans++;
			n /= t;
			t *= i;
			if(n == 0) break;
		}
		while(n % i == 0) n /= i, mp[i]++;
	}
	// DEBUG(ans);
	if(n > 2) mp[n]++;
	cout << mp.size() << endl;

}

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

typedef long long ll;
typedef vector<int> vi;            typedef vector<vi> vii;
typedef vector<ll> vl;             typedef vector<vl> vll;
typedef pair<int,int> pi;          typedef pair<pi,int> pii;
typedef pair<ll,ll> pl;            typedef pair<pl,ll> pll;
typedef pair<int,bool> pib;        typedef pair<ll,bool> plb;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define in insert
#define er erase
//user-defined hash table for pairs --------------------------------------------------------------------------------------------------
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

//returns (a^n mod p)---------------------------------------------------------------------------------------------------------------
ll power(ll a,ll n,ll p)
{
	if(n == 0)
	{
		return 1;
	}
	else if(n%2 == 0)
	{
		ll ans = power(a,n/2,p);
		return (ans*ans)%p;
	}
	else 
	{
		ll ans = power(a,n-1,p);
		return (ans*a)%p;
	}
}

//returns (a^-1 mod p)(if p is prime)----------------------------------------------------------------------------------------------
ll inverse(ll a,ll p)
{
   return power(a,p-2,p);
}
//----------------------------------------------------------------------------------------------------------------------------------


void solve()
{
   int n;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
   	  int j = 2;
   	  int cnt = 0;
   	  for(int j=2;j*j < 2*i;j++)
   	  {
   	  	for(int k=2;k*k < 2*i;k++)
   	  	{
   	  		if(sqrt(2*i-j*j-k*k) == floor(sqrt(2*i-j*j-k*k)) && sqrt(2*i-j*j-k*k) > 1)
   	  	    {
   	  	    	int l = sqrt(2*i-j*j-k*k);
   	  	    	if((j+l-k)%2 == 0 && j+l-k > 1 && (j+k-l)%2 == 0 && j+k-l > 1 && (k+l-j)%2 == 0 && k+l-j > 1)
   	  	    	{
   	  	    		cnt++;
   	  	    	}
   	  	    }
   	  	}
   	  }
   	  cout<<cnt<<endl;
   }
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef PAVANSAI006
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("err.txt", "w", stderr);
#endif
    ll t = 1;
    //cin>>t;
    while(t--)
    {
    	solve();
    }
    
}

Measured memory_bytes: 3580
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

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


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

#define debug(x) cout << #x " = " << (x) << endl

using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec) {
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#define solvsh
//#define multi
#ifdef solvsh

void prec(){

}

const int MAXN = 2e5;

vector<int> g[MAXN];
ll mod = 1e9 + 7;

ll pows[MAXN];

int to[MAXN];

int comp[MAXN];

map<int ,int> mins_comp;

int inp[MAXN];

void dfs(int ver, int color) {
    if (comp[ver] != 0)
        return;

    comp[ver] = color;
    if (inp[ver] == -1)
        mins_comp[color] ++;

    for (auto out : g[ver]) {
        dfs(out, color);
    }
}

ll ml(ll a, ll b) {
    return (a * b) % mod;
}

ll add(ll a, ll b) {
    return (a + b) % mod;
}


void solve() {


    ll a;
    cin >> a;

    ld b;
    cin >> b;

    b = 1000*(b + 0.005);
    ll bb = ll(b) / 10;
    ll res = a  *bb;
    res /= 100;
    cout << res;
}

#else

void solve() {

}

#endif

void multisolve() {

    int t;
    cin >> t;

    int i = 1;
    while (t--) {
//        cout << "Case " << (i++) << ": ";
        solve();
        cout << "\n";
    }
}


#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);


#ifdef multi
    multisolve();
#else
    solve();
    //    gen();
#endif

}


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

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

Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		mut s: Chars,
		mut t: Chars,
	}

	s.sort();
	t.sort_by_key(|&x| std::cmp::Reverse(x));

	if s < t {
		println!("Yes");
	}
	else {
		println!("No");
	}
}



Measured memory_bytes: 2144
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  double a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  if(b-d!=0)
  YESNO(e>=(abs(c-a)/(b-d))&&(abs(c-a)/(b-d))>0);
  else
    out("NO");

}


Measured memory_bytes: 3848
#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 push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a,b;
int main()
{
    cin>>n>>a>>b;
    int x=(b-a-1);
    if(x%2==1){
        printf("Alice");
        return 0;
    }
    printf("Borys");
    return 0;
}
//onaj koji igra kad se susretnu gubi


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

using namespace std;

int main(){

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

    sort(arr.begin(), arr.end());
    long long cnt = 0;
    for(int i = 0; i < n-1; i++){
        for(int j = i+1; j < n; j++){
            int lb = arr[j] - arr[i] + 1;
            int up = arr[i] + arr[j] - 1;
            int tot = upper_bound(arr.begin(), arr.end(), up) - lower_bound(arr.begin(), arr.end(), lb);
            if( arr[i] >= lb )
                tot--;
            if( arr[j] >= lb )
                tot--;
            cnt += tot;
        }
    }

    cout << cnt/3 << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
inputs = sys.stdin.readlines()

n = int(inputs[0])
A = []
B = []

i = 1
for _ in range(n):
    a = int(inputs[i])
    i += 1
    A.append(a)
    B.append([tuple(map(int, inputs[j].split())) for j in range(i, i+a)])
    i += a

C = set()
for i in range(2 ** n):
    flag = True
    for j in range(n):
        if((i >> j) & 1):
            flag &= all((i >> (x-1)) & 1 == y for x, y in B[j])
    if flag:
        C.add(i)

print(max([sum([int(bit == '1') for bit in str(bin(c))]) for c in C]))

Measured memory_bytes: 6280
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

const int dx[4] = {-1, 0, 1, 0}; 
const int dy[4] = {0, -1, 0, 1}; // 移動方向を定義しておく

int main() {
    int h, w; cin >> h >> w;
    int ch, cw; cin >> ch >> cw; ch--; cw--;
    int dh, dw; cin >> dh >> dw; dh--; dw--;

    vector<string> mat(h); // 迷路が '#', '.' などのcharで表現されているならstringでよい
	rep(i, h) cin >> mat[i];

    debug(mat);

	deque<P> que;
	que.push_back(P(ch, cw)); // queueを作成し、開始位置をプッシュ
	vector<vector<int>> dist(h, vector<int>(w, -1));
	dist[ch][cw] = 0; // H*W のdistを作成し、開始位置の距離を0に

    int cnt = 0;
	while (!que.empty()) {
		P p = que.front(); que.pop_front();
		int x = p.fi, y = p.se;
		rep(i, 4) {
			int nx = x+dx[i], ny = y+dy[i];
            cnt++;
            debug(nx, ny);
			if (nx<0 || ny<0 || nx>=h || ny>=w) continue; // 領域外ならskip
            if (dist[nx][ny]!=-1 && dist[nx][ny]<=dist[x][y]) continue; // 訪問済みならskip
			if (mat[nx][ny]!='#') {
                dist[nx][ny] = dist[x][y];
                que.push_front(P(nx, ny));
            }
		}
        rep(i, 5) rep(j, 5) {
            int wx = x+i-2, wy = y+j-2;
            cnt++;
            if (wx<0 || wy<0 || wx>=h || wy>=w) continue; // 領域外ならskip
            if (mat[wx][wy]=='#') continue;
            if (dist[wx][wy]!=-1) continue;
            dist[wx][wy] = dist[x][y]+1;
            que.push_back({wx, wy});
        }
	}

    debug(cnt);

	cout << dist[dh][dw] << endl;
}

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

		int h1 = sc.nextInt();
		int m1 = sc.nextInt();
		int h2 = sc.nextInt();
		int m2 = sc.nextInt();
		int k = sc.nextInt();

		int t = h2*60+m2 - (h1*60+m1);

		System.out.println(t-k);
	}
}

Measured memory_bytes: 35792
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <fstream>

using namespace std;

#define max(a,b) a > b ? a : b
#define min(a,b) a < b ? a : b

#define N_MAX 2000

int main()
{
    int N, X, Y;

    cin >> N >> X >> Y;

    int d[N_MAX];
    int dvec[N_MAX] = { 0 };

    for (int i = 1; i <= N; i++)
    {
        for (int j = 1; j <= N; j++)
        {
            if (i < j)
            {
                int tmp1 = j - i;
                int tmp2 = abs(i - X) + 1 + abs(j - Y);
                int min_d = min(tmp1, tmp2);
                dvec[min_d]++;
            }
        }
    }

    for (int i = 1; i < N; i++)
    {
        cout << dvec[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum = 0;

        int n = a;
        while(n > 0){
            sum = sum + (n%10);
            n = (n - (n % 10)) / 10;
        }

        if(a % sum == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


    }
}


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

using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;

int main(){
    int ans, N, K;
    cin >> N >> K;

    ans = K * pow(K-1, N-1);
    cout << ans << endl;
}

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

int main(){
  int H, W;
  string pixels;
  cin >> H >> W;
  rep(i, W+2){
    sharp();
  }
  cout <<endl;
  rep(i, H){
    sharp();
    cin>>pixels;
    cout<<pixels;
    sharp();
    cout << endl;
  }
  rep(i, W+2){
    sharp();
  }
  cout << endl;
}
    

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>

using namespace std;

int main(void){
	int n,m,t;
	
	while(cin >> n >> m){
		if((n|m) == 0) break;
		vector<int> val;
		int ret;
		for(int i=0;i<n;i++){
			cin >> t;
			val.push_back(t);
		}
		sort(val.begin(), val.end(), greater<int>());
		ret = accumulate(val.begin(),val.end(),0);
		for(int i=m-1;i<n;i+=m) ret -= val[i];
		cout << ret << endl;
	}
}

Measured memory_bytes: 0