akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1000000007LL;
ll dp[2][3][301][301];
int l[300], r[300], x[300];
typedef pair<int, int> S;
typedef pair<S, int> P;
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> l[i] >> r[i] >> x[i];
		if (l[i] == 1 && r[i] == 1 && x[i] != 1) {
			cout << 0 << endl;
			return 0;
		}
	}
	vector<P> cond[301];
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < M; j++) {
			if (l[j] <= i&&i <= r[j]) cond[i].emplace_back(S(l[j], r[j]), x[j]);
		}
	}
	dp[1][0][0][0] = dp[1][1][0][0] = dp[1][2][0][0] = 1;
	for (int i = 1; i < N; i++) {
		//i番目になった色
		for (int c = 0; c < 3; c++) {
			//他2つの色をぬった最も近い場所
			for (int j = 0; j < i; j++) {
				for (int k = 0; k < i; k++) {
					if (dp[i & 1][c][j][k] == 0) continue;
					for (int nc = 0; nc < 3; nc++) {
						int RGB[3];
						RGB[c] = i;
						RGB[(c + 1) % 3] = j;
						RGB[(c + 2) % 3] = k;
						RGB[nc] = i + 1;
						bool ok = 1;
						for(P p:cond[i+1]) {
							int L = p.first.first, R = p.first.second, X = p.second;
							int cnt = 0;
							for (int idx = 0; idx < 3; idx++) if (L <= RGB[idx]) cnt++;
							if (cnt > X || (i + 1 == R && cnt < X)) {
								ok = 0;
								break;
							}
						}
						if (!ok) continue;
						(dp[(i + 1) & 1][nc][RGB[(nc + 1) % 3]][RGB[(nc + 2) % 3]] += dp[i & 1][c][j][k]) %= MOD;
					}
				}
			}
		}
		for (int c = 0; c < 3; c++) for (int j = 0; j < i; j++) for (int k = 0; k < i; k++) dp[i & 1][c][j][k] = 0;
	}
	ll ans = 0;
	for (int c = 0; c < 3; c++) for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) (ans += dp[N & 1][c][i][j]) %= MOD;
	cout << ans << endl;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
int answer = 0;
int counting(string S, string T){
    for(int i = 0; i < 3; i++){
        if(S[i] == T[i])
        answer++;
    }
    return answer;
}
int main(){
string forecast,reality;
cin >> forecast >> reality;
int answer = counting(forecast,reality);
cout << answer << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<ll, int>;



int main(){
    int n; cin >> n;
    ll ans = 0;
    vector<int> c(n+1);
    for(int k = 1; k <= n; k++){
        for(int i = k; i <= n; i += k){
            c[i]++;
        }
    }
    for(int i = 1; i <= n; i++) ans += ll(i) * c[i];
    cout << ans << endl;
}

Measured memory_bytes: 42328
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5 + 5, mod = 1e9 + 7;


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    long double r;
    cin >> r;
    cout << fixed << setprecision(10) << 2.00 * r * 3.14159265359;

    return 0;

}




Measured memory_bytes: 3772
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <string>
#include <map>
#include <iomanip>
using namespace std;
#define REP(i, a, n) for (int i = ((int)a); i < ((int)n); i++)
#define lli long long int

#define MAX 100'000'000
//#define DEBUG

int N;
string S;
int ans = 0;
int inf = 0;
vector<int> B; //W[i]:i文字目より後にある.の数
vector<int> W; //B[i]:i文字目以前にある#の数

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

void read()
{
    cin >> N >> S;
    inf = N * 5;
}

void solve()
{
    //ダミーで.を追加
    S = "." + S;
    //初期化
    W.push_back(0);
    int tmp = 0;
    for (int i = 1; i <= N; i++)
    {
        if (S[i] == '.')
        {
            tmp++;
        }
    }
    B.push_back(tmp);
    //初期化完了
    int w, b;
    for (int i = 1; i <= N; i++)
    {
        w = W[i - 1];
        b = B[i - 1];
        if (S[i] == '#')
        {
            w++;
        }
        else
        {
            b--;
        }
        W.push_back(w);
        B.push_back(b);
    }
    ans = inf;
    for (int i = 0; i <= N; i++)
    {
        if (ans > B[i] + W[i])
        {
            ans = B[i] + W[i];
        }
    }
}
void prAns()
{
#ifdef DEBUG
    cout << "B : ";
    for (auto &&i : B)
    {
        cout << setw(3) << i << setw(1) << ",";
    }
    cout << endl;
    cout << "W : ";
    for (auto &&i : W)
    {
        cout << setw(3) << i << setw(1) << ",";
    }
    cout << endl;
#endif
    cout << ans << endl;
}
int main()
{
#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
#else
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
#endif
    read();
    solve();
    prAns();
    return 0;
}
/* 注意すべき点
グローバル以外の配列は初期化すべし
*/
/*
i (0)12345
S (.)#.##.
B (2)21110
W (0)11233
sum2 32343

i (0)123456789
S (.).........
B (9)876543210
W (0)000000000
sum9 876543210
*/

Measured memory_bytes: 2892
S = input()

Q = int(input())

mode = True
top = []
bottom = []

for i in range(Q):
    q = input().split()
    if len(q)==1:
        q=int(q[0])
        if q==1:
            if mode:
                mode=False
            else:
                mode=True
    else:
        t,f,c = q[0],q[1],q[2]
        if f=="1":
            if mode:
                top.append(c)
            else:
                bottom.append(c)
        else:
            if mode:
                bottom.append(c)
            else:
                top.append(c)

if mode:
    ans = top[::-1] + [S] + bottom
    print("".join(ans))
else:
    ans = bottom[::-1] + [S[::-1]] + top
    print("".join(ans))


Measured memory_bytes: 76376
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        ArrayList<Integer> a = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            a.add(sc.nextInt());
        }
        sc.close();

        int min = 0;
        int max = Collections.max(a);
        int middle = (max - min) / 2;
        while ((max - min) > 1) {
            double x = middle;
            int sum = 0;
            for (int i = 0; i < n; i++) {
                sum += Math.ceil(a.get(i) / x) - 1;
            }
            if (sum <= k) {
                max = middle;
            } else {
                min = middle;
            }
            middle = min + (max - min) / 2;
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 65604
import bisect
n = int(input())
s = sorted(map(int, input().split()))
q = int(input())
t = sorted(map(int, input().split()))

count = 0
for item in t:
    idx = bisect.bisect_left(s, item)
    if idx < n:
        count += s[idx] == item
print(count)



Measured memory_bytes: 16736
#include <iostream>
#include <vector>
#include <string>
using namespace std;
using ll = long long;

int main(){
        ll i,j,N,r=0,g=0,b=0,ans=0,st=1;
        string S;
        cin >> N >> S;
        for(i=0;i<N;++i){
                if(S[i]=='R') ++r;
                if(S[i]=='G') ++g;
                if(S[i]=='B') ++b;
        }
        ans = r*g*b;
        while(1){
                if(st*2>=N) break;
                for(i=0;i+st*2<N;++i){
                        if(S[i]!=S[i+st]&&S[i]!=S[i+st*2]&&S[i+st]!=S[i+st*2]) --ans;
                }
                ++st;
        }
        cout << ans << endl;
        return 0;
}

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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  ll N, M, K; cin >> N >> M >> K;

  for(ll i = 0; i <= N; i++){
    for(ll j = 0; j <= M; j++){
      ll tmp = 0;
      tmp += i * (M-j);
      tmp += j * (N-i);
      if(K==tmp){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include <list>

using namespace std;

int main()
{
	int A, B;

	cin >> A >> B;

	int tmp = std::max(A + B, A - B);
	tmp = std::max(tmp, A*B);

	cout << tmp;


	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int x = stdIn.nextInt();
		
		Outer:while(true) {
			boolean flag = true;
			
			for(int i = 2;i < x;i++) {
				if(x % i == 0) {
					x++;
					flag = false;
					break;
				}
			}
			if(flag)break;
		}
		System.out.println(x);
		
		
		
		
		
		
		
		
	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <cstdlib>

using namespace std;

int main() {
	long long a, b, c, k, ans;
	cin >> a >> b >> c >> k;

	if (k % 2 == 1)
	{
		ans = b - a;
	} else {
		ans = a - b;
	}

	if (abs(ans) > 1E18)
	{
		cout << "Unfair" << endl;
	} else {
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;

typedef long long       ll;
typedef long double     ld;

typedef vector<int>     vi;
typedef vector<bool>    vb;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vll>     vvll;
typedef vector<string>  vs;

typedef pair<int, int>  pii;
typedef pair<ll, int>   pli;
typedef pair<ll, ll>    pll;
typedef vector< pii >   vpi;
typedef vector< pll >   vpll;

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

#define pb           push_back
#define mod          1000000007
#define INF          1e17
#define mini         INT_MIN
#define maxo         INT_MAX
#define eb           emplace_back
#define ff           first
#define ss           second
#define re           return 
#define endl         "\n" 

#define all(c)       c.begin(),c.end()
#define be           begin()
#define en           end()
#define sz(x)        (ll)x.size()
#define mem(a,val)   memset(a,val,sizeof(a))
#define mk(x,y)      make_pair(x,y)
#define mid(s,e)     ((s)+((e)-(s))/2) 

#define fo(i,a,b)     for(ll i = (ll)(a); i <= (ll)(b); i++)
#define rf(i,a,b)    for(ll i = (ll)(a); i >= (ll)(b); i--)
#define read(a,n)    for(int i=0;i<n;i++)cin>>a[i];
#define show(a,n)    for(int i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl;
#define p2(n)        (1LL << (n))
#define deb(x) cout <<#x << " = " << x << " | " << "LINE: "<<__LINE__<< endl;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void add(ll &x, ll y){ x += y; if(x>=mod) x %= mod; if(x<0) x = x%mod + mod; }

//============== *** START OF CODE ***




void solve()
{
    ll n;rd(n);
    ll a[n]; read(a,n);
    ll money = 1000;
    fo(i,1,n-1){
        money += max((a[i]-a[i-1])*(money/a[i-1]),0LL);
    }   
    cout<<money<<endl;    
}


void prep(){}

//=============== *** END OF CODE ***

int main(){
    speedio; cout<<fixed<<setprecision(12);

// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif

    prep();
    int t = 1;
    // cin >> t;
    while(t--)
        solve();

    return 0;
}

Measured memory_bytes: 3612
n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
pen=[0]*n#ペナ数
rig=[0]*n#ACorWA

for i in range(m):
    if ps[i][1]=="AC":
        rig[int(ps[i][0])-1]=1
    else:
        if rig[int(ps[i][0])-1]==0:
            pen[int(ps[i][0])-1]+=1
cnt1,cnt2=0,0
for i in range(n):
    if rig[i]==1:
        cnt1+=rig[i]
        cnt2+=pen[i]
#print(pen)
print(str(cnt1)+" "+str(cnt2))

Measured memory_bytes: 67288
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, M) = Slice2<long>();
            var Ai = Sarray();
            var rui = new long[N + 1];
            var dct = new Dictionary<long, long>();
            dct[0] = 1;
            for (var i = 1; i <= N; ++i)
            {
                rui[i] = (rui[i - 1] + Ai[i - 1]) % M;
                if (!dct.ContainsKey(rui[i])) dct[rui[i]] = 0;
                ++dct[rui[i]];
            }
            var ans = 0L;
            foreach (var kv in dct)
                ans += kv.Value * (kv.Value - 1) / 2;
            WriteLine(ans);
        }


        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 39704
package main

import (
	"fmt"
)

func countStrList(s string) []int {
	list := make([]int, len(s))
	res := 0
	for i := 1; i < len(s); i++ {
		if s[i-1:i+1] == "AC" {
			res++
		}
		list[i] = res
	}
	return list
}

func main() {
	var n, q int
	fmt.Scan(&n, &q)
	var s string
	fmt.Scan(&s)
	countList := countStrList(s)
	for i := 0; i < q; i++ {
		var l, r int
		fmt.Scan(&l, &r)
		fmt.Println(countList[r-1] - countList[l-1])
	}
}


Measured memory_bytes: 6144
"use strict";
main(
  require("fs")
    .readFileSync("/dev/stdin", "UTF-8")
    .trim()
    .split("\n")
);

/**
 *
 * 大きさNの順列。(1, 2, ..., N)を並び替えて出来る順列P, Q
 * 順列はN!通り存在する。
 * Pがa番目に小さく、Qがb番目に小さいとした時、|a-b|を求めよ
 */

function permutation(nums, k) {
  let ans = [];
  if (nums.length < k) {
    return [];
  }
  if (k === 1) {
    for (let i = 0; i < nums.length; i++) {
      ans[i] = [nums[i]];
    }
  } else {
    for (let i = 0; i < nums.length; i++) {
      let parts = nums.slice(0);
      parts.splice(i, 1)[0];
      let row = permutation(parts, k - 1);
      for (let j = 0; j < row.length; j++) {
        ans.push([nums[i]].concat(row[j]));
      }
    }
  }
  return ans;
}

function main(input) {
  const N = Number(input.shift());
  let P = input[0].split(" ");
  let Q = input[1].split(" ");

  const num = permutation(P.slice().sort(), P.length);
  for (let i = 0; i < num.length; i++) {
    if (JSON.stringify(P) === JSON.stringify(num[i])) {
      P = i;
    }
    if (JSON.stringify(Q) === JSON.stringify(num[i])) {
      Q = i;
    }
  }

  console.log(Math.abs(P - Q));
}


Measured memory_bytes: 45468
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int domain(int x, int y){ if(x < 10 && y < 10 && 0 <= x && 0 <= y) return 1; else return 0;}

int main(){
  int i,j,x,y,size,mx,my,res=0,depth=0;
  int map[10][10];
  int dx[] = {0,1,0,-1}, dy[] = {1,0,-1,0};

  memset(map,0,sizeof(map));

  while(scanf("%d,%d,%d\n",&x,&y,&size) != EOF){
    if(size == 1){
      map[x][y]++;
      rep(i,4){
        mx = x + dx[i]; my = y + dy[i];
        if(domain(mx, my)) map[mx][my]++;
      }
    }

    if(size == 2){
      REP(i,-1,2) REP(j,-1,2){
        mx = x + i; my = y + j;
        if(domain(mx, my)) map[mx][my]++;
      }
    }

    if(size == 3){
      REP(i,-1,2) REP(j,-1,2){
        mx = x + i; my = y + j;
        if(domain(mx, my)) map[mx][my]++;
      }
      rep(i,4){
        mx = x + 2*dx[i]; my = y + 2*dy[i];
        if(domain(mx, my)) map[mx][my]++;
      }
    }
  }

  rep(i,10) rep(j,10){
      if(map[i][j] != 0 && depth < map[i][j]) depth = map[i][j];
      if(map[i][j] == 0) res++;
  }

  printf("%d\n%d\n",res,depth);

  return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<ll, ll>;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
struct edge {
  ll to, cost;
};

int main() {
  ll a, b, c, d; cin >> a >> b >> c >> d;
  ll res1 = max(a * c, a * d);
  ll res2 = max(b * c, b * d);
  cout << max(res1, res2) << endl;
}

Measured memory_bytes: 3640
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

//for loop関係
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//略記
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

//定数
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

//Degree <-> Radian
double toRad(double d){ double rad; rad=d*PI/180; return rad; }
double toDegree(double rad){ double d; d=rad*180/PI; return d; }
//The least common multiple : lcm
ll lcm(int a,int b){ return a*b/__gcd(a,b); }
//素数判定
bool isPrime(int n){
    int i; 
    if(n<2) return 0;
    else if(n==2) return 1;
    if(n%2==0) return 0;
    for(i=3;i*i<=n;i+=2) if(n%i==0) return 0;
    return 1;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin  >> n >> m;
    if(n==m) cout << "Yes" ENDL;
    else cout << "No" ENDL;
    
    return 0;
}

Measured memory_bytes: 3572
#include <ctime>
#include <cstdio>
const int Maxn=100000;
int n;
int head[Maxn+5],arrive[Maxn<<1|5],nxt[Maxn<<1|5],tot;
void add_edge(int from,int to){
	arrive[++tot]=to;
	nxt[tot]=head[from];
	head[from]=tot;
}
int deg[Maxn+5];
int root;
int check_dfs(int u,int fa){
	int sum_1=0,sum_2=0;
	for(int i=head[u];i;i=nxt[i]){
		int v=arrive[i];
		if(v==fa){
			continue;
		}
		int tmp=check_dfs(v,u);
		if(tmp==1){
			return 1;
		}
		if(tmp==2){
			sum_1++;
		}
		if(tmp==3){
			sum_2++;
		}
	}
	if(sum_1>=2){
		return 1;
	}
	if(sum_1==1){
		return 3;
	}
	return 2;
}
int main(){
	clock_t begin=clock(),end;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		add_edge(u,v);
		add_edge(v,u);
		deg[u]++,deg[v]++;
	}
	if(check_dfs(1,0)!=3){
		puts("First");
	}
	else{
		puts("Second");
	}
	return 0;
	int last=0;
	while(1){
		end=clock();
		if((end-begin)*1.0/CLOCKS_PER_SEC>0.9){
			break;
		}
		root=-1;
		for(int i=last+1;i<=n;i++){
			if(deg[i]!=1){
				root=i;
				break;
			}
		}
		if(root==-1){
			break;
		}
		last=root;
		if(check_dfs(root,0)==1){
			puts("First");
			return 0;
		}
	}
	puts("Second");
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  for (int i = 0; i < N; i++) {
    cin >> V.at(i);
  }
  
  vector<int> W(N+1,0);
  W.at(0) = 1;
  int t = 0;
  
  for (int i = 0; i < N; i++) {
    W.at(i+1) = V.at(W.at(i)-1);
    if (W.at(i) == 2) {
      t = 1;
      cout << i << endl;
      break;
    }
  }
  if (t == 0)
    cout << "-1" << endl;
}


Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ar = new int[n];
        int cnt = 0;
        for (int i = 0; i < n; i++) ar[i] = sc.nextInt();
        for (int i = 0; i < n - 2; i++) {
            if (ar[i] < ar[i + 1] && ar[i + 1] < ar[i + 2] || ar[i] > ar[i + 1] && ar[i + 1] > ar[i + 2]) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int a, b, c, k; cin >> a >> b >> c >> k;
    if (a >= k) cout << k << endl;
    else if (a + b >= k){
        cout << a << endl;
    }
    else cout << a - (k-a-b) << endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<math.h>
#include<time.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    int N,D,c;
    scanf("%d%d",&N,&D);
    c=N/(2*D+1);
    if(N%(2*D+1)!=0)
    {
        c++;
    }
    printf("%d",c);
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
  int n,Rt0,Rt1,Rt2,t,max=0,min,gap;
  scanf("%d",&n);
  scanf("%d",&Rt0);
  scanf("%d",&Rt1);
  min = Rt0;
  gap=Rt1-Rt0;
  for(t=2;t<n;t++)
    {
      scanf("%d",&Rt2);
      /*?????????????????´?????????????????±????°?????????´???????????¨??????*/
      if(gap<=0){
	if((Rt2-Rt1)>gap){gap =(Rt2-Rt1);}
      }
      
      /*?????§?????????????±???????*/
      if(Rt2 != Rt1)
 {
   if((Rt2-Rt1)>0 && (Rt1-Rt0)<0 && Rt1<min){
     if(gap<(max-min)){gap = max-min;}
     max=0; min = Rt1;
   }
   else if((Rt2-Rt1)<0 && (Rt1-Rt0)>0 && Rt1>max){max = Rt1;}
   Rt0=Rt1; Rt1=Rt2;
 }
    }
  if((max-min)>gap){gap = max-min;}
  if((Rt2-min)>gap){gap = Rt2-min;}
  printf("%d\n",gap);
  return 0;
}
	

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

K, N = map(int,input().split())

A = list(map(int, input().split()))
ans = 0

for i in range(N-1):
    ans = max(ans,A[i+1]-A[i])
ans = max(ans,A[0]+K-A[-1])
print(K-ans)

Measured memory_bytes: 77388
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[6],k;
	for(int i=1;i<=5;i++)
	{
		cin>>a[i];
	}
	cin>>k;
	for(int i=1;i<=5;i++)
	{
		for(int j=1;j<=5;j++)
		{
			int t=a[i]-a[j];
			if(t>k) 
			{
				cout<<":(";
				return 0;
			}
			
			
		}
	}
	cout<<"Yay!";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define pb push_back
#define pii pair<int,int>
#define SZ(x) (int)x.size()
#define f(x) (x>0?x:-x)
#ifdef __linux__
#define getchar getchar_unlocked
#endif
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int N=100010;
const int inf=0x3f3f3f3f;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifdef ztzshiwo
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
int n,a[N],Min,Max,Minpos,Maxpos;
int main()
{
	int x;
	file();
	read(n);
	Max=-inf,Min=inf;
	For(i,1,n)
	{
		read(x);
		if(chkmin(Min,x))Minpos=i;
		if(chkmax(Max,x))Maxpos=i;
	}
	printf("%d\n",2*n-2);
	if(f(Min)>f(Max))
	{
		For(i,1,n)
			if(i!=Minpos)
				printf("%d %d\n",Minpos,i);
		rFor(i,n,2)printf("%d %d\n",i,i-1);
	}
	else
	{
		For(i,1,n)
			if(i!=Maxpos)
				printf("%d %d\n",Maxpos,i);
		For(i,1,n-1)printf("%d %d\n",i,i+1);
	}
	return 0;
}


Measured memory_bytes: 256
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    ans = 0

    for a in A:
        while a % 2 == 0:
            a //= 2
            ans += 1

    print(ans)

main()


Measured memory_bytes: 6080
a,b,c,x,y = map(int,input().split())

pricemin = a*x + b*y
if x>y:
  for i in range(x+1):
    m = max(y-i,0)
    price = a*(x-i) + b*m + c*2*i
    if price<pricemin:
      pricemin = price
else:
  for i in range(y+1):
    m = max(x-i,0)
    price = a*m + b*(y-i) + c*2*i
    if price<pricemin:
      pricemin = price
print(pricemin)

Measured memory_bytes: 3064
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		execute10_1();
	}

	private static void execute10_2() {

	}

	private static void execute10_1() {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int[] sub = new int[n];
			boolean[] comp = new boolean[n];

			int c = 0;
			int w = 0;

			for (int i = 0; i < m; i++) {
				int p = sc.nextInt() -1;
				String s = sc.next();

				if(comp[p]) continue;
				if ("AC".equals(s)) {
					comp[p]=true;
					c++;
					w+=sub[p];
				} else {
					sub[p]++;
				}
			}

			System.out.println(c + " " + w);

		}
	}
}

Measured memory_bytes: 63188
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            String S = in.next();
            int cntr = 0;
            int cntb = 0;
            for (int i = 0; i < n; i++) {
                if (S.charAt(i) == 'R') cntr++;
                if (S.charAt(i) == 'B') cntb++;
            }
            out.println(cntr > cntb ? "Yes" : "No");

        }

    }
}



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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

long long INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	ll h,a; cin >> h >> a;
	ll ans = h/a;
	if(h%a)ans++;
	cout << ans << endl;
}	


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

using namespace std ;

#define IOS ios::sync_with_stdio(0); cin.tie(0), cout.tie(0)
#define ll long long int 

#define fr first
#define se second

#define all(v) v.begin(),v.end() 
#define rall(v) v.rbegin(),v.rend()
#define sz(v) v.size() 

#define pb push_back
#define mp make_pair 

#define PI 3.141592653589793238



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


//bool valid(int x, int y){return x > 0 && x < n && y > 0 && y < m;}

set<int>s;

int foo(int x){
  if(s.count(x))
    return 0;
  s.insert(x);
  if(x&1)
    return 1 + foo(3*x+1);
  return 1 + foo(x/2);
}
int n;
int main(){
  cin >> n;
  cout << foo(n)+1;
  return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S,T;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S>>T;
	for(i=0;i<S.size();i++) {
		if(S.substr(i)+S.substr(0,i)==T) return _P("Yes\n");
	}
	_P("No\n");
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N = ri()
D, X = ri_()
A = [ri() for _ in range(N)]
E = [(D - 1) // i + 1 for i in A]
print(sum(E) + X)

Measured memory_bytes: 63340
//https://abc048.contest.atcoder.jp/tasks/abc045_b
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var a = input[0];
	var b = input[1];
    var c = input[2];
    a=a.charAt(0);
    b=b.charAt(0);
    c=c.charAt(0);
 
	//出力
    console.log(a+b+c);
    

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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


void solve(long long A, long long B){
    if(A<10 && B<10) cout << A*B << endl;
    else cout << -1 << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define Lson L, mid, rt<<1
#define Rson mid+1, R, rt<<1|1
const int maxn=2e3+10;
using namespace std;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}
int n,m,k,t,a[maxn];
ll ans[maxn][maxn],mi;
int main()
{
    int i,j;
    mi=1e19;
    scanf("%d%d",&n,&m);
    rep(i,0,n-1)scanf("%d",&a[i]);
    rep(i,0,n-1)
    {
        ans[i][0]=a[i];
        for(j=1;j<=n-1;j++)
        {
            ans[i][j]=min(ans[i][j-1],(ll)a[(i-j+n)%n]);
        }
    }
    rep(i,0,n-1)
    {
        ll now=0;
        rep(j,0,n-1)now+=ans[j][i];
        mi=min(mi,now+(ll)i*m);
    }
    printf("%lld\n",mi);
    //system("Pause");
    return 0;
}


Measured memory_bytes: 31616
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int N;
	std::vector<int> A;
	std::cin >> N;
	A.resize(N-1);
	for (auto& a : A)
		std::cin >> a;

	std::vector<int> bukas;
	bukas.resize(N+1);
	for (auto& a : A)
		++bukas[a];
	
	for (int i = 1; i <= N; ++i)
		std::cout << bukas[i] << "\n";
}


Measured memory_bytes: 4848
#include <stdio.h>
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 100000 + 1;
const int inf = (int)1e8 + 1;
const ll big = (ll)1e18 + 1;
const int P = 31;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MAX_INT = (1 << 31) - 1;
const double eps = 1e-6;
const double pi = atan2(0, -1);

/*void print(vector<auto> &a)
{
    for (auto i : a)
        cout << i << " ";
    cout << endl;
}*/

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("calc.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    ll n, m;
    cin >> n >> m;
    ll l = 0, r = 1000000000000000000, mid;
    while (r - l > 1)
    {
        mid = (l + r) / 2;
        bool ok = true;
        if (mid * 2 > m)
            ok = false;
        else if (mid > n + (m - mid * 2) / 2)
            ok = false;
        if (ok)
            l = mid;
        else
            r = mid;
    }
    cout << l << endl;
    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();
        int k=sc.nextInt();
        int[] w=new int[n];
        int max=0;
        int acc=0;
        for (int i=0;i<n;i++) {
            w[i]=sc.nextInt();
            acc+=w[i];
            max=Math.max(max,w[i]);
        }
        int left=max;
        int right=acc;
        while(left<right){
            int p=(left+right)/2;
            int id=0;
            int sum=0;
            for (int i=0;i<n;i++){
                if(sum+w[i]>p){
                    sum=w[i];
                    id++;
                }else{
                    sum+=w[i];
                }
                if(id==k){
                    break;
                }
            }
            if(id==k){
                left = p+1;
            }else{
                right = p;
            }
        }
        System.out.println(left);
    }
}


Measured memory_bytes: 70260
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;

int main() {
  int n,m,q;
  ll res;
  vector<ll> v;
  while(true) {
    cin >> n >> m;
    if(n == 0) break;
    v.clear();
    res = 0;
    for(int i = 0; i < n; i++){
      cin >> q;
      v.push_back(q);
    }
    sort(v.begin(), v.end(), greater<int>());
    for(int i=0; i < n; i++) {
      if(i % m != m - 1)
        res += v[i];
    }
    cout << res << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1228
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

constexpr static int MAXN = 1e6;

vector <int> calc(const string& s) {
    int n = s.size();
    vector <int> p(n + 1);
    for (int i = 0; i < n; i++) {
        // 0 + A => A
        // A + A => B
        // B + A => 0
        int add = (s[i] == 'A' ? 1 : 2);
        p[i + 1] = (p[i] + add) % 3;
    }
    return p;
}

int main() {
    string s, t;
    cin >> s >> t;
    auto ps = calc(s);
    auto pt = calc(t);

    int q;
    cin >> q;
    while (q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        int vs = (ps[b] - ps[a - 1] + 3) % 3;
        int vt = (pt[d] - pt[c - 1] + 3) % 3;
        cout << (vs == vt ? "YES" : "NO") << '\n';
    }
    cout << flush;
}


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

int main()
{
    int num;
    cin >> num;
    int box[110];
    for(int i=1;i<num;i++){
        cin >> box[i];
    }
    int ans = 0;
    ans += box[1];
    for(int i=2;i<num;i++){
        ans += min(box[i],box[i-1]);
    }
    ans += box[num-1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    long long n;
    cin >> n;
    if (n % 2 || n < 10)
        return cout << 0, 0;
    long long pow = 5;
    long long ans = 0;
    while (pow <= n) {
        ans += n / (2 * pow);
        pow *= 5;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
const int MOD=1e9+7;

int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    if (ll(4*a*b)<ll((c-a-b)*(c-a-b)) && c-a-b>0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
	{
		cout<<"Yes\n";
		return 0;
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split())) + [0]

dp0, dp1, dp2 = [0] * (N + 1), [0] * (N + 1), [0] * (N + 1)
dp0[0] = A[0]
dp1[1] = A[1]
dp2[2] = A[2]

for i in range(N - 3):
    dp0[i + 2] = 0 if i % 2 else dp0[i] + A[i + 2]
    dp1[i + 3] = max(dp0[i], dp1[i + 1]) + A[i + 3]
    dp2[i + 4] = max(dp0[i], dp1[i + 1], dp2[i + 2]) + A[i + 4]

if N % 2:
    print(max(dp0[N - 3], dp1[N - 2], dp2[N - 1]))
else:
    print(max(dp0[N - 2], dp1[N - 1]))


Measured memory_bytes: 45268
import java.util.*;
import java.io.PrintWriter;
import java.math.*;
public class Main{
	static long mod=1000000007;
	static long[] fact;
	static long[] inv;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int h=sc.nextInt();
		int w=sc.nextInt();
		fact=new long[h+w+1];
		fact[1]=1;
		for(int i=2; i<=h+w; i++){
			fact[i]=(fact[i-1]*i)%mod;
		}
		inv=new long[h+w+1];
		inv[h+w]=pow(fact[h+w],mod-2);
		for(int i=h+w-1; i>=0; i--){
			inv[i]=(inv[i+1]*(i+1))%mod;
		}
		long ans=comb(h+w-2,h-1);
		int n=sc.nextInt();
		int[][] dp=new int[n][3];
		for(int i=0; i<n; i++){
			int r=sc.nextInt()-1;
			int c=sc.nextInt()-1;
			dp[i][0]=(int)comb(r+c,r);
			dp[i][1]=r;
			dp[i][2]=c;
		}
		Arrays.sort(dp,(x,y)->(x[1]+x[2]-y[1]-y[2]));
		for(int i=0; i<n; i++){
			long ii=dp[i][0];
			for(int j=0; j<i; j++){
				if(dp[i][1]>=dp[j][1] && dp[i][2]>=dp[j][2]){
					long tmp=(dp[j][0]*comb(dp[i][1]+dp[i][2]-dp[j][1]-dp[j][2],dp[i][1]-dp[j][1]))%mod;
					ii=(ii-tmp+mod)%mod;
				}
			}
			dp[i][0]=(int)ii;
			ii=(ii*comb(h+w-dp[i][1]-dp[i][2]-2,h-dp[i][1]-1))%mod;
			
			ans=(ans-ii+mod)%mod;
		}
		System.out.println(ans);
	}
	static long comb(int t,int y){
		long re=1;
		re*=fact[t];
		re*=inv[y];
		re%=mod;
		re*=inv[t-y];
		return re%mod;
	}
	
	static long pow(long p,long q){
		long res=1;
		while(q>0){
			if((q & 1)==1){
				res*=p;
				res%=mod;
			}
			q>>=1;
			p*=p;
			p%=mod;
		}
		return res;
	}
}


Measured memory_bytes: 37756
#include<iostream>
#include<cmath>
using namespace std;
int fl(double v){
    double y=v*v/19.6;
    return 1+(int)(y+5)/5;
}
int main(){
    double v;
    while(cin>>v){
        cout<<fl(v)<<endl;
    }
    return 0;
}


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

using namespace std;


int main()
{
    int n;
    scanf("%d", &n);
    multiset<int> available;
    for(int i=0; i<n; i++)
    {
        int x;
        scanf("%d", &x);
        available.insert(x);
    }
    int m;
    scanf("%d", &m);
    vector<int> wanted(m);
    for(int i=0; i<m; i++) scanf("%d", &wanted[i]);
    bool possible=true;
    for(int num : wanted)
    {
        if(available.count(num)==0)
        {
            possible=false;
            break;
        }
        available.erase(available.find(num));
    }
    if(possible)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;
}


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  int l;
  l=max(a,b);
  l=max(l,c);
  
  int count;
  count = 3*l-a-b-c;
  
  if(count%2==1) cout << count/2+2;
  else cout << count/2;
  
  return 0;
  
}


Measured memory_bytes: 256
#!/usr/bin/env python3
#dp5 #Knapsack 2
#個数制限ありナップサック
#1≤W≤10**9
import sys
def LI(): return list(map(int, sys.stdin.readline().split()))
def LIR(n): return [LI() for _ in range(n)]
def e():
    n,W = LI()
    wv = LIR(n)

    #横:価値　縦:品物
    dp = [[float("inf") for _ in range(10**5+1)] for _ in range(n+1)]
    dp[0][0] = 0
    for i in range(1,n+1):
        for j in range(10**5+1):
            #i番目の品物の価値より価値の制限が小さいとき(i番目の品物が使えないとき)
            if j < wv[i-1][1]:
                #i-1番目の品物の重さと同じ
                dp[i][j] = dp[i-1][j]
            else:
                #i番目の品物を使い、重さを追加する場合と使わない場合の重さを比較
                dp[i][j] = min(dp[i-1][j],dp[i-1][j - wv[i-1][1]] + wv[i-1][0])
    ans = 0
    #重さWまでの価値最大値
    for i in range(10**5+1):
        if dp[n][i] <= W:
            ans = i
    print(ans)
if __name__ == '__main__':
    e()


Measured memory_bytes: 313492
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}
int32_t main()
{
	string s;
	cin >> s;
	if(s[1]=='B')
	cout << "ARC";
	else
	cout << "ABC";
}


Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
using namespace std;

int INF = 1e9 + 7;

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

int main() {
	int a, b, c, d;
	cin >> a;

	d = a % 10;
	c = (a / 10) % 10;
	b = (a / 100) % 10;
	a = (a / 1000) % 10;

	char op[4];
	int sum1= 0, sum2 = 0, sum3 = 0;
	for (int i = -b;  sum1 <= 1; i += 2 * b) {
		sum1++;
		for (int j = -c; sum2 <= 1; j += 2 * c) {
			sum2++;
			for (int k = -d; sum3 <= 1; k += 2 * d) {
				sum3++;
				if (a + i + j + k == 7) {
					if (i > 0) {
						op[1] = '+';
					}
					else {
						op[1] = '-';
						i = -i;
					}
					if (j > 0) {
						op[2] = '+';
					}
					else {
						op[2] = '-';
						j = -j;
					}
					if (k > 0) {
						op[3] = '+';
					}
					else {
						op[3] = '-';
						k = -k;
					}

					cout << a << op[1] << i << op[2] << j << op[3] << k << '=' << 7 << endl;
					return 0;
				}
			}
			sum3 = 0;
		}
		sum2 = 0;
	}
}

Measured memory_bytes: 256
N = int(input())
a_list = list(map(int,input().split()))
it = iter(a_list)

alice = list()
bob   = list()

for i in range(int(len(a_list)+1/2)):
	try:
		alice.append(max(a_list))
		a_list.remove(max(a_list))
		bob.append(max(a_list))
		a_list.remove(max(a_list))
	except ValueError:
		break

print(sum(alice)-sum(bob))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int N, A;
  cin >> N >> A;
  if ((N % 500) <= A || N / 500 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

#define ABS(N) ((N<0)?(-N):(N))

int main(int argc, char const *argv[])
{
  int min = 1000;
  int max = 0;
  int buf;
  for (int i = 0; i < 3; ++i)
  {
    cin  >> buf;
    if (max < buf)
      max = buf;
    if (min > buf)
      min = buf;
  }

  cout << (max-min) << endl;

  return 0;
}


Measured memory_bytes: 256