akhauriyash/Code-Regression huggingface dataset:
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include "bits/stdc++.h"
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

ll n;
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    if (n % 2) cout << 0;
    else {
        n /= 2;
        ll res = 0;
        while (n) {
            res += n / 5;
            n /= 5;
        }
        cout << res;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int a,b,c,d;
	cin>>d;
	for(int i=0;i<d;i++){
		cin>>a>>b>>c;
		if(a*a+b*b==c*c or b*b+c*c==a*a or c*c+a*a==b*b){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

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

using namespace std;

#ifdef ACMTUYO
struct RTC{~RTC(){cerr << "Time: " << clock() * 1.0 / CLOCKS_PER_SEC <<" seconds\n";}} runtimecount;
#define DBG(X) cerr << #X << " = " << X << '\n';
#else
struct RTC{};
#define DBG(X)
#endif

#define fast_io() ios_base::sync_with_stdio(false)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define sz(x) ((int)(x).size())
#define all(c) (c).begin(),(c).end()
#define forn(i, n) for (int i = 0; i < (n); i++)
typedef long long int number;
const int maxn = 200010;
struct union_find {
  vector<int> p;
  void init(int n) {p.assign(n, -1);}
  int find (int x) {
    int y = x, z;
    while (p[y] >= 0) y = p[y];
    while (x != y) z = p[x], p[x] = y, x = z;
    return x;
  }
  void merge (int x, int y) {
    x=find(x), y=find(y);
    if (x!=y) p[x]+=p[y], p[y]=x;
  }
  int size_group(int x) {return -p[find(x)];}
} uf;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  uf.init(n);
  while (m--) {
    int a, b;
    scanf("%d %d", &a, &b);
    uf.merge(a - 1, b - 1);
  }
  int ans = 0;
  forn (i, n) {
    ans = max(ans, uf.size_group(i));
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 4080
#include <atcoder/all>
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

using mint = atcoder::modint998244353;

struct S {
    mint a;
    int size;
};
struct F {
    mint a, b;
};

S op(S l, S r) { return S{l.a + r.a, l.size + r.size}; }
S e() { return S{0, 0}; }
S mapping(F l, S r) { return S{r.a * l.a + r.size * l.b, r.size}; }
F composition(F l, F r) { return F{r.a * l.a, r.b * l.a + l.b}; }
F id() { return F{1, 0}; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n, q;
    cin >> n >> q;
    vector<S> a(n);
    rep(i, n) {
        int x;
        cin >> x;
        a[i] = S{x, 1};
    }

    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);

    int t, l, r, b, c;
    while(q--) {
        cin >> t;
        if(t == 0) {
            cin >> l >> r >> b >> c;
            seg.apply(l, r, F{b, c});
        } else {
            cin >> l >> r;
            cout << seg.prod(l, r).a.val() << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 19280
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int a,b;
	cin >> a >> b;
	int m = a + b;
	m = max(m,a-b);
	m = max(m,a*b);
	cout << m << endl;
	return 0;
}


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

using namespace std;

int MAX = 9;

vector <int> v;

int main() {
	int n;
	
	while (cin>>n) {
		int ans = 0;
		for (int i=0; i<=9; i++) {
			for (int j=0; j<=9; j++) {
				for (int k=0; k<=9; k++) {
					for (int l=0; l<=9; l++) {
						if (i+j+k+l==n) ans++;
					}
				}
			}
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
import itertools
n = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
cnt = 0
a = -1
b = -1
for per in itertools.permutations(range(1,n+1)):
  cnt += 1
  if list(per) == P:
    a = cnt
  if list(per) == Q:
    b = cnt

print(abs(a-b))


Measured memory_bytes: 9128
#include "bits/stdc++.h"
using namespace std;

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define pll     pair<long long, long long>
#define ll      long long

vector<int> g[101010];
int color[101010];

bool dfs(int v, int prev, int c) {
        color[v] = c;
        bool bipartite = true;
        for (auto u : g[v]) if (u != prev) {
                if (color[u] == -1) {
                        if (!dfs(u, v, 1 - c)) bipartite = false;
                } else if (color[u] != 1 - c) {
                        bipartite = false;
                }
        }
        return bipartite;
}

int main() {
        int n, m;
        scanf("%d%d", &n, &m);
        for (int i = 0; i < m; i ++) {
                int a, b;
                scanf("%d%d", &a, &b);
                a --, b --;
                g[a].push_back(b);
                g[b].push_back(a);
        }
        long long cntA = 0, cntB = 0, cntC = 0;
        for (int i = 0; i < n; i ++) color[i] = -1;
        for (int i = 0; i < n; i ++) {
                if (color[i] == -1) {
                        if (g[i].size() == 0) {
                                cntA ++;
                                continue;
                        }
                        if (dfs(i, -1, 0)) cntB ++;
                        else cntC ++;
                }
        }
        long long ans = cntA * cntA + (n - cntA) * cntA * 2 + cntB * cntB * 2 + cntB * cntC * 2 + cntC * cntC;
        printf("%lld\n", ans);
        return 0;
}



Measured memory_bytes: 10880
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    vector<double> v(n);
    for (int i = 0; i < n; ++i) scanf("%lf", &v.at(i));
    sort(v.begin(), v.end());
    for (int i = 1; i < n; ++i) (v.at(i) += v.at(i - 1)) /= 2;
    printf("%.15lf\n", v.back());
    return 0;
}


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

using namespace std;
#define endl "\n"
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> pii;
const int N = 100 + 5;
int n;
ll a[N], res;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    sort(a + 1, a + n + 1);
    for (int i = 1; i < n - 1; ++i)
    for (int j = i + 1; j < n; ++j) if (a[j] != a[i])
    for (int k = j + 1; k <= n; ++k) if (a[k] != a[j])
    {
        if (a[i] + a[j] > a[k]) ++res;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;
class Main{
	public static void main(String[] args)
    {
      Scanner sc=new Scanner(System.in);
      String s=sc.next();
      if(s.charAt(2)==s.charAt(3) && s.charAt(4)==s.charAt(5))
        System.out.println("Yes");
      else
        System.out.println("No");
    }
}

Measured memory_bytes: 23892
IDENTIFICATION DIVISION.
       PROGRAM-ID. ABC042-A.
       DATA DIVISION.
       FILE SECTION.
       WORKING-STORAGE SECTION.
       77 STR PIC X(100).
       77 COUNT5 PIC 9(1) VALUE ZERO.
       77 COUNT7 PIC 9(1) VALUE ZERO.

       PROCEDURE DIVISION.
       MAIN-PROCEDURE.
               ACCEPT STR FROM SYSIN.
               INSPECT STR TALLYING
                   COUNT5 FOR ALL "5"
                   COUNT7 FOR ALL "7".
               IF COUNT5 = 2 AND COUNT7 = 1 THEN
                   DISPLAY "YES"
               ELSE
                   DISPLAY "NO"
               END-IF
               STOP RUN.
       END PROGRAM ABC042-A.


Measured memory_bytes: 384
#include <iostream>
#include <memory>
#include <string>
#include <cstdint>
#include <array>
#include <utility>
#include <vector>

template <typename F>
constexpr decltype(auto) fix(F&& f) {
	return[f = std::forward<F>(f)](auto&&... args) {
		return f(f, std::forward<decltype(args)>(args)...);
	};
}

struct Node {
	int count[26] = {};
	std::array<std::unique_ptr<Node>, 26> children = {};
};

int main() {
	int n;
	std::cin >> n;

	std::array<int, 26> one = {};
	std::array<std::unique_ptr<Node>, 26> roots = {};

	std::int64_t ans = 0;

	std::vector<std::string> input(n);
	for (auto&& s : input) {
		std::cin >> s;

		if (s.size() == 1) {
			++one[s[0] - 'a'];
			continue;
		}

		std::array<int, 26> count = {};
		for (auto&& c : s)
			++count[c - 'a'];

		for (int j = 0; j < 26; ++j)
			if (count[j] != 0)
				++one[j];

		int depth = 0;
		fix([&](auto&& f, std::unique_ptr<Node>& ptr) -> void {
			if (ptr == nullptr)
				ptr = std::make_unique<Node>();

			if (depth + 2 == s.size())
				++ptr->count[s[0] - 'a'];
			else {
				--count[*(s.rbegin() + depth) - 'a'];
				for (int j = 0; j < 26; ++j)
					if (count[j] != 0)
						++ptr->count[j];
				
				++depth;
				f(f, ptr->children[*(s.rbegin() + depth) - 'a']);
			}
		})(roots[s.back() - 'a']);
	}

	for (auto&& s : input) {
		if (s.size() == 1) {
			ans += one[s[0] - 'a'] - 1;
			continue;
		}

		int depth = 0;
		fix([&](auto&& f, const std::unique_ptr<Node>& ptr) -> void {
			if (ptr == nullptr)
				exit(1);

			if (depth + 2 == s.size())
				ans += ptr->count[s[0] - 'a'] - 1;
			else {
				++depth;
				f(f, ptr->children[*(s.rbegin() + depth) - 'a']);
			}
		})(roots[s.back() - 'a']);
	}

	std::cout << ans << std::endl;
}

Measured memory_bytes: 340736
#include<stdio.h>

int main()
{
	int a, b, x, tmp, ans;
	bool flag=false;
	scanf("%d %d", &a, &b);

	x = b * 10;	
	for (int i=0; i<10; i++){
		tmp = (x+i) * 0.08;
		if ( tmp  == a){
			ans = x+i;
			flag = true;
			break;
		}
	}

	if (!flag) ans = -1;
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			@SuppressWarnings("unused")
			String top = br.readLine();
			String down = br.readLine();

			char[] topTmp = top.toCharArray();
			char[] downTmp = down.toCharArray();

			char[] turnDown = new char[top.length()];
			char[] turnTop = new char[top.length()];

			for (int i = 0; i < top.length(); i++) {
				turnDown[i] = topTmp[top.length() - 1 - i];
				turnTop[i] = downTmp[top.length() - 1 - i];
			}

			if (top.equals(new String(turnTop)) && down.equals(new String(turnDown))) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		}
	}
}


Measured memory_bytes: 23252
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  ll N;
  cin >> N;
  ll ans = 1000;
  while(N >= 100){
    ans = min(ans, abs((N % 1000) - 753));
    N /= 10;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	
	int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	
	int a1 = a-n;
	int b1 = b-n;
	
	if(a1 < 0){
		a1*=-1;
	}
	if(b1 < 0){
		b1*=-1;
	}
	
	if(a1 < b1){
		printf("A");
	}
	else{
		printf("B");
	}
		
	return 0;
}


Measured memory_bytes: 1624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int count = 0;
    int number;
    cin >> number;
 
  // int型の2次元配列(3×4要素の)の宣言
  vector<vector<int>> data(number, vector<int>(2));
 
  // 入力 (2重ループを用いる)
  for (int i = 0; i < number ; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> data.at(i).at(j);
    }
  }
  for (int k = 0; (k < number) && (count < 3); k++) {
      if(data.at(k).at(0) == data.at(k).at(1)) {
          count += 1;
      }
      else {
          count = 0;
      }
  }

  if(count == 3) {
      cout << "Yes" << endl;
  }
  else {
      cout << "No" << endl;
  }

  return 0;
}

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

int main(){
  int N;
  cin >>N;
  int a[N];
  int gu=0;
  for(int i=0;i<N;i++){
    cin >>a[i];
    if (a[i]%2==0){
      gu++;
    }
  }
  cout<<pow(3,N)-pow(2,gu)<<endl;
  return 0;
}

    

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int i;
    int j;
    for(i = 1; i < 10; i++) {
        for(j = 1; j < 10; j++) {
            printf("%dx%d=%d\n", i, j, i*j);
        }
    }
     return 0;
}



Measured memory_bytes: 2000
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin>>s;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            return 0;
        }
    }
    for(int i=0;i<s.size()-2;i++){
        if(s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }
    cout<<"-1 -1"<<endl;
}


Measured memory_bytes: 512
// chalo phir code karthe hh bina koi backchodi ke 
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n,k;
		cin >>  k;
		string s;
		cin >> s;
		n = s.size();
		if(n<=k)cout<<s<<endl;
		else{	
			n =k;
			fn{
				cout<<s[i];
			}
			cout<<"...";
		}
	
	
	}
	return 0;
}

Measured memory_bytes: 3648
import itertools
N=int(input())
L=[]
S=[]
for i in range(3,10):
    for x in itertools.product('357',repeat=i):
        L.append(x)
for x in L:
    s=""
    for y in x:
        s+=y
    if "3" in s and "5" in s and "7" in s:
        S.append(int(s))
S.append(N)
S=sorted(S)
if "3" in str(N) and "5" in str(N) and "7" in str(N):
    print(S.index(N)+1)
else:
    print(S.index(N))


Measured memory_bytes: 8180
#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

int main() {
    long long N, A, B; 
    cin>>N>>A>>B;
    long long loop = N/(A + B);
    long long rest = N % (A + B);
    if(rest < A){
        cout << loop*A + rest << endl;
    }else{
        cout << loop*A + A << endl;
    }
    return 0;
}

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

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

    int N;
    cin >> N;
    vector<string> W(N);
    map<string, int> mp;
    for (int i = 0; i < N; ++i) {
        cin >> W.at(i);
        if (mp[W.at(i)]) {
            cout << "No" << endl;
            exit(0);
        }
        mp[W.at(i)]++;
        if (i == 0) continue;
        if (W.at(i - 1).at(W.at(i - 1).size() - 1) != W.at(i).at(0)) {
            cout << "No" << endl;
            exit(0);
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
a, b, k = map(int, input().split())

cnt = 0
for i in range(1, 200):
    if(a%i == 0 and b%i == 0):
        cnt = cnt + 1;

cnts = cnt - k + 1
cnt = 0
for i in range(1, 200):
    if(a%i == 0 and b%i == 0):
        cnt = cnt + 1;
    if(cnt == cnts):
        print(i)
        break


Measured memory_bytes: 9112
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var N = cin.ReadInt();
            var K = cin.ReadInt();
            var x = cin.ReadIntArray(N);
            WriteLine(x.Select(p => Min(K - p, p)).Sum() * 2);
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}

Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n,m;
    cin>>n>>m;
    if(n<m)swap(n,m);
    if(m+1<n){
        cout<<0<<endl;
        return 0;
    }
    long long mod=1e9+7;
    long long d=1;
    for(int i=n;i>=1;i--){
        //cout<<d*i<<endl;
        d=(d*i)%mod;
    }
    long long c=1;
    for(int i=m;i>=1;i--){
        c=(c*i)%mod;
    }
    long long ans=(c*d)%mod;
    if(n==m)ans=(ans*2)%mod;

    //cout<<d<<" "<<c<<endl;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
1.upto(3500) do |h|
    1.upto(h) do |w|
        next if (m = 4 * h * w - w * n - n * h) <= 0
        x, y = (n * h * w).divmod(m)
        next if y != 0
        puts "#{h} #{w} #{x}"
        exit
    end
end

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

int main() {
    int N;
    cin >> N;
    bool a=false;
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            if(N==i*j){
                a=true;
                break;
            }
        }
    }
    if(a==true) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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[] a = new int[N];
		for (int i = 0; i < N; i++) {
			int A = sc.nextInt();
			a[i] = A - (i +1);
		}
		
		Arrays.sort(a);
		
		int center = 0;
		if (N % 2 == 0) {
			center = (a[(N/2)-1]+a[N/2])/2;
		} else {
			center = a[((N+1)/2)-1];
		}
		
		long ans = 0;
		for (int i = 0; i < N; i++) {
			ans += Math.abs(a[i]-center);
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 64804
import sys


def next_str() -> str:
    result = ""
    while True:
        tmp = sys.stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


def main() -> None:
    s = next_str()
    dic = [set() for _ in range(len(s))]

    flg = False

    for i in range(len(s)):
        dic[i].add(s[i])

    while True:
        for c in range(ord('a'), ord('z') + 1):
            for i in range(len(dic)):
                if chr(c) not in dic[i]:
                    break
            else:
                flg = True

        for i in range(len(dic) - 1):
            dic[i] |= dic[i + 1]

        if flg: break
        dic = dic[:-1]

    print(len(s) - len(dic))


if __name__ == '__main__':
    main()

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

int main() {
    //
    int num;
    string str;
    map<string, int> m;
    vector<string> vec;
    vector<string> vec2;

    cin >> num >> str;
    for (int i = 0; i < str.size() - 2; i++) {
        // 1桁目で同じ値が出たらスキップ
        // 0024だと2桁目の0ｽﾀｰﾄでは全く同じパターンを見ることになるので不要(024がかぶる)
        auto exists = find(vec.begin(), vec.end(), str.substr(i, 1)) != vec.end();
        if (exists == true) continue;

        vec.push_back(str.substr(i, 1));

        vec2.clear();  // 重複チェックは毎回初期化
        for (int j = i + 1; j < str.size() - 1; j++) {
            // 2桁目で同じ値が出たらスキップ
            // 0224だと3桁目の02以降は全く同じパターンを見ることになるので不要(024がかぶる)
            auto exists2 = find(vec2.begin(), vec2.end(), str.substr(j, 1)) != vec2.end();
            if (exists2 == true) continue;

            vec2.push_back(str.substr(j, 1));

            for (int k = j + 1; k < str.size(); k++) {
                string tmp;
                tmp = str.substr(i, 1) + str.substr(j, 1) + str.substr(k, 1);
                m[tmp]++;  // 組み合わせをmapに入れて重複回避
            }
        }
    }

    cout << m.size() << endl;
    //
}

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin >> N;
	int tmp = 1e9;
	int cnt = 0;
	vector<int>P(N);

	for (int i = 0; i < N; i++){
		cin >> P[i];
		if (P[i] < tmp) {
			cnt++;
			tmp = P[i];
		}
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#define pi 3.141592653589
#include<iomanip>
using namespace std;
#include<algorithm>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1e9
#define LINF 1e17
#define ll long long
#define MOD (int)1e9+7

bool isPrime(int n){
    rep(i,2,n){
        if(n%i==0)return false;
    }
    return true;
}
 
int main(){
    
    int n,cnt[1001]={},tmp;
    ll ans=1;
    
    cin>>n;
    rep(i,2,n+1){
        rep(j,2,i+1){
            if(isPrime(j)){
                if(i%j==0){
                    tmp=i;
                    while(1){
                        if(tmp%j==0){
                            cnt[j]++;
                            tmp/=j;
                        }
                        else break;
                    }
                }
            }
        }
    }
    rep(i,0,n+1){
        if(cnt[i]>0)ans*=cnt[i]+1;
        ans%=MOD;
    }
    cout<<ans<<endl;
    
    return 0;
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPC(i, a) REP(i, 0, a)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
	// INFILE();
  ll a, b, x;
  cin >> a >> b >> x;

  cout << (b / x) - ((a - ((a == 0) ? 0 : 1)) / x) + ((a == 0) ? 1 : 0) << endl;
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    cin >> n;
    int minv = 10000, maxv = -1;

    rep(i, n)
    {
        int a;
        cin >> a;
        minv = min(minv, a);
        maxv = max(maxv, a);
    }

    OP(maxv - minv);
    return 0;
}

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

ll x;

int main(){
  cin >> x;
  ll ans = (x / 11)*2;

  if(x%11 > 6) ans += 2;
  else if(1 <= x%11 && x%11 <= 6) ans += 1;

  cout << ans << endl;
}


Measured memory_bytes: 256
S=list(map(str,input()))
T=list(map(str,input()))
X=[]
Z=0
for I in range(len(S)-len(T)+1):
    Y=S[I:I+len(T)]
    Z=0
    for J in range(len(T)):
        if Y[J]==T[J]:
            Z=Z+1
    X.append(Z)
if not X==[]:
    print(len(T)-max(X))
elif S==T:
    print(0)
else:
    print(len(T))

Measured memory_bytes: 9004
n=int(input())
h=list(map(int,input().split()))
t=[0 for _ in range(n)]
ans = 0
mode = 0
while h != t:
	for i in range(n):
		if h[i] >= 1:
			mode = 1
			h[i] -= 1
		else:
			if mode == 1:
				break
	ans += 1
	mode = 0
print(ans)


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

int main(){
    int n;
    long long d;
    cin>>n>>d;
    long long dis;
    dis=d*d;
    int count=0;
    for(int i=0;i<n;i++){
        long long x,y;
        cin>>x>>y;
        if(x*x+y*y<=dis) count++;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int N,D,X;

int main(int argc, char const *argv[])
{
    cin>>N>>D>>X;
vector<int> A(N);
int eaten_choco=0;
for(int i=0;i<A.size();i++){
    cin>>A[i];
    eaten_choco+=(D-1)/A[i]+1;
}
cout<<X+eaten_choco<<endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include <algorithm> 
using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

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

    int sum=0;
    int m=0;
    for(int i=0;i<n;i++){
        int tmp;cin >> tmp;
        sum+=tmp;
        m=max(m,tmp);
    }
    sum -=m;
    Yes(sum>m)
} 

Measured memory_bytes: 256
using System;

namespace ABC075B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] bufs = Console.ReadLine().Split(' ');
            int H = int.Parse(bufs[0]);
            int W = int.Parse(bufs[1]);

            int[,] map = new int[H + 2, W + 2];

            for (int i = 1; i <= H; i++)
            {
                string row = Console.ReadLine();
                for (int j = 1; j <= W; j++)
                {
                    if(row[j - 1] == '#')
                    {
                        map[i - 1, j - 1]++;
                        map[i - 1, j]++;
                        map[i - 1, j + 1]++;
                        map[i, j - 1]++;
                        map[i, j] = 100;
                        map[i, j + 1]++;
                        map[i + 1, j - 1]++;
                        map[i + 1, j]++;
                        map[i + 1, j + 1]++;
                    }
                }
            }

            for (int i = 1; i <= H; i++)
            {
                string res = String.Empty;
                for (int j = 1; j <= W; j++)
                {
                    if (map[i, j] >= 100)
                    {
                        res += '#';
                    }
                    else
                    {
                        res += map[i, j];
                    }
                }
                Console.WriteLine(res);
            }

        }
    }
}


Measured memory_bytes: 11092
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
D = "Yay!"
antena = [a,b,c,d,e]
for st in range(5):
  for end in  range(st+1,5):
    if abs(antena[st] - antena[end]) > k:
      D = ":("
print(D)
  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)

const ll MOD = (ll)1e9 + 7;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n; cin >> n;
  set<string> dic;
  REP(i, n) {
    string op, st; cin >> op >> st;
    if (op == "insert") {
      dic.insert(st);
    } else {
      if (dic.find(st) != dic.end()) cout << "yes" << endl;
      else cout << "no" << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 32184
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1001001001;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
inline int read()
{
	int x=0,t=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=-1,ch=getchar();
	while(ch>='0'&&ch<='9')x=x*10+ch-48,ch=getchar();
	return x*t;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main()
{
    int N,X,Y; cin >> N >> X >> Y; --X; --Y;
    vector <int> ans(N);
    rep(i,N){
        vector <int> dist(N,INF);
        queue <int> q;
        q.push(i);
        dist[i]=0;
        while(!q.empty()){
            int a=q.front(); q.pop();
            int d=dist[a];
            if (a-1>=0 && dist[a-1]==INF){
                q.push(a-1);
                dist[a-1]=d+1;
            }
            if (a+1<N && dist[a+1]==INF){
                q.push(a+1);
                dist[a+1]=d+1;
            }
            if (a==X && dist[Y]==INF){
                q.push(Y);
                dist[Y]=d+1;
            }
            if (a==Y && dist[X]==INF){
                q.push(X);
                dist[X]=d+1;
            }
        }
        rep(i,N) ans[dist[i]]++;
    }
    rep(i,N) ans[i]/=2;
    for(register int i=1;i<=N-1;i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    const ll mod = 1000000007;
    ll N;
    cin >> N;
    vl A(N), sum(N+1);
    rep(i, N){
        cin >> A[i];
    }
    sum[0] = 0;
    rep(i, N){
        sum[i+1] = sum[i] + A[i];
    }

    ll ans = 0;
    rep(i, N){
        ans += A[i] * ((sum[N]-sum[i+1])%mod) % mod;
        ans %= mod;
    }
    cout << ans;
}


Measured memory_bytes: 6420
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;

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

    Graph to(n), cost(n);
    rep(i, n-1) {
        int a, b, w;
        cin >> a >> b >> w;
        a--;  b--;
        to[a].push_back(b);
        to[b].push_back(a);
        cost[a].push_back(w);
        cost[b].push_back(w);
    }

    vector<int> ans(n, -1);
    queue<int> Q;
    
    ans[0] = 0;
    Q.push(0);
    while(!Q.empty()) {

        int v = Q.front();
        Q.pop();

        rep(i, to[v].size()) {

            int u = to[v][i];
            int w = cost[v][i];

            if(ans[u] != -1) {
                continue;
            }

            ans[u] = (ans[v] + w)%2;
            Q.push(u);
        }
    }

    rep(i, n) {
        cout << ans[i] << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 11904
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main(){
  long int a, b, k;
  cin >> a >> b >> k;
  for(int i=0;i<k;i++){
    if(a>=k){
      a -= k;
      break;
    }else if(a+b>=k){
	  b = a + b - k;
      a = 0;
      break;
    }else{
      a = 0;
      b = 0;
	  break;
    }
  }
  cout << a << "\n" << b;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll ans;
int cnt[100];

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int tmp = i;
        vector<int> v;
        while (tmp > 0) {
            v.push_back(tmp % 10);
            tmp /= 10;
        }
        int f = v[0], b = v[v.size() - 1];
        cnt[f*10 + b]++;
    }
    for (int i = 10; i <= 99; i++) {
        int f = i / 10;
        int b = i % 10;
        int rev = b * 10 + f;
        ans += cnt[i] * cnt[rev];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
                                        #include<iostream>
                                        #include<cstdio>
                                        #include<vector>
                                        #include<queue>
                                        #include<map>
                                        #include<cstring>
                                        #include<string>
                                        #include <math.h>
                                        #include<algorithm>
                                    //    #include <boost/multiprecision/cpp_int.hpp>
                                        #include<functional>
                           //     #define int long long
                                        #define inf  1000000007
                                        #define pa pair<int,int>
                                        #define ll long long
                                        #define pal pair<double,pa>
                                        #define ppa pair<int,int>
                                        #define ppap pair<pa,pa>
                                        #define ssa pair<string,int>
                                        #define  mp make_pair
                                        #define  pb push_back
                                        #define EPS (1e-10)
                                        #define equals(a,b) (fabs((a)-(b))<EPS)
                                  #define VI vector<int>
                                        using namespace std;
                                        
                                  class pas{
                                    	public:
                                    	int x,y;
                                    	pas(int x=0,int y=0):x(x),y(y) {}
                                    	pas operator + (pas p) {return pas(x+p.x,y+p.y);}
                                    	pas operator - (pas p) {return pas(x-p.x,y-p.y);}
                                    	pas operator * (int a) {return pas(x*a,y*a);}
                                    	pas operator / (int a) {return pas(x/a,y/a);}
                                    //	double absv() {return sqrt(norm());}
                                    	int norm() {return x*x+y*y;}
                                    	bool operator < (const pas &p) const{
                                    		return x != p.x ? x<p.x: y<p.y;
                                    	}
                                    	bool operator == (const pas &p) const{
                                    		return x==p.x && y==p.y;
                                    	}
                                    };
int a[60];
           signed main(){
        
          int x,y,z;
           	cin>>x>>y>>z;
           	
           	x-=2*z+y;
           	cout<<1+x/(y+z)<<endl;
           	
           	return 0;
           	
           	
           }
             

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

typedef long long ll;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int oo = 0x3f3f3f3f;
 
template<typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48; 
    return x *= f;
}

const int N = 500;
const int prime[] = { 2, 3, 5, 7, 11, 13, 17, 19 };
const int limit[] = { 8, 5, 3, 3, 2,  2,  2,  2  };

int n;
int num[N + 5], pri[N + 5][9];
int val[N + 5], tmp[N + 5], coe[9];

int work() {
    int res = 0;
    memset(tmp, 0, sizeof tmp);

    for(int i = 1; i <= num[0]; ++i) {
        int x = num[i];

        bool flag = true;
        for(int j = 0; j < 8; ++ j) {
            flag &= coe[j] >= pri[x][j];
        }

        if(flag) {
            if(pri[x][8] == 1) 
                res += val[x];
            else 
                tmp[pri[x][8]] += val[x];
        }
    }
    for(int i = 1; i <= N; ++i) res += std::max(tmp[i], 0);
    return res;
}

int ans = -oo;
void dfs(int cur) {
    if(cur == 8) {
        chkmax(ans, work());
        return;
    }

    for(coe[cur] = 0; coe[cur] <= limit[cur]; ++ coe[cur]) {
        dfs(cur + 1);
    }
}

int main() {

    read(n);
    for(int i = 1; i <= n; ++i) {
        static int m, v;
        read(m); read(v); val[m] += v; 
    }

    for(int i = 1; i <= N; ++i) if(val[i]) {
        num[++ num[0]] = i;

        int k = i;
        for(int j = 0; j < 8; ++j) {
            while(k % prime[j] == 0) {
                ++ pri[i][j];
                k /= prime[j];
            }
        }
        pri[i][8] = k;
    }

    dfs(0);
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int main()
{
    //FILE* fp_in = freopen("input.txt","r",stdin);
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int ans;
    if(b < c || d < a) ans = 0;
    else{
        ans = min(b,d) - max(a,c);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;
typedef vector<int> ivec;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int MOD=1000000007;
int INF=100100100100100;

signed main(){
  int n;cin>>n;
  int ans=0;
  string s[3];cin>>s[0]>>s[1]>>s[2];
  rep(i,n){
    char c[3];
    rep(j,3)c[j]=s[j][i];
    sort(c,c+3);
    if(c[0]!=c[1])ans++;
    if(c[1]!=c[2])ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3640
def bisect(ng, ok, judge, eps=1):
    while abs(ng-ok) > eps:
        m = (ng+ok)//2
        if judge(m):
            ok = m
        else:
            ng = m
    return ok

N,A,B,C,D = map(int,input().split())

X = B-A

for n in range(N):
    m = N-n-1
    if n*C-m*D <= X <= n*D-m*C:
        print('YES')
        break
else:
    print('NO')

Measured memory_bytes: 9180
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <time.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)




void solve()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if(a[0] == a[1] && a[1] == 5 && a[2] == 7)
    {
        cout << "YES\n";
    }
    else
    {
        cout << "NO\n";
    }
}



int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    solve();
    return 0;
}

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  if(n%2==0){
      cout  << "0.5000000000" << endl;
  }else{
      long double x = (long double)n;
      cout << fixed;
      cout << setprecision(10) << (x+1)/x/2.0 << endl;
  }
}

Measured memory_bytes: 256
/*
AuThOr GaRyMr
技巧:
1.区别对待大数据&小数据！
2.Dp难推时算贡献！
3.long long (尤其乘法)！
4.long long INF 要大
5.Dp on trees: 换根法，每次清空当前的节点和换到的子节点
6.long double | 输出浮点数
7.注意特判!(prince and princess)
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int a[500000+10];
int main(){
	string s;
	cin>>s;
	int n=s.length()+1;
	rb(i,2,n){
		if(s[i-2]=='<'){
			a[i]=a[i-1]+1;
		}
	} 
	rl(i,n-1,1){
		if(s[i-1]=='>'&&a[i]==0){
			a[i]=a[i+1]+1;
		}
	}
//	rb(i,1,n) cout<<a[i]<<s[i-1];cout<<endl;
	rb(i,1,n-1) if(s[i-1]=='>') a[i]=max(a[i],a[i+1]+1);
//	if(s[i-1]=='>')
	LL res=0;
	rb(i,1,n) res+=a[i];
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 2820
#include<bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int a,int b){
    return (b==0?a:gcd(b,a%b));
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
signed main(){
    int n;
    cin>>n;
    int ans=1;
    for(int i=0;i<n;i++){
        int t;
        cin>>t;
        ans=lcm(ans,t);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();

		long[] a = new long[n];
		long sum = 0;
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextLong();
			sum += a[i];
		}

		Set<Long> s = new HashSet<>();
		for (long i = 1; i * i < sum; i++) {
			if (sum % i == 0) {
				s.add(i);
				s.add(sum / i);
			}
		}

		long answer = 1;
		for (long x : s) {
			long[] b = new long[n];
			long lsum = 0;
			for (int i = 0; i < n; i++) {
				b[i] = a[i] % x;
				lsum += (x - b[i]);
			}
			Arrays.sort(b);
			long needs = Long.MAX_VALUE;
			long rsum = 0;
			for (int i = 0; i < n; i++) {
				rsum += b[i];
				lsum -= (x - b[i]);
				if (rsum == lsum) needs = Math.min(needs, rsum);
			}

			if (needs <= k) answer = Math.max(answer, x);
		}

		System.out.println(answer);
	}
}


Measured memory_bytes: 32120