akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    int flag= 0;
    if(n%2==0) flag= 1;
    REP(i,n/2){
        if(s[i]!=s[n/2+i]) flag=0;
    }
    cout <<((flag)?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    a, v = map(int, input().split())
    b, w = map(int, input().split())
    t = int(input())
    if (v - w) * t >= abs(b - a):
        print('YES')
    else:
        print('NO')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 61664
#include <stdio.h>

typedef struct c{
    int a;
    int b;
} C;

int main (void){
    int i,j;
    C s[1050] = {0};
    int wa = 0; 
    int n;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&s[i].a);
        scanf("%d",&s[i].b);
    }
    for(i=0;i<n;i++){
        wa += s[i].b - s[i].a + 1;
    }
    printf("%d\n",wa);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

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

    int64 ans = max({a*c, a*d, b*c, b*d});
    cout << ans << endl;
}

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

int main()
{
        ll N; cin >> N;
        map<string, ll> m;
        for (int i = 0; i < N; ++i) {
                string tmp;
                cin >> tmp;
                m[tmp]++;
        }

        ll max = -1;
        for (auto i : m) {
                if (max == -1) max = i.second;
                else if (max < i.second) max = i.second;
        }

        vector<string> S;
        for (auto i: m) {
                if (i.second == max) {
                        S.push_back(i.first);
                }
        }

        sort(S.begin(), S.end());
        for (int i = 0; i < S.size(); ++i) {
                cout << S[i] << endl;
        }


}


Measured memory_bytes: 26868
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;
    cin >> n;
    vector<vector<int>>f(n,vector<int>(10));
    rep(i,n) rep(j,10) cin >> f[i][j];
    vector<vector<int>>p(n,vector<int>(11));
    rep(i,n) rep(j,11) cin >> p[i][j];
    ll ans = -1000000000;
    for(int bit = 1;bit < (1<<10);bit++) {
        ll tmp = 0;
        rep(i,n) {
            int cnt = 0;
            rep(j,10) {
                if(bit & 1<<j && f[i][9-j] == 1) cnt++; 
            }
            tmp += p[i][cnt];
        }
        ans = max(ans,tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
X, Y, Z, K = map(int, input().split())
A = sorted([int(x) for x in input().split()], reverse=True)
B = sorted([int(x) for x in input().split()], reverse=True)
C = sorted([int(x) for x in input().split()], reverse=True)

bi_comb = []
for i in range(min(X, K)):
    for j in range(min(Y, K)):
        if (i+1)*(j+1) > K:
            break
        bi_comb.append(A[i] + B[j])
bi_comb.sort(reverse=True)

tri_comb = []
for k in range(min(len(bi_comb), K)):
    for l in range(min(Z, K)):
        if (k+1)*(l+1) > K:
            break
        tri_comb.append(bi_comb[k] + C[l])
tri_comb.sort(reverse=True)

print(*tri_comb[:K], sep="\n")

Measured memory_bytes: 5364
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;
#define inf 1000000007

int main(void){
    int n, k;
    cin >> n >> k;
    int h[n];
    int ans[n-k+1];
    for(int i = 0; i < n; i++)
        cin >> h[i];
    sort(h, h+n);
    for(int i = 0; i < n-k+1; i++)
        ans[i]= h[i+k-1]-h[i];
    sort(ans, ans+(n-k+1));
    cout << ans[0] << endl;
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))

// #define DEBUG

#ifdef DEBUG
#define dump(...) fprintf(stderr, __VA_ARGS__)
#else
#define dump(...)
#endif

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;

const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};


ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}

random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    for(int n, m; cin >> n >> m, n;){
        vector<string> elems(n), T(m);
        for(auto& e : elems) cin >> e;
        for(auto& e : T) cin >> e;

        ll res = 0;
        string t;
        for(auto& e : T) t += e;
        int len = t.size();
        vector<set<int>> matched(len + 1);
        rep(i, len){
            rep(j, n){
                string& e = elems[j];
                if(t.substr(i, e.size()) == e){
                    matched[i].insert(j);
                }
            }
        }

        vector<vector<bool>> dp(len + 1, vector<bool>(1 << n));
        rep(i, len) dp[i][0] = true;
        rep(i, len + 1){
            rep(j, 1 << n){
                if(not dp[i][j]) continue;
                if(j == (1 << n) - 1){
                    res++;
                    continue;
                }
                for(auto& e : matched[i]){
                    if((j >> e) & 1) continue;
                    dp[i + elems[e].size()][j | (1 << e)] = true;
                }
            }
        }

        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 8804
import math


def main():
    n, m = map(int, input().split())

    if math.fabs(n-m) > 1: k = 0
    elif n == m: k = 2
    else: k = 1

    print(math.factorial(n)*math.factorial(m)*k % (10**9+7))
    

if __name__ == "__main__":
    main()

Measured memory_bytes: 5192
# K = gets.chomp.to_i
# A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a, b, c = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars

# p [Math.sqrt(a), Math.sqrt(b), Math.sqrt(c)]
left = a * b * 4
right = (c - a - b) * (c - a - b)
ans = c > (a+b) && left < right

if ans
  print "Yes\n"
else
  print "No\n"
end

Measured memory_bytes: 3836
#include<cstdio>
using namespace std;
const int maxn=10+2;
char str[maxn];
int main(){
	scanf("%s",str+1);
	if (str[1]=='Y'&&str[2]=='A'&&str[3]=='K'&&str[4]=='I') printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

int main(int argc, char const *argv[])
{
    int a, b;
	std::cin >> a >> b;
	if (a > b)
	{
		std::cout << "a > b\n";
	}else if(a < b)
	{
		std::cout << "a < b\n";
	}else if (a == b)
	{
		std::cout << "a == b\n";
	}
	return 0;
}


Measured memory_bytes: 3068
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

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

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		long[] v = new long[N];
		for (int i = 0; i < N; ++i) {
			v[i] = sc.nextLong();
		}

		Arrays.sort(v);
		HashMap<Long, Integer> cnt = new HashMap<>();
		for (int i = 0; i < N; ++i) {
			if (!cnt.containsKey(v[i])) {
				cnt.put(v[i], 1);
			} else {
				cnt.put(v[i], cnt.get(v[i]) + 1);
			}
		}

		long[] sum = new long[N];

		Fraction maxAve = null;
		for (int i = N - 1; i >= 0; --i) {
			sum[i] = v[i] + (i + 1 < N ? sum[i + 1] : 0);
			if (N - i >= A && N - i <= B) {
				if (maxAve == null) {
					maxAve = new Fraction(sum[i], N - i);
				} else if (new Fraction(sum[i], (N - i)).greater(maxAve)) {
					maxAve = new Fraction(sum[i], N - i);
				}
			}
		}
		System.out.printf("%.20f\n", 1d * maxAve.numerator.longValue() / maxAve.denominator.longValue());
		HashMap<Long, Integer> cnt2 = new HashMap<>();
		BigInteger comb = new BigInteger("0");
		for (int i = N - 1; i >= 0; --i) {
			if (!cnt2.containsKey(v[i])) {
				cnt2.put(v[i], 1);
			} else {
				cnt2.put(v[i], cnt2.get(v[i]) + 1);
			}
			if (N - i >= A && N - i <= B)
				if (maxAve.equal(new Fraction(sum[i], N - i))) {
					int all = cnt.get(v[i]);
					int cur = cnt2.get(v[i]);
					BigInteger d = new BigInteger("1");
					cur = Math.min(cur, all - cur);
					for (long j = all; j > all - cur; --j) {
						d = d.multiply(BigInteger.valueOf(j));
					}
					for (long j = 1; j <= cur; ++j) {
						d = d.divide(BigInteger.valueOf(j));
					}
					comb = comb.add(d);
				}
		}
		System.out.println(comb);
	}

	class Fraction {
		BigInteger numerator, denominator;

		public Fraction(long numerator, long denominator) {
			this.numerator = BigInteger.valueOf(numerator);
			this.denominator = BigInteger.valueOf(denominator);
		}

		boolean greater(Fraction o) {
			return 1 == numerator.multiply(o.denominator).compareTo(o.numerator.multiply(denominator));
		}

		boolean equal(Fraction o) {
			return 0 == numerator.multiply(o.denominator).compareTo(o.numerator.multiply(denominator));
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    string N;
    cin >> N;
    ll c = 0;
    rep(i, sz(N)){
        c += N.at(i) - '0';
        c %= 9;
    }
    if(c == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

int main() {
    int64_t n;
    cin >> n;
    map<int64_t, int64_t, greater<int64_t>> m { { 0, 0 } };
    for (int64_t i = 0; i < n; i++) {
        int64_t a;
        cin >> a;
        m[a]++;
    }
    int64_t ans = 0;
    auto f = [](auto e) { return e.second > 1; };
    auto e1 = find_if(begin(m), end(m), f);
    if (e1 != end(m)) {
        if (e1->second > 3) {
            ans = e1->first * e1->first;
        } else {
            auto e2 = find_if(next(e1), end(m), f);
            if (e2 != end(m) && e2->second > 1) {
                ans = e1->first * e2->first;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <ll,ll>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

double dp[301][301][301];
int main()
{
	int n, cnt[4], x;
	memset(cnt, 0, sizeof(cnt));
	memset(dp, 0, sizeof(dp));
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> x;
		cnt[x]++;
	}
	dp[0][0][0] = 0;
	for (int k = 0; k <= n; ++k)
	{
		for (int j = 0; j <= n; ++j)
		{
			for (int i = 0; i <= n; ++i)
			{
				if(i + j + k > n)
					continue;
				if(i > 0)
					dp[i][j][k] += (i / (1.0 * n)) * dp[i - 1][j][k];
				if(j > 0)
					dp[i][j][k] += (j / (1.0 * n)) * dp[i + 1][j - 1][k];
				if(k > 0)
					dp[i][j][k] += (k / (1.0 * n)) * dp[i][j + 1][k - 1];
				if(i != 0 || j != 0 || k != 0)
					dp[i][j][k] = (n / (1.0 * (i + j + k))) * (dp[i][j][k] + 1);
			}
		}
	}
	printf("%0.10lf\n", dp[cnt[1]][cnt[2]][cnt[3]]);	
}


Measured memory_bytes: 213248
import java.util.Scanner;

class Main {

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

        String a = sc.next();
        String b = sc.next();

        boolean end = false;

        if (a.length() > b.length()) {
            System.out.println("GREATER");
            end = true;
        } else if (a.length() < b.length()) {
            System.out.println("LESS");
            end = true;
        } else if (a.length() == b.length()) {
            for (int i = 0; i < a.length(); i++) {
                if (a.charAt(i) > b.charAt(i)) {
                    System.out.println("GREATER");
                    end = true;
                    break;
                } else if (a.charAt(i) < b.charAt(i)) {
                    System.out.println("LESS");
                    end = true;
                    break;
                }
            }
        }
        if (end == false) {
            System.out.println("EQUAL");
        }
    }
}


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

int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret == 0) {
        if (num > 1) {
            ret = Fibonatch(result, num - 1) + Fibonatch(result, num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};
    int result;

    scanf("%d", &num);
    result = Fibonatch(ret, num);

    printf("%d\n", result);

    return 0;
}

Measured memory_bytes: 1188
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion

#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion


int main()
{
	int n, k; cin >> n >> k;
	vector<int> a(n); 
	rep(i, n)
	{
		cin >> a[i];
		if (a[i] == k)
		{
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	sort(all(a));
	if (a[n - 1] < k || a.front() == a.back())
	{
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	if (n == 1)
	{
		if (a[0] == k)cout << "POSSIBLE" << endl;
		else cout << "IMPOSSIBLE" << endl;
		return 0;
	}
	int g = a[0];
	for (int i = 1; i < n; ++i)g = gcd(g, a[i]);
	if (g == 1)cout << "POSSIBLE" << endl;
	else if (k%g == 0)cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
vector<pair<string, i64>> v;
int main() {
  cin >> n;
  init_n(v, n);
  for (i64 i = 0; i < n; ++i) {
    cin >> v[i].first >> v[i].second;
  }
  vector<i64> a(n);
  for (i64 i = 0; i < n; ++i) a[i] = i;
  sort(begin(a), end(a), [&](i64 i, i64 j) {
    if (v[i].first == v[j].first) return v[i].second > v[j].second;
    return v[i].first < v[j].first;
  });
  for (i64 i : a) cout << i + 1 << '\n';
  return 0;
}


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

using namespace std;
typedef long long ll;

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


vector<int> R;
int main() {
    int s, g;
    string ans;

    rep(i, 10) {
        R.push_back(i);
    }
    for(int i=5; i>0; --i) {
        R.push_back(i);
    }
    int n;
    cin >> n;

    rep(re, n) {
        cin >> s >> g;
        bool start = false, goal = false;

        while (1) {
            for(int i=0; i<15; ++i) {
                if(start) {
                    ans += " ";
                    ans += to_string(R[i]);
                }

                if(R[i] == s) {
                    ans.clear();
                    ans += to_string(R[i]);
                    start = true;
                }

                if (R[i] == g && start) {
                    goal = true;
                    break;
                }
            }

            if (goal) break; //もし最後にたどり着いても終わっていなかったらまた最初に折り返す．
        }
        cout << ans << endl;
    }

}




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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n, m, v, p;
  cin >> n >> m >> v >> p;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.rbegin(), a.rend());
  ll ans = 0;
  int l = 0, r = n;
  ll cnt = 0;
  int start = 0;
  for (int i = 0; i < n; i++)
    if (a[i] >= a[p - 1]) {
      ans++;
      l = i;
      if (a[i] > a[p - 1]) {
        start = i + 1;
      }
    }
  int index = l + 1;

  auto f = [&](int i) {
    map<int, ll> mp;
    mp[v - n] = m;
    for (int j = p - 1; j < i; j++) {
      ll b = a[j] - a[i];
      map<int, ll> ump;
      while (b > 0) {
        if (mp.size() == 0) return false;
        auto key = mp.begin()->first;
        if (mp[key] > b) {
          mp[key] -= b;
          if (key < -1) {
            ump[key + 1] += b;
          }
          b = 0;
        } else if (mp[key] == b) {
          if (key < -1) {
            ump[key + 1] += b;
          }
          mp.erase(key);
          b = 0;
        } else {
          if (key < -1) {
            ump[key + 1] += mp[key];
          }
          b -= mp[key];
          mp.erase(key);
        }
      }
      for (auto &it : ump) {
        mp[it.first] += it.second;
      }
    }
    return true;
  };
  while (r - l > 1) {
    int m = (r + l) / 2;
    if (f(m)) {
      l = m;
    } else {
      r = m;
    }
  }
  for (int i = l + 1; i < n; i++) {
    if (a[i] == a[l]) {
      r = i + 1;
    }
  }
  cout << ans + (r - index) << endl;
  return 0;
}
// 1 2 3 3 3 4 5 5 6 6 6 7


Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;
                                                                                                     
ll MOD=1000000007;                                                                                     
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int x; cin>>x;
    cout<<(x==7 || x==5 || x==3 ? "YES" : "NO")<<endl;
}

Measured memory_bytes: 3460
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

int main()
{
	ll n,m;
	cin>>n>>m;
	COMinit();
	if((n+m)%3)cout<<0<<endl;
	else
	{
		ll a=(n+m)/3;
		ll b=n-a;
		cout<<COM(a,b)<<endl;
	}
	return 0;
}

Measured memory_bytes: 23680
#include <iostream>
#include <string.h>
using namespace std;
int main() 
{
	char str [222];
	int n,i;
	cin >> str;
	n = strlen(str);
	for (i=n-2;i;i-=2){
		if(strncmp(str,str+i/2,i/2)==0) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let S = buf_it.next().unwrap().chars().collect::<Vec<_>>();
    let N = S.len();

    if S[0] == '0' || S[N-1] == '1'{
        println!("-1");
        return;
    }
    for i in 0..N-2{
        let j = N-2-i;
        if S[i] != S[j]{
            println!("-1");
            return;
        }
    }
    let mut j = 1;
    for i in 0..N-1{
        if S[i] == '1'{
            println!("{} {}",j,i+2);
            j = i+2;
        } else{
            println!("{} {}",j,i+2);
        }
    }
}


Measured memory_bytes: 5500
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//DがTを含んでいれば良い
//Tの要素が全てDにあれば良い
//Dの要素のうち、Tにあるもののみ、個数をメモする
int main() {
    int N;
    cin >> N;
    vector<int> D(N);
    rep(i,N){
        cin >> D[i];
    }
    int M;
    cin >> M;
    vector<int> T(M);
    rep(i,M){
        cin >> T[i];
    }
    sort(D.begin(),D.end());
    sort(T.begin(),T.end());
    D.push_back(-1);
    T.push_back(-1);

    vector<pair<int,int>> d;
    vector<pair<int,int>> t;
    
    int c1 = 1;
    for(int i = 0;i<N;i++){
      if(D[i] == D[i+1]){
          c1++;
      }
      if(D[i] != D[i+1]){
          d.push_back(make_pair(D[i],c1));
          c1 = 1;
      }
    }

    int c2 = 1;
    for(int i = 0;i<M;i++){
      if(T[i] == T[i+1]){
          c2++;
      }
      if(T[i] != T[i+1]){
          t.push_back(make_pair(T[i],c2));
          c2 = 1;
      }
    }
    //dとtについて、key = 難易度 value = 問題数のmapを作る
    //tmapの各について、
    map<int,int> md;
    map<int,int> mt;
    for(int i = 0;i<d.size();i++){
        md[d[i].first] = d[i].second;
    }
    for(int i = 0;i<t.size();i++){
        mt[t[i].first] = t[i].second;
    }

    bool flag = true;
    for(int i = 0;i<t.size();i++){
        if(md[t[i].first] < mt[t[i].first]){
            flag = false;
            break;
        }
    }
   if(flag) cout << "YES" <<endl;
   else cout << "NO" << endl;

}

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

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;


int main(){
  int N, M , Q;
  cin >> N >> M >> Q;
  vector<vector<ll>> sum(N+2,vector<ll>(N+2,0));

  rep(i,M){
    int l,r;
    cin >> l >> r;
    sum[l][r]++;
  }

  rep(i,N) rep(j,N) sum[i+1][j+1] += sum[i+1][j] + sum[i][j+1] - sum[i][j];

  rep(i,Q){
    int p,q;
    cin >> p >> q;
    ll ans = sum[q][q] - sum[p-1][q] - sum[q][p-1] + sum[p-1][p-1];
    cout << ans << endl;
  }


}


Measured memory_bytes: 2944
#include<iostream>
#include<vector>
#include<string>
#include<queue>
using namespace std;
queue<char>stToQu(string str){
    queue<char>q;
    for(int i = 0;i < str.size();i++){
        q.push(str[i]);
    }
    return q;
}
string CamelCase(vector<string>words){
    string str;
    str += words[0];
    for(int i = 1;i < words.size();i++){
        string a = words[i];
        a[0] -= 0x20;
        str += a;
    }
    return str;
}
string UnderScore(vector<string>words){
    string str;
    str += words[0];
    for(int i = 1;i < words.size();i++){
        str += "_";
        str += words[i];
    }
    return str;
}
string solve(string str,char type){
    //cout << str;
    vector<string>words;
    queue<char> q = stToQu(str);
    string a = "";
    while(!q.empty()){
        string word;
        word = "";
        word += a;
        a = "";
        while(!q.empty()){
            char s = q.front();
            q.pop();
            //cout << s << "*" <<endl;
            if(s <= 'Z'){
                a.push_back(s + 0x20);
                break;
            }
            if(s == '_'){
                a = "";
                break;
            }
            word.push_back(s);
            //cout << "*" <<endl;
        }
        
        if(!word.empty())words.push_back(word);
    }
    if(!a.empty())words.push_back(a);
    //for(int i= 0;i < words.size();i++)cout << words[i] <<endl;
    string st;
    //cout << type <<endl;
    switch (type){
        case 'U':
            st = CamelCase(words);
            st[0] -= 0x20;
            break;
        case 'L':
            st = CamelCase(words);
            break;
        case 'D':
            st = UnderScore(words);
            break;
    }
    return st;
}
int main(){
    vector<string> a;
    while(1){
        string str;
        char type;
        cin >> str >> type;
        if(type == 'X')break;
        a.push_back(solve(str,type));
    }
    for(int i = 0;i < a.size();i++){
        cout << a[i] <<endl;
    }
    return 0;
}


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

public class Main {
    private FastScanner in;
    private PrintWriter out;

    private void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int m = in.nextInt();
        int[] b = new int[m];
        for (int i = 0; i < m; i++) {
            b[i] = in.nextInt();
        }
        Arrays.sort(b);
        int it = 0;
        for (int i = 0; i < m; i++) {
            while (it != n && a[it] < b[i]) {
                it++;
            }
            if (it == n || a[it] != b[i]) {
                out.println("NO");
                return;
            }
            it++;
        }
        out.println("YES");
    }

    private void run() {
        try {
            in = new FastScanner(new File("Main.in"));
            out = new PrintWriter(new File("Main.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    private void runIO() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    private class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

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

Measured memory_bytes: 60512
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
	  	Scanner scanner = new Scanner(System.in);
	  	int  num = scanner.nextInt();
	  	int  a = num/3600;
	  	int R = num%3600;
	  	int  b = R/60;
	  	R = R%60;
	  	int c = R%60;
        System.out.println(a +":"+ b + ":" + c);
        scanner.close();
  }
}


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

using namespace std;

int main(){

    int N;
    cin >> N;

    vector <int> a(N);
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }
    
    sort(a.begin(), a.end());

    int ans = 1000000007;
    for (int i = a[0]; i <=  a[N - 1]; i++){
        int sum = 0;
        for (int j = 0; j < N; j++){
            sum += (i - a[j]) * (i - a[j]);
        }
        
        if (sum < ans){
            ans = sum;
        }
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
#define pii pair<int,int>
map<pii,int>Map;
int n, m, K;
int UF[2][201000];
int Find(int pv, int a){
    if(UF[pv][a]==a)return a;
    return UF[pv][a] = Find(pv, UF[pv][a]);
}
void Merge(int pv, int a, int b){
    a=Find(pv,a);
    b=Find(pv,b);
    if(a!=b)UF[pv][a]=b;
}
int main(){
    int i, a, b;
    scanf("%d%d%d",&n,&m,&K);
    for(i=1;i<=n;i++)UF[0][i]=UF[1][i]=i;
    for(i=0;i<m;i++){
        scanf("%d%d",&a,&b);
        Merge(0,a,b);
    }
    for(i=0;i<K;i++){
        scanf("%d%d",&a,&b);
        Merge(1,a,b);
    }
    for(i=1;i<=n;i++){
        Map[pii(Find(0,i),Find(1,i))]++;
    }
    for(i=1;i<=n;i++)printf("%d ",Map[pii(Find(0,i),Find(1,i))]);
    printf("\n");
}

Measured memory_bytes: 13568
#include<iostream>
#include<vector>
 
using namespace std;
 
#define rep(i, n) for (int i = 0; i < int(n); ++i)
 
vector<pair<int, int> > a;
 
int main() {
  int n, m;
  cin >> n >> m;
  rep (i, m) {
    int aa, bb;
    cin >> aa >> bb;
    a.push_back(make_pair(aa, bb));
  }
  int k = 1, res = 0;
  while (k <= n) {
    int next = -1;
    //cout << k << endl;
    rep (i, m) {
      if (a[i].first <= k) {
	next = max(next, a[i].second);
      }
    }
    if (next < k) {
      cout << "Impossible" << endl;
      return 0;
    }
    ++res;
    k = next + 1;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1196
N = int(input())
A = [int(a) for a in input().split()]

arrays = 1
ratio = ""
for i in range(1, N):
    if ratio == "+":
        if A[i] < A[i-1]:
            arrays += 1
            ratio = ""

    elif ratio == "-":
        if A[i] > A[i-1]:
            arrays += 1
            ratio = ""
    else:
        if A[i] > A[i-1]:
            ratio = "+"
        elif A[i] < A[i-1]:
            ratio = "-"
print(arrays)


Measured memory_bytes: 14252
# include<iostream>
# include<algorithm>
# include<cstring>
# include<string>
# include<cmath>
# include<queue>
# include<stack>
# include<set>
# include<vector>
# include<cstdio>
# include<cstdlib>
# include<map>
# include<deque>

# define deb(x) printf("# x=%d\n",x)
# define deb_d(x) printf("# x=%lf\n",x)
# define ccout(x) printf("%d\n",x)

typedef long long ll;

using namespace std;

int n; 

int main(void){
	int ans;
	while(scanf("%d",&n)!=EOF){
		ans=n/3;
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b; cin >> n >> a >> b;
  int count = 0;
  for(int i = 1; i <= n; i++) {
    if(i < 10) {
      if(a <= i && i <= b) {
        count += i;
      }
    }
    else if (i < 100) {
      if(a <= (i /10 + i %10) && (i /10 + i %10) <= b) {
        count += i;
      }
    }
    else if(i < 1000) {
      if(a <= (i /100 + i %100 /10 + i %10) && (i /100 + i %100 /10 + i %10) <= b) {
        count += i;
      }
    }
    else if(i < 10000) {
      if(a <= (i /1000 + i %1000 /100 + i %100 /10 + i %10) && (i /1000 + i %1000 /100 + i %100 /10 + i %10) <= b) {
        count += i;
      }
    }
    else {
      if(a = 1) {
        count += i;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3604
#include <stdio.h>

int main(){
   char s[1001];
   int  i;

   scanf("%s",s);
   for (i=0;s[i]!='\0';i++) ;
   if (s[i-1]=='s') printf("%ses\n",s);
   else             printf("%ss\n",s);
   return 0;
}


Measured memory_bytes: 1736
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    c=0
    for i in range(1,n+1):
        for j in range(1,n+1):
            if i>=j:
                pass
            else:
                z=x-(i+j)
                if z>j and z<=n:
                    c+=1
    print(c)


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

using ld = long double;
const ld eps = 1e-10, pi = acos(-1.0);

bool eq(ld a, ld b) {
	return std::abs(a - b) < eps;
}

using point = complex<ld>;

ld dot(point a, point b) {
	return real(conj(a) * b);
}

ld cross(point a, point b) {
	return imag(conj(a) * b);
}

int ccw(point a, point b, point c) {
	b -= a, c -= a;
	if (cross(b, c) > eps) return 1;	// a,b,c counter-clockwise
	if (cross(b, c) < -eps) return -1;	// a,b,c clockwise
	if (dot(b, c) < 0) return 2;		// c,a,b on a line
	if (norm(b) < norm(c)) return -2;	// a,b,c on a line
	return 0;							// a,c,b on a line
}

struct line {
	point a, b;
	line() : a(), b() {}
	line(const point& a_, const point &b_)
		: a(a_), b(b_) {}
};

bool isis_ll(line l, line m) {
	return std::abs(cross(l.b - l.a, m.b - m.a)) > eps;
}

bool isis_ls(line l, line s) {
	return (cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < eps);
}

bool isis_lp(line l, point p) {
	return std::abs(cross(l.b - p, l.a - p)) < eps;
}

bool isis_sp(line s, point p) {
	return std::abs(s.a - p) + std::abs(s.b - p) - std::abs(s.b - s.a) < eps;
}

point proj(line l, point p) {
	ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + t * (l.a - l.b);
}

point is_ll(line s, line t) {
	point sv = s.b - s.a, tv = t.b - t.a;
	assert(cross(sv, tv) != 0);
	return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv);
}

bool isis_ss(line s, line t) {
	if (isis_ll(s, t)) return isis_ls(s, t) && isis_ls(t, s);
	return isis_sp(s, t.a) || isis_sp(s, t.b) || isis_sp(t, s.a);
}

ld dist_lp(line l, point p) {
	return std::abs(p - proj(l, p));
}

ld dist_ll(line l, line m) {
	return isis_ll(l, m) ? 0 : dist_lp(l, m.a);
}

ld dist_ls(line l, line s) {
	return isis_ls(l, s) ? 0 : min(dist_lp(l, s.a), dist_lp(l, s.b));
}

ld dist_sp(line s, point p) {
	point r = proj(s, p);
	return isis_sp(s, r) ? std::abs(r - p) : min(std::abs(s.a - p), std::abs(s.b - p));
}

ld dist_ss(line s, line t) {
	if (isis_ss(s, t)) return 0;
	return min({ dist_sp(s, t.a), dist_sp(s, t.b), dist_sp(t, s.a), dist_sp(t, s.b) });
}

ld convex_diameter(const vector<point>& ps) {
	const int n = ps.size();
	ld d = 0;
	for (int i = 0, j = 0; i < n; ++i) {
		const point& p = ps[i];
		for (int k = (j + 1) % n; abs(ps[k] - p) > abs(ps[j] - p); k = (j + 1) % n) {
			j = k;
		}
		d = max(d, abs(ps[j] - p));
	}
	return d;
}

int main()
{
	cout << fixed << setprecision(8);
	int n;
	cin >> n;
	vector<point> ps;
	for (int i = 0; i < n; i++) {
		ld x, y;
		cin >> x >> y;
		ps.emplace_back(x, y);
	}
	cout << convex_diameter(ps) << endl;
	return 0;
}



Measured memory_bytes: 6956
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main() {
  int N;
  cin >> N;
  vll A(N);
  cin >> A;
  sort(A.begin(),A.end());
  ll ans = A[0];
  if(0 == ans){
    cout << 0 << endl;
    return 0;
  }
  
  for(int i=1; i<N; i++){
    if(A[i] <= 1000000000000000000/ans){
      ans *= A[i];
    }else{
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4012
n,m=map(int,input().split())
side1=set()
side2=set()
for i in range(m):
	a,b=map(int,input().split())
	if a==1:
		side1.add(b)
	elif b==n:
		side2.add(a)
print(("" if side1 & side2 else "IM")+"POSSIBLE")

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

int main() {
	// your code goes 
    int n,m,a,b; cin >> n >> m;
    vector<string> v(n);
    for(int i=0;i<n;i++) cin >> v[i];
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    dp[1][1]=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(i==1&&j==1) continue;
            if(v[i-1][j-1]=='.')
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
        }
    }
    cout << dp[n][m];
	return 0;
}


Measured memory_bytes: 5248
while 1:
  n,m = map(int,raw_input().split())
  if n==0 & m==0: break
  G = range(1, n+1)
  while n>1:
    if m%n == 0: G = G[:n-1]
    else: G = G[m % n:] + G[:(m-1) % n]
    n-=1
  print G[0]

Measured memory_bytes: 4236
import java.util.Scanner;

public class Main {

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

	}
	
	public static void range() {
		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if (a < b && b < c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

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

    uint32_t ans = UINT32_MAX;
    if(a / 2 + b / 2 < c){
        cout << a * x + b * y << endl;
        return 0;
    } else {
        for (auto i = 0; i <= max(x, y) * 2; i++) {
            uint32_t tmp = c * i + a * max((x - i / 2), 0) + b * max((y - i / 2), 0);
            if(tmp < ans) ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

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

//#define int long long
const int MOD = 1e9 + 7;
using ll = long long;
using intpair = pair<int, int>;
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

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

Measured memory_bytes: 3652
#pragma region header
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define ts to_string
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector <string>
#define vvs vector <vector<string>>
#define pq  priority_queue<int>
using ll = long long;
/* ----------------よく使う数字や配列----------------- */
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
const int INF = 2000000000;
const int MINF=-2000000000;
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */
/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
bool isprime(ll a)//素数判定、primeならtrue,違うならfalse
{
    if (a < 2) return false;
    else if (a == 2) return true;
    else if (a % 2 == 0) return false;
    double m = sqrt(a);
    for (int i = 3; i <= m; i += 2)
    {
        if (a % i == 0)
        {
            return false;
        }
    }
    // 素数である
    return true;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
ll kind(vi SYURUI) {//vector<int>型の配列の要素の種類数
    int size = SYURUI.size();
    sort(all(SYURUI));
    int cnt = 1;
    rep(i, size-1) {
        if (SYURUI[i] != SYURUI[i + 1])cnt++;
    }
    return cnt;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int N; cin >> N;
    N% ketasum(N) == 0 ? puts("Yes") : puts("No");
}




Measured memory_bytes: 3560
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n';

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	int n,k;
	cin >> n>>k;
	vector<double> p(n);
	double mx =0;
	rep(i, k) {
		double a;
		scanf("%lf", &a);
		p[i] = (a + 1) / 2;
		mx += p[i];
	}
	double cnt = mx;
	rep2(i, k, n) {
		double a;
		scanf("%lf", &a);
		p[i] = (a + 1) / 2;
	
		cnt += p[i] - p[i - k];
		mx = max(mx, cnt);
	}

	
	cout << fixed << setprecision(10);
	cout << mx;
}



Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String str[] = new String[n];
		for (int i = 0; i < n; i++) {
			String s[] = br.readLine().split("");
			Arrays.sort(s);
			str[i] = "";

			for (int j = 0; j < 10; j++) {
				str[i] += s[j];
			}
		}

		Arrays.sort(str);

		long ans = 0;
		int j = 1;

		for (int i = 0; i < n; i++) {
			if (i == j) {
				j++;
			}
			while (j < n && str[i].equals(str[j])) {
				ans += j - i;
				j++;
			}

		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 101460
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
ll int MOD=998244353;
#define INF 2*1e9
#define N 310000
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

void solve(ll a,ll b){
    if(a==b){
      cout<<1;return ;}
    ll int t=1;
    while(t<=b){
        t<<=1;
    }
    t>>=1;
    
    if(t<=a){
        solve(a-t,b-t);
        return ;
    }
    else{
        ll int s=t;
    s>>=1;
    while(!(s&b)){
        s>>=1;
        if(s==0) break;
    }
    if(s!=0)
    b=t+s*2-1;
        cout<<min(t,t-a+b-t+1)+t-a;
        return ;
    }
}
main(){
    ll a,b;
    cin>>a>>b;
    solve(a,b);
}



Measured memory_bytes: 256
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
     
    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
    #define chmin(a, b) a = min(a, b)
    #define chmax(a, b) a = max(a, b)
     
    using namespace std;
    using ll = unsigned long long;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
     
const int MOD = 1e9 + 7;




int main(){
   int n;
   cin >> n;
   for(int i = 2; i < 1000; i++){
      if(i * (i - 1) / 2 == n){
         vector<vector<int>> fld(i, vector<int>(i - 1));
         int cnt = 0;
         for(int j = 0; j < i; j++){
            for(int k = j; k < i - 1; k++){
               cnt++;
               fld[j][k] = cnt;
            }
         }
         cnt = 0;
         for(int k = 0; k < i - 1; k++){
            for(int j = k + 1; j < i; j++){
               cnt++;
               fld[j][k] = cnt;
            }
         }
         cout << "Yes" << endl;
         cout << i << endl;
         rep(j, i){
            rep(k, i){
               if(k == 0)cout << i - 1 << " ";
               else cout << fld[j][k - 1] << " ";
            }
            cout << endl;
         }
         return 0;
      }
   }
   cout << "No" << endl;
}


Measured memory_bytes: 4324
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
ans = [0] * N
for i in range(N):
    for j in range(i+1,N):
        d1 = j - i
        d2 = abs(X-i) + abs(Y-j) + 1
        ans[min(d1, d2)] += 1
print(*ans[1:], sep='\n')

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
  
    int k, x;
    cin >> k >> x;
  
    for (int i = x - k + 1; i <= x + k - 1; ++i) {
        cout << i << " ";
    }
    cout << endl;
}

Measured memory_bytes: 256