akhauriyash/Code-Regression huggingface dataset:
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.lang.*;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();

        if (a == 0)
            System.out.println("1");
        else if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else if (e == 0)
            System.out.println("5");


    }
}


Measured memory_bytes: 35692
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int N,i;cin>>N>>i;
    cout<<N-i+1<<endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;


	vector<pair<int, int> > es;

	for (int i = 1; i < N; i++) {
		es.emplace_back(0, i);
	}
	int z = ((N - 1) * (N - 2)) / 2;
	if (K > z) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = 1; i < N; i++) {
		if (z == K)break;

		for (int j = i + 1; j < N; j++) {
			z--;
			es.emplace_back(i, j);
			if (z == K)break;
		}
		
	}



	cout << es.size() << endl;
	for (int i = 0; i < es.size(); i++) {
		cout << es[i].first + 1 << " " << es[i].second + 1 << endl;
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll x;
  cin >> x;

  if (x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

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

bool isPrime(int n){
    int i = 3;

    if(n==2){
        return true;
    }
    else if(n<2 || n%2 == 0){
        return false;
    }
    else{
        while(i*i < n){
            if(n%i==0){
                return false;
            }
            i = i+2;
        }
        return true;
    }
}

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述

int X;

cin >> X;

FOR(i,X,2*X+1){
    if(isPrime(i)){
        cout << i << "\n";
        return 0;
    }
}

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

int main(){
  int n; cin >>n;
  vector<int>cnt(100000,0); ll sum=0;
  for(int i=0; i<n; i++){
    int x; cin >>x;
    cnt[x-1]++; sum+=x;
  }
  int q; cin >>q;
  for(int i=0; i<q; i++){
    int b,c; cin >>b >>c;
    if(cnt[b-1]){
      sum+=(c-b)*cnt[b-1];
      cnt[c-1]+=cnt[b-1]; cnt[b-1]=0;
    }
    cout <<sum<<endl;
  }
return 0;}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(n) for (int i = 0; i < n; i++)
#define fo(i, x, n) for (int i = x; i < n; i++)
#define fb(i, x, n) for (int i = n - 1; i >= x; i--)
#define w(t)  \
    int t;    \
    cin >> t; \
    while (t--)

typedef unsigned long long ull;
typedef vector<long long> vi;
#define msi map<string, long long>
#define mii map<long long, long long>
const int MX = 2e5 + 5;
const int INF = 1e18;
#define pb push_back
//#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define all(x) x.begin(), x.end()
#define ff first
#define ss second

void print(int a[], int n)
{
    for (int i = 0; i < n; i++)
    {
        cout << a[i] << " ";
    }
    cout << endl;
}

void print(vi &v)
{
    f(v.size())
    {
        cout << v[i] << " ";
    }
    cout << endl;
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin>>n;
    vi v;

        for(int j=1;j*j<=n;j++)
        {
            if(n%j)
            {
                v.pb(n/j);
            }
            else{
                v.pb((n/j)-1);
            }

        }
        fo(i,1,v.size())
        {
            v[i]-=i;
        }
        //print(v);
        int s=accumulate(all(v),0);
        double x=sqrt(n);
        int y;
        if(x==(int)x)
        {
            y=x-1;
        }
        else
        {
            y=x;
        }
        //cout<<x<<endl;
        cout<<s*2-y<<endl;



    cerr<< "Time Killed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 3756
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>


using namespace std;

const int MaxN = 1e5 + 5;

long long dp[MaxN];
long long w[105] , W , n;
long long v[MaxN];

int main(){
	memset(dp , 0x3f , sizeof dp);
	cin >> n >> W;
	for(int i = 1; i <= n ; i++){
		cin >> w[i] >> v[i];
	}
	dp[0] = 0;
	for(int i = 1; i <= n ; i++){
		for(int j = MaxN - 1 ; j >= v[i] ; j--){
			dp[j] = min(dp[j],dp[j - v[i]] + w[i]);
		}
	}
	for(int i = MaxN - 1 ; i >= 0 ; i--){
		if(dp[i] <= W){
			printf("%d\n",i);
			break;
		}
	}
	return 0;
}

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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

using ll = long long;
const ll INF = 1e18;
ll f2(ll H, ll W, ll h3, ll w3) {
    ll h1 = H / 2;
    ll h2 = H - h1;
    ll w1 = W;
    ll w2 = W;
    ll s1 = h1 * w1;
    ll s2 = h2 * w2;
    ll s3 = h3 * w3;
    return max({s1, s2, s3}) - min({s1, s2, s3});
}
ll f(ll H, ll W) {
    ll ans = INF;
    vector<ll> ans2[3];
    rep(i, H + 1) if (i) {
        // rep(j, W + 1) if (j) {
        //     vector<ll> w(3), h(3), s(3);
        //     h[0] = i;
        //     w[0] = W;
        //     h[1] = H - h[0];
        //     w[1] = j;
        //     h[2] = H - h[0];
        //     w[2] = W - w[1];
        //     rep(i, 3) s[i] = h[i] * w[i];
        //     ll t = *max_element(all(s)) - *min_element(all(s));
        //     if (t < ans) {
        //         ans2[0] = h;
        //         ans2[1] = w;
        //         ans2[2] = s;
        //     }
        //     // ans = min(ans, t);
        // }
        ll h3 = H - i;
        ll w3 = W;
        ll t1 = f2(i, W, h3, w3);
        ll t2 = f2(W, i, h3, w3);
        ans = min({ans, t1, t2});
    }
    // cout << ans << endl;
    // rep(i, 3) {
    //     rep(j, 3) cout << ans2[j][i] << " ";
    //     cout << endl;
    // }
    return ans;
}
int main() {
    ll H, W;
    cin >> H >> W;
    if (H % 3 == 0 || W % 3 == 0) {
        cout << "0" << endl;
        return 0;
    }
    ll ans = f(H, W);
    ans = min(ans, f(W, H));
    cout << ans << endl;

    return 0;
}


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

int main() {
    int N, M; cin >> N >> M;
    vector<pair<int, int>> list;
    vector<vector<int>> p(N + 1);
    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b;
        p[a].push_back(b);
        list.push_back({a, b});
    }
    for (int i = 0; i < N + 1; i++) {
        if (p[i].size()) {
            sort(p[i].begin(), p[i].end());
        }
    }
    for (auto x : list) {
        int a = x.first, b = x.second;
        auto it = lower_bound(p[a].begin(), p[a].end(), b);
        int order = (it - p[a].begin()) + 1;
        printf("%06d%06d\n", a, order);
    }
}


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

public class Main{
  public static void main(String args[]) throws IOException
  {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int a = Integer.parseInt(br.readLine());
    String string = br.readLine();
    
    if(a>=3200)
    {
      System.out.println(string);
    }
    else
    {
      System.out.println("red");
    }
  }
}
  


Measured memory_bytes: 22996
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 1e6 + 1;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s, t;
	cin >> s >> t;
	cout << t + s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,L;
  cin >>N>>L;
  int futaberu=-500;
  for(int i=1;i<=N;i++){
    if(L+i-1<0){
      futaberu=max(futaberu,L+i-1);
    }
  }
  int seitaberu=500;
  for(int i=1;i<=N;i++){
    if(L+i-1>=0){
      seitaberu=min(seitaberu,L+i-1);
    }
  }
  if(seitaberu<=-1*futaberu){
    cout<< N*(L-1)+N*(N+1)/2-seitaberu <<endl;
  }
  if(seitaberu>-1*futaberu){
    cout <<N*(L-1)+N*(N+1)/2-futaberu <<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n>=1){
        if(n%10==9){
            cout<<"Yes"<<endl;
            return 0;
        }
        n/=10;
    }
    cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

#define int long long

int a[3];
int ans;

int32_t main() {
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    ans = 2 * a[2] - a[1] - a[0];
    return cout << (ans % 2 ? ans / 2 + 2 : ans / 2), 0;
}

Measured memory_bytes: 256
import sys


def main():
    while True:
        H, W = [int(i) for i in sys.stdin.readline().split()]
        if H == 0 and W == 0:
            break
        top_bottom_line = '#'
        insider_line = '#'
        for i in range(W - 1):
            top_bottom_line += '#'
        for i in range(W - 2):
            insider_line += '.'
        insider_line += '#'
        print(top_bottom_line)
        for i in range(H - 2):
            print(insider_line)
        print(top_bottom_line)
        print()
    return


if __name__ == '__main__':
    main()



Measured memory_bytes: 5624
// atcoder/keyence2020/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  int n, k, s;
  while (cin >> n >> k >> s) {
    for (int i = 0; i < k; ++i) {
      cout << s << ' ';
    }
    if (s == 1) s = 2;
    else --s;
    for (int i = k; i < n; ++i) {
      cout << s << ' ';
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 1280
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)

int main(){
    int n;
    cin >> n;
    
    int t_cnt = 0, f_cnt = 0, o_cnt = 0, tmp;
    REP(i, n){
        cin >> tmp;
        if(!(tmp % 4)) f_cnt += 1;
        else if(!(tmp % 2)) t_cnt += 1;
        else o_cnt += 1;
    }
    bool f = false;
    if(t_cnt){
        t_cnt %= 2;
        if(o_cnt + t_cnt <= f_cnt + 1) f = true;
    }else if(o_cnt <= f_cnt + 1) f = true;

    if(f) cout << "Yes" << endl;
    else cout << "No" << endl; 

    return 0;
}

Measured memory_bytes: 384
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	x1, y1 := getInt(), getInt()
	x2, y2 := getInt(), getInt()

	dx := x2 - x1
	dy := y2 - y1

	dx, dy = -dy, dx
	x3, y3 := x2+dx, y2+dy

	dx, dy = -dy, dx
	x4, y4 := x3+dx, y3+dy
	out(x3, y3, x4, y4)

}


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

int main()
{
    int N;
    cin >> N;
    vector<int> ret(N + 1);
    for (int i = 2; i <= N; i++)
    {
        int a;
        cin >> a;
        ret[a]++;
    }
    for (int i = 1; i <= N; i++)
    {
        cout << ret[i] << '\n';
    }
}


Measured memory_bytes: 4048
#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

int main()
{
    int a,b,k;
    set<int> st;
    cin>>a>>b>>k;
    for(int i=a; i<=min(b,a+k-1); i++)
    {
        st.insert(i);
    }
    for(int i=b; i>=max(a,b-k+1); i--)
    {
        st.insert(i);
    }
    for(auto it:st)
    {
        cout<<it<<"\n";
    }

    return 0;

}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint n;cin >> n;
    vector<lint> v(2*n);
    REP(i, 2*n) { cin >> v[i]; }
    lint ans=0;
    sort(ALL(v));
    REP(i,n){
        ans += v[2 * i];
    }

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
l = [[] for i in range(n)]
ab.sort()
for i in range(m):
    x = ab[i]
    l[x[0]-1].append(x[1]-1)
    l[x[1]-1].append(x[0]-1)
for i in l[0]:
    if n-1 in l[i]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

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

int main(){
    int n, a, b, h;
    scanf("%d %d %d", &n, &a, &b);
    vector<int> vec;
    rep(_, n){
        scanf("%d", &h);
        vec.push_back(h);
    }
    ll l = 0, r = 1e+9 + 1, m;
    while(l+1 < r){
        m = (l + r) / 2;
        ll rest = 0;
        rep(i, vec.size()){
            if(vec[i] > b * m){
                rest += (vec[i] - b * m) / (a - b);
                rest += (vec[i] - b * m) % (a - b) > 0;
            }
        }
        if(rest > m) l = m;
        else r = m;
    }
    printf("%lld\n", r);
    return 0;
}

Measured memory_bytes: 892
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
import java.util.TreeMap;

//@Slf4j
public class Main {
  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    // TODO 自動生成されたメソッド・スタブ
    int n = sc.nextInt();
    // System.out.println(first);
    TreeMap<Integer, TreeMap<String, Integer>> stringMapMap = new TreeMap<>();
    for (int i = 0; i < n; i++) {
      TreeMap<String, Integer> stringMap = createStringTreeMap();
      stringMapMap.put(i, stringMap);
    }
//    log.info("finish reading");
    HashMap<String, List<Integer>> strListMap = new HashMap<>();
    for (TreeMap<String, Integer> stringMap : stringMapMap.values()) {
      for (String s : stringMap.keySet()) {
        if (strListMap.get(s) == null) {
          List<Integer> strList = new ArrayList<>();
          strList.add(stringMap.get(s));
          strListMap.put(s, strList);
        } else {
          strListMap.get(s).add(stringMap.get(s));
        }
      }
    } ;
    strListMap.entrySet().stream().filter((entry) -> entry.getValue().size() == n)
        .forEach(entry -> {
//          System.out.println(entry.getKey() + " : " + Collections.min(entry.getValue()));

          int repeatNum = Collections.min(entry.getValue());
           for(int i = 0; i < repeatNum ; i++) {
             System.out.print(entry.getKey());
           }
        });
    // stringMapMap.entrySet().stream().



  }

  private static TreeMap<String, Integer> createStringTreeMap() {
    TreeMap<String, Integer> stringMap = new TreeMap<>();

    String Si = sc.next();
    for (char c : Si.toLowerCase().toCharArray()) {
      String s = String.valueOf(c);
      if (stringMap.containsKey(s)) {
        stringMap.put(s, stringMap.get(s) + 1);
      } else {
        stringMap.put(s, 1);

      }
    }
    return stringMap;
  }

}


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

// Macros
#define F  first
#define S  second
#define PB push_back

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// HELPERS
//  Tedious Grid Movements
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
inline bool move_okay(int x, int y, int n, int m) { return 0 <= x and x < n and 0 <= y and y < m; }
//  Remember:
//   * vec.assign() GOOD; vec.resize() BAD
//   * comparator uses <

// Output, Common Containers
template <typename T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const set<T> &v)    { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const pair<T,S> &v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const map<T,S> &v)  { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef SANYAM1101
	#define trace(args...) do{ cerr << "TRACE ON! (Line: " << __LINE__ << ")\n"; auto _stream = istringstream{string{#args}}; d_f(_stream, args); } while(0)
	void d_f(__attribute__((unused)) istringstream& _stream) {}
	template<typename Head, typename... Tails> void d_f(istringstream& _stream, Head H, Tails... T) { string _name; _stream >> _name; if(_name.back() == ',') _name.pop_back(); cerr << "\t" << _name << " <=> [" << H << "]\n"; d_f(_stream, T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

void solve(){
	ll n;
	cin >> n;

	ll ans = n - 1;

	for(ll i = 2; i * i <= n; ++i){
		if(n % i == 0){
			ll dist = i - 1 + (n / i) - 1;
			ans = min(ans, dist);
		}
	}

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

signed main (void){
	// Fast_IO
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(v) v.begin(), v.end()
//#define mod 1000000007
#define mod2 1000000006
#define inf 1000000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<lli>
#define vii vector<int>
#define is indexed_set
#define eps 0.000001
#define endl '\n'
#define mo 998244353
#define pi 3.141592653589793
#define fi first
#define se second
using namespace std ;
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
lli m=1000000007;
#define MAXN   1000001 
// stores smallest prime factor for every number 
int spf[MAXN]; 
int ct[MAXN];
// Calculating SPF (Smallest Prime Factor) for every 
// number till MAXN. 
// Time Complexity : O(nloglogn) 
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (int j=i*i; j<MAXN; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
  
// A O(log n) function returning primefactorization 
// by dividing by smallest prime factor at every step 
vector<int> getFactorization(int x) 
{ 
    vector<int> ret; 
    while (x != 1) 
    { 

        ret.push_back(spf[x]);
        lli tem=spf[x]; 
        while(x%tem==0)
        x = x / spf[x]; 
    } 
    return ret; 
} 
void solve()
{	
	sieve();
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
		vector<int> tem =getFactorization(a[i]);
		for(auto u:tem){
			ct[u]++;
			//cout<<u<<" ";cout<<endl;
		}
	}
	int x=a[0];
	for(int i=0;i<n;i++)x=__gcd(x,a[i]);
	bool ant=true;
	for(lli i=0;i<MAXN;i++){
		if(ct[i]>1)ant=false;
	}
	//cout<<x<<endl;
	if(x>1){
		cout<<"not coprime";return;
	}
	if(ant)cout<<"pairwise coprime";
	else cout<<"setwise coprime";
}
 
int main()
{
/////////////////////////////////////
    fastio;
    
/////////////////////////////////////  
    lli t,m;
    //cin>>t;
    t=1;
    while(t--)
    {
    	solve();  
    	m++;  
    	cout<<endl;
    }
}

Measured memory_bytes: 15272
#include<bits/stdc++.h>
using namespace std;
void solve();
int main()
{
//	freopen("SNOOKER.inp","r",stdin);
//	freopen("SNOOKER.out","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
}

using ll =  long long;
#define endl "\n"
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define what_is(x)  cerr << #x << " is :" << (x) << endl
#define what_are(x,y) cerr << #x <<" is : " << (x) <<" ; " << #y <<" is: " <<y << endl
#define pii pair<int,int>
#define fi first
#define se second

const int MOD =  1e9+7;
const int inf = INT_MAX;
const int MAX_N = 1e5 + 7;

int n,k;
bool dp[MAX_N];
int a[107];
void solve()
{
	
	fill(dp,dp+MAX_N, false);
	cin >> n >> k;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	
	for(int i = 0; i <= k; i ++)
	{
		if(!dp[i])
			
		for(int j = 1; j <= n; j++)
		{
			dp[min(i + a[j], k + 7)] = true;
				
				
		}
	}
	
	if( dp[k] ) cout <<"First" ;
	else cout << "Second";
}
/*----------------------------------------------------------------------

-----------------------------------------------------------------------*/

Measured memory_bytes: 384
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
// constexpr ll inf = 1ll<<61;
// constexpr ll mod = 1e9+7;

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

  int k = sqrt(2*n)+1;
  if(k*(k-1)!=2*n or (2*n) % k){
    cout << "No\n";
    return 0;
  }
  int s = 2*n/k;
  vvi ans(k);
  int tmp = 1;
  rep(i,s){
    rep(j,k-i-1){
      ans[i].pb(tmp);
      ans[i+j+1].pb(tmp);
      tmp++;
    }
  }

  cout << "Yes\n" << k << endl;
  rep(i,k){
    cout << s << " ";
    rep(j,s){
      if(j)
  	cout << " " << ans[i][j];
      else
  	cout << ans[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 3200
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()
#define dump(x) cout << #x << " = " << (x) << endl

int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;
  int ans = 0;

  rep(i, N) {
    int cur = 0;
    rep(j, N - i) {
      if (S[j] == S[j + i]) {
        ++cur;
        cur = min(cur, i);
        ans = max(cur, ans);
      } else {
        cur = 0;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;

const int N=3e5+5;

int n;
bool pos[N];

int main() {
    scanf("%d\n",&n);
    for (int i=1;i<=n;++i) {
        char ch=getchar();
        pos[i]=(ch=='E');
    }
    int nl=0;
    int nr=0;
    int ans=INT_MAX;
    for (int i=2;i<=n;++i) {
        if (pos[i]==1) {
            ++nr;
        }
    }
    ans=nr;
    for (int i=2;i<=n;++i) {
        if (pos[i-1]==0) {
            ++nl;
        }
        if (pos[i]==1) {
            --nr;
        }
        ans=min(ans,nl+nr);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
N,M = map(int,input().split())
L = [0]*M
R = [0]*M

for i in range(M):
    L[i],R[i] = map(int,input().split())
    
L_max = max(L[k] for k in range(M))
R_min = min(N,min(R[k] for k in range(M)))

if (R_min-L_max) >= 0 : print(R_min-L_max + 1) 
else: print(0)

Measured memory_bytes: 10868
i,j,N,p,P,t[36],c[36],T[36],C[36];
B(){
    for(i=0;i<N;i++)
    for(j=N-1;j>0;j--)
        if(t[j-1]>t[j]){
            t[j]^=t[j-1]^=t[j]^=t[j-1];
            c[j]^=c[j-1]^=c[j]^=c[j-1];
        }
}
S(){
    for(i=0;i<N;i++){
        for(j=p=i;j<N;j++)if(T[j]<T[p])p=j;
        P=T[p];T[p]=T[i];T[i]=P;
        P=C[p];C[p]=C[i];C[i]=P;
    }
}
main(){
    for(scanf("%d",&N);i<N;scanf(" %c%d",&c[i],&t[i]),T[i]=t[i],C[i]=c[i],i++);
    B();S();
    for(i=0;i<N;printf("%c%d%s",c[i],t[i],i==N-1?"\nStable\n":" "),i++);
    for(i=0;i<N;printf("%c%d%s",C[i],T[i],i==N-1?"\n":" "),i++);
    for(i=p=0;i<N;i++)
        if(c[i]==C[i])
            if(t[i]==T[i])
                p++;
            
        
    puts(p==N?"Stable":"Not stable");
}

Measured memory_bytes: 1824
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (b - a == c - b) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n,m;
  scanf("%d%d",&n,&m);
  int *cnt=(int *)calloc(n+1,sizeof(int));
  int i;
  for(i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    cnt[a]++;
    cnt[b]++;
  }
  for(i=1;i<=n;i++){
    if(cnt[i]%2!=0){
      printf("NO\n");
      return;
    }
  }
  printf("YES\n");
  return;
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 512
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache
from numba import jit

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

@jit
def main():
	k, s = LI()
	cnt = 0
	for x in range(k+1):
		for y in range(k+1):
			if 0 <= s - x - y <= k:
				cnt += 1
	print(cnt)


if __name__ == '__main__':
    main()

Measured memory_bytes: 109376
import scala.io.StdIn._
import scala.annotation.tailrec
import scala.collection._

object Main {

  class Sieve(val n: Int){
    private[this] val top = (n - 3) / 2 + 1
    private[this] val (cmpsts, sqrtLmtNdx) = (new Array[Int]((top >>> 5) + 1), (Math.sqrt(n).toInt - 3) / 2)

    private[this] def isCmpst(ci: Int): Boolean = (cmpsts(ci >>> 5) & (1 << (ci & 31))) != 0
    private[this] def setCmpst(ci: Int): Unit = cmpsts(ci >>> 5) |= 1 << (ci & 31)

    @tailrec
    private[this] def cull(cmpstId: Int, p: Int): Unit = {
      if(cmpstId <= top){
        setCmpst(cmpstId)
        cull(cmpstId + p, p)
      }
    }

    @tailrec
    private[this] def get(cndId: Int): Unit = {
      if(cndId <= sqrtLmtNdx){
        if(!isCmpst(cndId)){
          val p = 2 * cndId + 3
          cull((p * p - 3) >>> 1, p)
        }
        get(cndId + 1)
      }
    }

    @tailrec
    private[this] def next(cndId: Int): Int =
      if ((cndId > top) || !isCmpst(cndId)) 2 * cndId + 3 else next(cndId + 1)

    def exec: Iterator[Int] = {
      get(0)
      Iterator.single(2) ++ Iterator.iterate(3)(p => next((p - 1) >>> 1)).takeWhile(_ <= n)
    }
  }

  @tailrec
  def loop(s: String){
    if(s != null){
       val Array(n,_*) = s.split(" ").map(_.toInt)
       if(n<2) println(0)
       else println(new Sieve(n).exec.size)
       loop(readLine)
    }
  }

  def main(args: Array[String]): Unit = loop(readLine)
}

Measured memory_bytes: 65692
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
int main() {
	ll n;
	cin >> n;
	vector<ll>a(n+1);
	vector<ll>b(n);
	ll count = 0;

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

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

	for (int i = 0; i < n; i++){
		if (a[i] + a[i + 1] < b[i]){
			count += a[i] + a[i + 1];
			a[i + 1] = 0;
		}
		else if (a[i] + a[i + 1] >= b[i] && a[i] <= b[i]){
			count += b[i];
			a[i + 1] -= b[i] - a[i];
		}
		else if (a[i] > b[i]){
			count += b[i];
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1792
#include "iostream"
#include "cstdio"
#include "cstring"
#include "string"
#include "climits"
using namespace std;
const int maxn=200000+10;
long long t[maxn];
int n;
long long T;
int main()
{
	cin>>n>>T;
	for(int i=0;i<=n;i++)
		t[i]=LONG_MAX;
	for(int i=0;i<n;i++)
		scanf("%lld",&t[i]);
	int i=0;
	long long ans=0;
	while(i<n){
		int pre=i;
		while(t[i+1]<t[i]+T) i++;
		ans+=t[i]+T-t[pre];
		i++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(int argc, char const* argv[])
{
  int i = getchar();
  char r;
  if ((i > 0) && (i < 0x100)) {
    char c = (char)i;
    switch (c) {
      case 'A':
        r = 'T'; break;
      case 'T':
        r = 'A'; break;
      case 'G':
        r = 'C'; break;
      case 'C':
        r = 'G'; break;
      default:
        r = 0;
    }
    putchar((int)r);
  }
  return 0;
}




Measured memory_bytes: 128
using System;

namespace codefestival_2016_qualA_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            for (int i = 0; i < 4; i++)
            {
                Console.Write(s[i]);
            }
            Console.Write(" ");
            for (int i = 4; i < 12; i++)
            {
                Console.Write(s[i]);
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 2648
#include <stdio.h>

int main(){
	int a,b,x,y,z,max;
	scanf("%d %d",&a,&b);
	x=a+b;
	y=a-b;
	z=a*b;
	if(x>=y) {
		max=x;
	} else {
		max=y;
	}
	if(z>=max) {
		max=z;
	}
	printf("%d\n",max);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
//#define kk
#define int long long
#define FOR(i, n) for(int i=1; i<=n; i++)
#define ff first
#define ss second
#define ll int
#define inf 1000000000
#define pb push_back
#define mod 1000000007
 
const long long INF=1e18+5;
typedef pair<int, int> pi;

int arr[21][21];
int dp[21][1<<21];

int bitmask(int i, int mask, int& n){
	if(i==n) return 1;
	
	if(dp[i][mask]!=-1) return dp[i][mask];
	
	int ans=0;
	for(int k=0; k<n; k++){
		if(arr[i][k] && (mask & (1<<k))) ans=ans%mod+bitmask(i+1, mask ^ (1<<k), n)%mod;
	}
	return dp[i][mask]=ans%mod;
}

void solve(){
	int n;
	cin>>n;
	
	FOR(i, n) FOR(j, n) cin>>arr[i-1][j-1];
	
	memset(dp, -1, sizeof dp);
	
	cout<<bitmask(0, (1<<n)-1, n)<<endl;
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cout<<fixed<<setprecision(10);
	
	#ifdef kk
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	
	int T=1;
	//cin>>T;
	
	while(T--){
		solve();
	}
}


Measured memory_bytes: 347636
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;
typedef vector<P> Pol;
D inf=1e10,eps=1e-10;
int W,N,M[202];
D d[202][202];
Pol pol[202];
void init(){
	rep(i,N+2) pol[i].clear();
	rep(i,N+2) rep(j,N+2) d[i][j]=inf;
	rep(i,N+2) d[i][i]=0;
}
D dot(P a,P b){
	return real(conj(a)*b);
}
P perp(L l,P p){
	D t=dot(p-l.fs,l.fs-l.sc)/norm(l.fs-l.sc);
	return l.fs+t*(l.fs-l.sc);
}
bool iSP(L s,P p){
	D t=abs(s.fs-p)+abs(s.sc-p)-abs(s.fs-s.sc);
	return abs(t)<eps;
}
D dSP(L s,P p){
	P q=perp(s,p);
	return iSP(s,q) ? abs(p-q) : min(abs(p-s.fs),abs(p-s.sc));
}
D dSS(L a,L b){
	return min(min(dSP(a,b.fs),dSP(a,b.sc)),min(dSP(b,a.fs),dSP(b,a.sc)));
}
D dist(int a,int b){
	Pol x=pol[a],y=pol[b];
	D ret=inf;
	rep(i,x.size()){
		L p=L(x[i],x[(i+1)%x.size()]);
		rep(j,y.size()){
			L l=L(y[j],y[(j+1)%y.size()]);
			ret=min(ret,dSS(p,l));
		}
	}
	return ret;
}
int main(){
	while(true){
		cin>>W>>N;
		if(W==0) break;
		init();
		rep(i,N){
			cin>>M[i];
			rep(j,M[i]){
				int x,y;
				cin>>x>>y;
				pol[i].pb(P(x,y));
			}
		}
		pol[N].pb(P(0,0));
		pol[N].pb(P(0,10000));
		pol[N+1].pb(P(W,0));
		pol[N+1].pb(P(W,10000));
		M[N]=2,M[N+1]=2;
		N+=2;
		rep(i,N) rep(j,i){
			d[i][j]=d[j][i]=dist(i,j);
//			show(i);
//			show(j);
//			show(d[i][j]);
		}
		rep(i,N) rep(j,N) rep(k,N) d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
		printf("%.12f\n",d[N-2][N-1]);
	}
}

Measured memory_bytes: 1584
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}
 
typedef pair<ll,ll> Pair;
const ll inf =1000000007;

void bsolve(){
    ll n;
    cin >> n;
    ll ans=0;
    for(ll i=1;i<=n;i++){
        if(i%3!=0 && i%5!=0) ans+=i;
    }
    cout << ans << endl;
}

void asolve(){
    string n;
    cin >> n;
    bool ans=false;
    for(ll i=0;i<3;i++){
        if(n[i]=='7') ans=true;
    }
    if(ans) cout <<"Yes" << endl;
    else cout << "No" << endl;
}

void dsolve(){
    ll n;
    string s;
    cin >> n >> s;
    vector<ll> r,g,b;
    rep(i,n){
        if(s[i]=='R') r.pb(i);
        if(s[i]=='G') g.pb(i);
        if(s[i]=='B') b.pb(i);
    }
}


//繰り返し
ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M);
}


void esolve(){
    ll n,k;
    cin >> n>>k;
    for(ll i=1;i<=k;i++){
        
    }
}



int main(){
    bsolve();
}




Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()



template<const std::size_t N>
struct bfps: public std::bitset<N> {
  using size_type = std::size_t;
  size_type len;

  void recalc() {
    this->len = 0;
    for(i64 j = N; j --> 0;) {
      if((*this)[j]) {
        this->len = j + 1;
        return;
      }
    }
  }

  bfps() : std::bitset<N>() { this->len = 0; }
  //bfps(const std::uint_fast64_t x) : std::bitset<N>(x) { recalc(); }
  bfps(const std::bitset<N>& b) : std::bitset<N>(b) { recalc(); }
  size_type size() const { return this->len; }


  static bfps mod(bfps a, const bfps& b) {
    assert(b.size() > 0);
    for(i64 i = a.size() - b.size() + 1; i --> 0;) {
      if(a[i + b.size() - 1]) {
        a ^= (b << i);
      }
    }
    a.recalc();
    return a;
  }

  static bfps div(bfps a, const bfps& b) {
    assert(b.size() > 0);
    bfps d;
    for(i64 i = a.size() - b.size() + 1; i --> 0;) {
      if(a[i + b.size() - 1]) {
        a ^= (b << i);

        bfps e;
        e[i] = 1;
        d ^= e;
      }
    }
    d.recalc();
    return d;
  }

  static bfps gcd(bfps a, bfps b) {
    while(b.any()) {
      auto m = mod(a, b);
      a = b;
      b = m;
    }
    return a;
  }
};

const int BN = 4000;
using bits = bfps<BN>;

int main() {
  i64 N;
  cin >> N;
  bits X;
  cin >> X;
  X.recalc();

  vector<bits> A(N);
  rep(i,0,N) {
    cin >> A[i];
    A[i].recalc();
  }
  auto G = A[0];
  for(i64 i = 1; i < N; i++) {
    G = bits::gcd(G, A[i]);
  }
  i64 ans = 0;
  const i64 MOD = 998244353;
  if(X.size() - G.size() + 1 >= 0) {
    vector<i64> Bs(X.size() - G.size() + 1, 1);
    for(i64 i = 1; i < X.size() - G.size() + 1; i++) {
      Bs[i] = (Bs[i - 1] * 2) % MOD;
    } 
    bits now;
    for(i64 i = X.size() - G.size() + 1; i --> 0;) {
      if(X[i + G.size() - 1]) {
        ans = (ans + Bs[i]) % MOD;
      }
      if(now[i + G.size() - 1] != X[i + G.size() - 1]) {
        now ^= (G << i);
      }
    }
    bool OK = true;
    for(i64 i = BN; i --> 0; ) {
      if(now[i] != X[i]) {
        if(now[i]) {
          OK = false;
        }
        break;
      }
    }
    if(OK) ans = (ans + 1) % MOD;
  }
  cout << ans << endl;
}


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

using namespace std;



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,h,temp=0,jmp=0,ans=0;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>h;
        //cout<<temp<<" ";
        if(h<=temp)
        {
            jmp++;
        }
        else
        {
            jmp=0;
        }
        temp=h;
        ans=max(ans,jmp);
        //cout<<jmp<<" "<<ans<<" "<<temp<<endl;


    }
    cout<<ans;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

struct BinomialCoefficient  {
    BinomialCoefficient() {
        
    }
    
    BinomialCoefficient(int n) : fac(n + 2), finv(n + 2), inv(n + 2) {
        initialize(n, false);
    }
    
    void initialize(int n, bool resize = true) {
        if (resize) {
            fac.resize(n + 2);
            finv.resize(n + 2);
            inv.resize(n + 2);
        }
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i <= n; 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;
        }
    }
    
    ll factorial(int n) {
        return fac[n];
    }
    
    ll combination(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * (finv[r] * finv[n - r] % mod) % mod;
    }
    
    ll permutation(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * finv[n - r] % mod;
    }
    
private:
    int mod = 1e9 + 7;
    vector<ll> fac, finv, inv;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x, y;
    cin >> x >> y;
    ll ab = (x + y) / 3;
    ll a = 2 * ab - x;
    ll b = 2 * ab - y;
    if (((a + 2 * b) != x) || ((2 * a + b) != y)) {
        cout << 0 << endl;
        return 0;
    }
    if ((a < 0) || (b < 0)) {
        cout << 0 << endl;
        return 0;
    }
    BinomialCoefficient bc(a + b);
    cout << (bc.combination(a + b, a)) << endl;
    return 0;
}

Measured memory_bytes: 16000