akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define N 100005
#define ll long long
#define For(i,x,y) for(int i=(x);i<=(y);++i)
#define Rof(i,x,y) for(int i=(x);i>=(y);--i)
#define Edge(x) for(int i=head[x];i;i=e[i].nxt)
#define mset(x,y) memset(x,y,sizeof(x))
#define strL strlen
#define p_b push_back
#define mcpy(x,y) memcpy(x,y,sizeof(x))
#define lson l,mid,(o<<1)
#define rson mid+1,r,((o<<1)|1)
#define Ls (t[o].ls)
#define Rs (t[o].rs)
#define mod
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
using namespace std;
int cnt[2],a[N];
int gcd(int x,int y){
	if(x<y) swap(x,y);
	return x%y?gcd(y,x%y):y;
}
int main(){
	int n;bool tk=1;
	scanf("%d",&n);
	For(i,1,n) scanf("%d",&a[i]);
	while(1){
		cnt[1]=cnt[0]=0;
		ll sum=0;int _1=0,pos=0;
		For(i,1,n){
			if(a[i]==1) _1++;
			else{
				sum+=a[i]-1;
				if(a[i]%2) cnt[1]++,pos=i;
				else cnt[0]++;
			}
		}
		if(_1){
			if(sum%2==0) tk^=1;
			if(tk) puts("First");
			else puts("Second"); 
			return 0;
		} else{
			if(cnt[0]%2){
				if(tk) puts("First");
				else puts("Second");
				return 0;
			} else{
				if(cnt[1]>1){
					tk^=1;
					if(tk) puts("First");
					else puts("Second");
					return 0;
				} else{
					a[pos]--;int x=a[1];
					For(i,2,n) x=gcd(a[i],x);
					For(i,1,n) a[i]/=x;
					tk^=1;
				}
			}
		}
	}
}

Measured memory_bytes: 640
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val s = readLine()!!
    val partList = mutableListOf<String>()
    var left = 0
    var right = 1
    while (left < s.length) {
        while (right < s.length && (s[right - 1] != '>' || s[right] != '<')) {
            right++
        }

        partList += s.substring(left, right)

        if (right == s.length) {
            break
        }

        left = right
        right++
    }

    var ans = 0L
    for (s in partList) {
        val tmp1 = s.count { it == '<' }
        val tmp2 = s.count { it == '>' }
        val max = Math.max(tmp1, tmp2) + 0L
        val min  = Math.min(tmp1, tmp2) - 1L
        ans += max * (max + 1) / 2 + min * (min + 1) / 2
    }

    println(ans)
}

//0 <3>2>1> 0 <1<2> 0 <1<2<3<4<5>2>1> 0 < 1

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


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

const int INF = 1000000000;
// 頂点(index)から到達できる頂点
vector<int> to[2505];
// 頂点(index)へ到達できる頂点
vector<int> rto[2505];

bool reachableFrom1[2505];
bool reachableToN[2505];
bool ok[2505];

void dfs(int v) {
  if (reachableFrom1[v]) return;
  reachableFrom1[v] = true;
  for (int u : to[v]) {
    dfs(u);
  }
}

void rdfs(int v) {
  if (reachableToN[v]) return;
  reachableToN[v] = true;
  for (int u : rto[v]) {
    rdfs(u);
  }
}

int main() {
  int n, m, p;
  cin >> n >> m >> p;
  vector<tuple<int, int, int>> edges;
  for (int i=0; i<m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    c -= p;
    c = -c;
    edges.emplace_back(a, b, c);
    to[a].push_back(b);
    rto[b].push_back(a);
  }

  dfs(0);
  rdfs(n-1);

  for (int i=0; i<n; i++) {
    ok[i] = reachableFrom1[i] && reachableToN[i];
  }

  // bellman-ford
  vector<int> d(n, INF);
  d[0] = 0;
  int step = 0;
  bool update = true;
  while (update) {
    update = false;
    for (int i=0; i<m; i++) {
      int a, b, c;
      tie(a, b, c) = edges[i];
      if (!ok[a]) continue;
      if (!ok[b]) continue;
      int newD = d[a] + c;
      if (newD < d[b]) {
        d[b] = newD;
        update = true;
      }
    }
    step++;
    if (step > n) {
      // n-1回updateして、n回目にupdateしない場合はここに入らない
      cout << "-1" << endl;
      return 0;
    }
  }

  int ans = -d[n-1];
  ans = max(ans, 0);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,k;
  while(cin>>n>>k,n){
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    int s[n+1];
    s[0]=0;
    for(int i=0;i<n;i++) s[i+1]=s[i]+a[i];
    int ans=s[k];
    for(int i=0;i<n-k;i++) ans=max(ans,s[i+k]-s[i]);
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 4648
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> B(N - 1);
    rep(i, N - 1) cin >> B[i];
    
    vector<int> A(N, 1e9);
    rep(i, N - 1) {
        A[i] = min(A[i], B[i]);
        A[i + 1] = min(A[i + 1], B[i]);
    }
    int ans = 0;
    rep(i, N) ans += A[i];
    cout << ans << endl;
    return 0;
}


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

const int MAX_SIZE = 200;

// A simplest stack.
class stack {
    public: 
        stack();
        ~stack();
        void push(int value);
        int pop();
        bool is_empty();
        bool is_full();
    private:
        int current;
        int *values;
};

stack::stack() {
    current = -1;
    values = (int*)malloc( sizeof(int) * MAX_SIZE );
}

stack::~stack() {
    free(values);
    values = NULL;
}

void stack::push(int value) {
    if (is_full())
        throw "\nStack is full.";
    values[ ++current ] = value;
}

int stack::pop() {
    if (is_empty())
        throw "\nStack is empty.";
    return values[ current-- ];
}

bool stack::is_empty() {
    return current == -1;
}

bool stack::is_full() {
    return current == MAX_SIZE - 1;
}

// Evaluate the expression.
int evaluate(vector<string>& expr) {
    stack results;
    for (int i = 0; i < expr.size(); i++) {
        string op = expr[i];
        int left, right;

        if (op == "+") {
            right = results.pop();
            left  = results.pop();
            results.push( left + right );
        }
        else if (op == "-") {
            right = results.pop();
            left  = results.pop();
            results.push( left - right );
        }
        else if (op == "*") {
            right = results.pop();
            left  = results.pop();
            results.push( left * right );
        }
        else {
            results.push( std::stoi(op) );
        }
    }
    return results.pop();
}

/* ALDS1_3_A: Stack */
int main() {
    try {
        string op;
        vector<string> expr;
        while (! (cin >> op).eof() ) {
            expr.push_back(op);
        }

        cout << evaluate(expr) << endl;
    } catch(char const *message) {
        cout << message << endl;
    }

    return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#define INF 10000000000000000
#define MOD 1000000007
using namespace std;



int main(){
    int A,B;
  	cin>>A>>B;
      
    cout<<max(A+B,max(A-B,A*B))<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define rep(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) static_cast<int>(x.size())
#define mp make_pair
#define fi first
#define se second

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio(false); cin.tie(nullptr); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod(ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b & 1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

template<typename T> inline void remin(T& x, const T& y) { x = min(x, y); }
template<typename T> inline void remax(T& x, const T& y) { x = max(x, y); }

template<typename T> ostream& operator<<(ostream &os, const vector<T>& v) {
    os << "{"; string sep; for(const auto& x : v) os << sep << x, sep = ", "; return os << "}"; 
}

template<typename T, size_t size> ostream& operator<<(ostream& os, const array<T, size>& arr) {
    os << "{"; string sep; for(const auto& x : arr) os << sep << x, sep = ", "; return os << "}"; 
}

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { 
    return os << '(' << p.first << ", " << p.second << ')'; 
}

constexpr int ms = 1e6 + 13;
vi min_f(ms, 0);
vi primes;
void sieve() {
    for(int i = 2; i < ms; ++i) {
        if(min_f[i] == 0) {
            min_f[i] = i;
            primes.push_back(i);
            for(long long j = (1ll * i) * i; j < ms; j += i) {
                min_f[j] = i;
            }
        }
    }
}

set<int> factor(int n) {
    set<int> F;
    while(n > 1) {
        F.insert(min_f[n]);
        n /= min_f[n];
    }
    return F;
}


int main() {
    buff();
    sieve();
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; ++i) cin >> v[i];
    int G = v[0];
    for(int i = 1; i < n; ++i) G = __gcd(G, v[i]);
    if(G > 1) {
        cout << "not coprime\n";
        return 0;
    }
    map<int, int> prime_freq;
    for(int i = 0; i < n; ++i) {
        auto factors = factor(v[i]);
        for(const auto& val : factors) prime_freq[val]++;
    }
    bool pairwise = true;
    for(const auto& val : prime_freq) if(val.second >= 2) pairwise = false;
    if(pairwise) cout << "pairwise coprime\n";
    else cout << "setwise coprime\n";
    return 0;
}



Measured memory_bytes: 14808
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s; cin>>s;
  int c[30]={};
  int flag=0;
  for(int i=0;i<s.size();++i) c['z'-s[i]]++;
  for(int i=0;i<30;++i)
    if(c[i]>1) flag=1;
  if(flag) cout<<"no\n";
  else cout<<"yes\n";
  return 0;
}


Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60) - 1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    string s;
    cin >> s;
    int n = s.size();
    //reverse(all(s));
    // int dp[13][101010];
    vector<vector<int>> dp(n+1,vector<int> (13));
    dp[0][0]=1;
    rep(i,n){
        if(s[i]!='?'){
            rep(j,13){
                dp[i+1][(10*j+s[i]-'0')%13]+=dp[i][j];
                dp[i+1][(10*j+s[i]-'0')%13]%=MOD;
            }
        }
        else{
            rep(k,10){
                rep(j,13){
                    dp[i+1][(10*j+k)%13]+=dp[i][j];
                    dp[i+1][(10*j+k)%13]%=MOD;
                }
            }
        }
    }
    cout<<dp[n][5]<<endl;
}


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

int n,m,d;
int a[300][300];
long long ans=0;

inline int qr()
{
    int s=0,f=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=(s<<3)+(s<<1)+(ch^48);ch=getchar();}
    return s*f;
}

int main()
{
    n=qr();
    m=qr();
    if(n>=10)
        cout<<m<<endl;
    else
    {
            cout<<m+100*(10-n)<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int N;
  cin>>N;
  if(N%2 == 0){
    cout << 0.5 << endl;
  }
  else{
    double P = ((N/2)+1);
    cout << P/N << endl;
  }
  return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(Args&&... args) const { print(std::forward<Args>(args)...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(T&& head, Tail&&... tail) const { std::cout << head, print_rest(std::forward<Tail>(tail)...); }
        template <class T, class... Tail>
        void print_rest(T&& head, Tail&&... tail) const { std::cout << sep << head, print_rest(std::forward<Tail>(tail)...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
    template <class T>
    void print_vec(const std::vector<T>& vec, const char* sep = " ", const char* term = "\n") const {
        const size_t sz = vec.size();
        for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
    }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N, Z, W;
    cin >> N >> Z >> W;
    Vl A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    if (N == 1) {
        prints()(abs(A[0] - W));
    }
    else {
        prints()(max(abs(W - A[N - 1]), abs(A[N - 2] - A[N - 1])));
    }
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}
int main(){
  ll a,b,c,d,e,f;scanf("%lld%lld%lld%lld",&a,&b,&c,&d);a--;
  e = a-a/c-a/d+a/lcm(c,d);
  f = b-b/c-b/d+b/lcm(c,d);
  printf("%lld\n",f-e);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

vector<UL> Divs(UL a, UL p = 2) {
	if (a == 1) return { 1 };
	for (; a % p != 0; p++) if (p * p > a) return { 1, a };
	UL n = 1;
	for (; a % p == 0; n++) a /= p;
	vector<UL> buf = Divs(a, p + 1 | 1);
	UL i = buf.size(), l = buf.size();
	buf.resize(i * n);
	for (; i < buf.size(); i++) buf[i] = buf[i - l] * p;
	return buf;
}

const ULL M = 998244353;

ULL F(const string& a, UL s) {
	bool less = false;
	for (UL i = 0; i < a.size() - s; i++) {
		if (a[i] != a[i + s]) continue;
		less = a[i] == '0';
		break;
	}
	ULL tmp = 0;
	rep(i, s) {
		tmp <<= 1;
		tmp += a[i] - '0';
		if (tmp >= M) tmp -= M;
	}
	if (!less) tmp = (tmp + 1) % M;
	return tmp;
}

struct Problem {

	void Solve() {
		UL N; cin >> N;
		vector<UL> D = Divs(N);
		sort(D.begin(), D.end());
		string S; cin >> S;
		rep(i, N) S.push_back('0' + '1' - S[i]);

		vector<ULL> V(D.size());
		rep(i, D.size()) {
			UL d = D[i];
			if (N / d % 2 == 0) continue;
			ULL f = F(S, d);
			V[i] += f;
			V[i] %= M;
			for (UL j = i + 1; j < D.size(); j++) {
				if (D[j] % d == 0) {
					V[j] += (M - V[i]);
				}
			}
		}
		ULL ans = 0;
		rep(i, D.size()) {
			ans += (ULL)D[i] * V[i];
			ans %= M;
		}
		ans = ans * 2 % M;
		cout << ans << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 900
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s1;
    cin >> s1;
    int k;
    cin >> k;
    int n = s1.size();
    vector<string> a(0);
    
    for(int i=1;i<min(6,n+1);i++){
        for(int j=0;j<n-i+1;j++){
            string tmp = s1.substr(j,i);
            a.push_back(tmp);
        }
    }
    // rep(i,a.size()){
    //     if(a[i]=="\n"){
    //         a[i] == "zzzzz";
    //     }
    // }
    sort(a.begin(),a.end());
    // rep(i,500){
    //     cout << a[i] << endl;
    // }
    if(n==1){
        cout << s1 << endl;
        return 0;
    }
    if(k==1){
        cout << a[0] << endl;
        return 0;
    }
    int cnt = 0;
    for(int i=1;i<a.size();i++){
        if(a[i]==a[i-1]){
            k++;
        }
        if(k==i+1){
            // cout << k-1 << endl;
            cout << a[k-1] << endl;
            return 0;
        }

    }

    return 0;
}

Measured memory_bytes: 4304
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    string a, b;
    cin >> a >> b ;
    //*/
    int cnt = 0;

    for(int i = 0; i < min(a.size(), b.size()); i++){
        if(a.at(i) == b.at(i)){
            cnt++;
        }
    }

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    //*/
    
    /*
    if( a < b ){
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
    //*/
    
    cout << cnt << endl;

    return 0; 
}


Measured memory_bytes: 3604
import java.util.*;
import static java.lang.System.*;
import java.io.*;
import java.math.*;

public class Main {
		static long cnt = 0;
		static long keta, k , minus;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int k = sc.nextInt();
		int cnt =0;
		long num = 0;
		Queue<Long> que = new ArrayDeque<>();
		for(long i = 1; i <= 9; i++)
			que.offer(i);
		while(true) {
			num = que.poll();
			cnt++;
			if(cnt == k) {
				break;
			}
			if( num % 10 != 0)
				que.offer( num * 10 + ((num % 10) - 1));
			que.offer(num * 10 + num % 10);
			if (num % 10 != 9)
				que.offer(num * 10 + ((num % 10) + 1));
		}
		out.println(num);
		
		out.close();
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}

Measured memory_bytes: 29908
#![allow(unused_imports)]
#![allow(unused_variables)]

use itertools::Itertools;
use proconio::marker::*;
use proconio::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [Usize1; n-1],
    }
    // annotate for rust-analyzer
    let n: usize = n;
    let a: Vec<usize> = a;

    let mut anss = vec![0; n];
    for i in 0..n - 1 {
        anss[a[i]] += 1;
    }
    for j in anss {
        println!("{}", j);
    }
}


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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...)
#endif

const int N = 2048;

bitset<N> f[N], frev[N], dp0[N], dp1[N], dp0rev[N], dp1rev[N];
bitset<N> win[N];
char s[N];
int main(){
	int n; sd(n);
	for(int i = 2; i <= n; i++){
		scanf("%s", s);
		for(int j = 1; j < i; j++){
			int x = s[j - 1] - '0';
			if(x) win[i][j] = 1, win[j][i] = 0;
			else win[j][i] = 1, win[i][j] = 0;
		}
	}


	for(int i = 1; i <= n; i++) dp0[i][i] = dp1[i][i] = dp0rev[i][i] = dp1rev[i][i] = 1;

	for(int i = n; i >= 1; i--){
		for(int j = i + 1; j <= n; j++){
			f[i][j] = ((dp0[i] << 1) & dp1[j]).any();
			frev[j][i] = f[i][j];
			dp0[i][j] = (win[i] & f[i] & dp0rev[j]).any();
			dp1[j][i] = (win[j] & frev[j] & dp1rev[i]).any();

			dp0rev[j][i] = dp0[i][j];
			dp1rev[i][j] = dp1[j][i];

		}
	}

	int ans = 0;
	for(int i = 1; i <= n; i++){
		if(dp1[i][1] && dp0[i][n]){
			ans++;
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 3712
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  
  cout << (k%2==0?a-b:b-a) << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int x,y ;
    while(1){
        cin >> x >> y ;
        if(x == 0 && y == 0 ) break;
        if( x < y ){
            cout << x << " " << y << endl;
        }else{
            cout << y << " " << x << endl;
    }
        }
            
return 0;
        }

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n,a,b;
    while(cin>>n>>a>>b){
        cout<<min(b,(n*a))<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.io._
import scala.io.StdIn.{readLine, readInt}

object Main {
  val out:BufferedWriter =
    new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512)
  var count = 0

  def toZero(x:Double) = if(x == -0.0) 0.0 else x
  def main(args:Array[String]) = {
   val p = readLine.split(" ").map(_.toDouble)
   val n = readInt

   val (x0,y0,x1,y1) = (p(0),p(1),p(2),p(3))
   for(i<-0 until n) {
     val p1 = readLine.split(" ").map(_.toDouble)
     val (x2,y2) = (p1(0),p1(1))
     val sqrt = Math.pow(x1-x0,2) + Math.pow(y1-y0,2)
     val inner = (x1-x0)*(x2-x0) + (y1-y0)*(y2-y0)
     val (xt,yt) = (inner*(x1-x0)/sqrt + x0, inner*(y1-y0)/sqrt + y0)
     out.write(toZero(xt).toString)
     out.write(" ")
     out.write(toZero(yt).toString)
     out.write("\n")
     if(count<100) count += 1
     else {
      out.flush
      count = 0
     }
   }
   out.flush
   out.close
  }
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

double x;

int main()
{
  while(cin >> x){
    if(x <= 48.00){          cout << "light fly"    << endl;  continue; }
    if(48.00<x && x<=51.00){ cout << "fly"          << endl;  continue; }
    if(51.00<x && x<=54.00){ cout << "bantam"       << endl;  continue; }
    if(54.00<x && x<=57.00){ cout << "feather"      << endl;  continue; }
    if(57.00<x && x<=60.00){ cout << "light"        << endl;  continue; }
    if(60.00<x && x<=64.00){ cout << "light welter" << endl;  continue; }
    if(64.00<x && x<=69.00){ cout << "welter"       << endl;  continue; }
    if(69.00<x && x<=75.00){ cout << "light middle" << endl;  continue; }
    if(75.00<x && x<=81.00){ cout << "middle"       << endl;  continue; }
    if(81.00<x && x<=91.00){ cout << "light heavy"  << endl;  continue; }
    if(91.00<x){             cout << "heavy"        << endl;  continue; }
  }

  return 0;
}

Measured memory_bytes: 1220
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;
using LL = long long;

int main(void)
{
	int r, g, b;
	cin >> r >> g >> b;
	if ((r * 100 + g * 10 + b) % 4)
	{
		cout << "NO" << endl;	
	}
	else
	{
		cout << "YES" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int N = 3e5, M = N;
//=======================

vi g[N];

void solve() {
	int i, j, n, m;
	cin>>n;
	cout<<!n;
}

int32_t main()
{
	FIO;
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	solve();
	return 0;
}

void ipgraph(int n, int m) {
	int i, u, v;
	while (m--) {
		cin >> u >> v;
		u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par) {
	for (int v : g[u]) {
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 10644
from collections import deque

def Topologicalsort(v):
    start=deque()
    for i in xrange(v):
        if indeg[i]==0 :
            start.append(i)
    if len(start)>1:
        flag=True
    else:
        flag=False
    while len(start)>0:
        i=start.popleft()
        ans.append(i)
        cnt=0
        for j in g[i]:
            indeg[j]-=1
            if indeg[j]==0:
                cnt+=1
                start.append(j)
                if cnt>1:
                    flag=True
    return ans,flag

def solve(n,m):
    for i in xrange(m):
        wt,lt=map(int,raw_input().split())
        wt-=1;lt-=1
        g[wt].append(lt)
        indeg[lt]+=1
    ans,flag=Topologicalsort(n)
    return ans,flag

n=int(raw_input())
m=int(raw_input())
indeg=[0]*n
g=[[] for _ in xrange(n)]
ans=[]

ans,flag=solve(n,m)

if flag:
    for i in xrange(n):
        print(ans[i]+1)
    print(1)
else:
    for i in xrange(n):
        print(ans[i]+1)
    print(0)

Measured memory_bytes: 10372
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] a = new int[n];
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		}
		int count=0;
		int hikari =1;//光るボタンのインデックス
		for (int i=0;;i++){
			hikari = a[hikari-1];
			count++;
			if(hikari==2) {
				break;
			}else if(count>n) {
				count=-1;
				break;
			}
		}

		System.out.println(count);

	}

}


Measured memory_bytes: 52252
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef long double ld;
using namespace std;
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;

int main(void){
    string result = "No";
    ll N;
    string S;
    ll K;
    cin >> N >> S >> K;
    string s = S.substr(K-1, 1);
    rep(i, S.size()){
        if(S[i] != s[0]){
            S[i] = '*';
        }
    }
    
    
    cout << S << endl;
    return 0;
}


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

char a[16], word[16] = {'C', 'O', 'D', 'E', 'F', 'E', 'S', 'T', 'I', 'V', 'A', 'L', '2', '0', '1', '6'};
int answer;

int main()
{
    cin >> a;
    for(int i = 0; i < 16; i ++)
      if(a[i] !=word[i]) 
        answer++;
    cout << answer << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) cin >> a[i];
	LL ans = 0;
	sort(a + 1, a + m + 1);
	ans = a[m] - a[1];
	vector<int> v;
	for (int i = 1; i + 1 <= m; i++) v.push_back(a[i + 1] - a[i]);
	sort(v.rbegin(), v.rend());
	n--;
	n = min(n, m - 1);
	for (int i = 0; i < n; i++) ans -= v[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

int main()
{
    double a, b, x;
    cin >> a >> b >> x;
    double ans;
    double a2 = 2 * x / (a * b);

    if (a2 < a)
    {
        double tan = 2 * x / (a * b * b);
        ans = atan(tan);
    }
    else
    {
        double tan = (a * a) / ((a * b) - (x / a));
        tan /= 2;
        ans = atan(tan);
    }
    ans = rad_to_deg(ans);
    cout << setprecision(13) << 90 - ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

        static class TaskB {
                public void solve(int testNumber, InputReader in, PrintWriter out) {
                        int a = Integer.parseInt(in.s() + "" + in.s());
                        if (isSquare(a)) {
                                out.println("Yes");
                        } else {
                                out.println("No");
                        }
                }

                boolean isSquare(int a) {
                        int temp = (int) Math.sqrt(a);
                        if (temp * temp == a) return true;
                        return false;
                }

        }

        static class InputReader {
                InputStream is;
                private byte[] inbuf = new byte[1024];
                public int lenbuf = 0;
                public int ptrbuf = 0;

                public InputReader(InputStream is) {
                        this.is = is;
                }

                private int readByte() {
                        if (lenbuf == -1) throw new InputMismatchException();
                        if (ptrbuf >= lenbuf) {
                                ptrbuf = 0;
                                try {
                                        lenbuf = is.read(inbuf);
                                } catch (IOException e) {
                                        throw new InputMismatchException();
                                }
                                if (lenbuf <= 0) return -1;
                        }
                        return inbuf[ptrbuf++];
                }

                private boolean isSpaceChar(int c) {
                        return !(c >= 33 && c <= 126);
                }

                private int skip() {
                        int b;
                        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
                        return b;
                }

                public String s() {
                        int b = skip();
                        StringBuilder sb = new StringBuilder();
                        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
                                sb.appendCodePoint(b);
                                b = readByte();
                        }
                        return sb.toString();
                }

        }
}



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

using namespace std;
using ll=long long;
using Graph=vector<vector<int> >;
Graph G(25);
void pre(int n){
    if(n==-1)return;
    cout <<" "<<n;
    for(int k:G[n]){
        pre(k);
    }
}
void in(int n){
    if(n==-1)return;
    in(G[n][0]);
    cout << " "<<n;
    in(G[n][1]);
}
void post(int n){
    if(n==-1)return;
    for(int k:G[n]){
        post(k);
    }
    cout <<" "<< n;
}



int main()
{
    int n;cin >>n;
    bool c[n];
    for(int i=0;i<n;i++){
        c[i]=true;
    }
    for(int i=0;i<n;i++){
        int id,left,right;
        cin >>id >>left>>right;
        G[id].push_back(left);
        G[id].push_back(right);
        c[left]=false;
        c[right]=false;
    }
    int f;
    for(int i=0;i<n;i++)if(c[i])f=i;
    cout << "Preorder"<< endl;
    pre(f);cout << endl;
    cout << "Inorder"<< endl;
    in(f);cout << endl;
    cout << "Postorder"<< endl;
    post(f);cout << endl;
    return 0;
}



Measured memory_bytes: 3152
line = [int(i) for i in input().split(' ')]
set_line = set(line)
A = [int(i) for i in input().split(' ')]
B = [int(i) for i in input().split(' ')]
C = []
for i in range(line[2]):
  C.append([int(i) for i in input().split(' ')])
  
if line.count(1) == 3:
  print(A[0] + B[0] - C[2])
else:
  min_price = min(A) + min(B)
  for i in range(len(C)):
    price = A[(C[i][0] - 1)] + B[(C[i][1] - 1)] - C[i][2]
    if min_price > price:
      min_price = price
  print(min_price)

Measured memory_bytes: 32496
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
int main() {
	char s[200005];
	int ans[200005];
	ll sum = 0;
	scanf(" %s", s + 1);
	int len = strlen(s + 1);
	int t = 1;
	for(int i = 1; i <= len; i++) {
		if(s[i] == 'B') {
			ans[t] = i;
			t++;
		}
	}
	for(int i = 1; i <= t - 1; i++) {
		sum += len - ans[i];
		len--;
	}
	printf("%lld\n", sum);
	return 0;
}



Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define int long long int
#define ii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
#define MOD 1000000007
#define output(x) for (auto a:x) cout<<a<<" ";cout<<endl;
#define output2(x) for (auto a:x) cout<<a.fi<<" "<<a.se<<endl;
 
int power(int x,int y,int mod) 
{ 
 	int ret = 1;
 	x = x % mod;
 	while (y){
 		if(y&1) ret = (ret*x)%mod;
 		y = y>>1;
 		x = (x*x)%mod;
    } 
    return ret%mod; 
}

int isprime(int x)
{
	for (int i=2;i*i<=x;i++)
		if (x%i==0) return 0;
	return 1;
}


void solve()
{		
	int n,m;
	cin>>n>>m;
	vector<string> inp(n);
	for (int i=0;i<n;i++)
		cin>>inp[i];
	vector<vector<int>> grid(n,vector<int>(m));
	vector<vector<int>> dp(n,vector<int>(m));
	auto convert = [&] (int i,int j){
		return inp[i][j]=='.' ? 1 : 0;
	};
	for (int i=0;i<n;i++){
		for (int j=0;j<m;j++){
			grid[i][j] = convert(i,j);
		}
	}
	dp[n-1][m-1] = convert(n-1,m-1);
	for (int i=n-1,j=m-2;j>-1;j--){
		if (convert(i,j+1))
		dp[i][j] = dp[i][j+1];
	}
	for (int i=n-2,j=m-1;i>-1;i--){
		if (convert(i+1,j))		
		dp[i][j] = dp[i+1][j];
	}
	for (int i=n-2;i>-1;i--){
		for (int j=m-2;j>-1;j--){
			if (convert(i+1,j))
				dp[i][j]+=dp[i+1][j];
			dp[i][j]%=MOD;
			if (convert(i,j+1))
				dp[i][j]+=dp[i][j+1];
			dp[i][j]%=MOD;
		}
	}
	cout<<dp[0][0]<<endl;
}
 
 
signed main(){
	// int t;
	// cin>>t;
	// while (t--)	
	solve();	
 
}
	

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

int main(void) {
    int a[1000] = {};
    int n;
    
    cin >> n;
    
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for(int i = 0; i < n; ++i) {
        for(int j = i; j > 0; --j) {
            if(a[j] < a[j - 1]) {
                int copy = a[j];
                a[j] = a[j - 1];
                a[j - 1] = copy;
            }
        }
        cout << a[0];
        for(int j = 1; j < n; ++j) {
            cout << ' ' << a[j];
        }
        cout << endl;
    }
}


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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 100005;

bool test(ll x, ll i){
	while(x%i == 0)
		x/=i;
	return (x%i==1);
}

void solve(){
	ll n;
	cin >> n;
	set<ll> st;
	st.insert(n);
	if(n-1 >= 2)st.insert(n-1ll);
	st.insert(2ll);
	n--;
	for(ll i = 2; i <= sqrt(n); i++){
		if(n % i == 0){
			if(i == n/i and i != 1)
				st.insert(i);
			else{
				if(i != 1)
					st.insert(i);
				if(n/i != 1)
					st.insert(n/i);
			}
		}
	}
	n++;
	for(ll i = 2; i <= sqrt(n); i++){
		if(n % i == 0){
			if(i == n/i and i != 1 and test(n, i))
					st.insert(i);
			else{
				if(i != 1 and test(n,i))
					st.insert(i);
				if(n/i != 1 and test(n, n/i))
					st.insert(n/i);
			}
		}
	}
	cout << st.size() << endl;
}

int main(){
	fastio;
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin >> a;
  
  int b, c;
  b = a/100;
  c = a%100;
 
  if ( 1 <= b && b <= 12 ) {
    if ( 1 <= c && c <= 12 ) {
      cout << "AMBIGUOUS" << endl;
    }
    else {
    cout << "MMYY" << endl;
    } 
  }
  else if ( 1 <= c && c <= 12 ) {
    cout << "YYMM" << endl;
  }
  else {
    cout << "NA" << endl;
  }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
s = n * (n+1) // 2
t = sum(a)
if t % s:
    print("NO")
    quit()
m = t // s
d = [a[(i+1)%n] - a[i] - m for i in range(n)]
k = 0
for x in d:
    if x > 0 or x % n:
        print("NO")
        quit()
    k += -x // n
print("YES" if k == m else "NO")

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

#define pb push_back
#define fst first
#define snd second
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int main() {FIN;
   string s;cin>>s;
   string ans = "Yes";
   fore(i,0,s.length()){
        int c = 0;
        char cur = s[i];
        fore(j,0,s.length()){
            if(cur==s[j])c++;
        }
        if(c%2!=0){ans="No";break;}
   }cout<<ans<<"\n";
    return 0;
}




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

int main() {
  string s;
  cin >> s;
  int p = 700;
  for (int i = 0; i < 3; i++) {
    if (s.at(i) == 'o') {
      p += 100;
    }
  }
  cout << p << endl;
}

Measured memory_bytes: 256
from collections import deque

n,k,l = map(int,input().split())
ep = [[] for i in range(n)]
er = [[] for i in range(n)]

gp = [-1]*n
gr = [-1]*n

for i in range(k):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    ep[a].append(b)
    ep[b].append(a)
for i in range(l):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    er[a].append(b)
    er[b].append(a)

def dfs(e,g):
    count = 0
    for i in range(n):
        if g[i] == -1:
            g[i] = count

            q = deque([])
            q.append(i)
            while q:
                now = q.pop()

                for nex in e[now]:
                    if g[nex] == -1:
                        g[nex] = g[now]
                        q.append(nex)
            count += 1

    return g
gp = dfs(ep,gp)
gr = dfs(er,gr)
l = []
dic = {}
for i in range(n):
    s = (gp[i],gr[i])
    l.append(s)
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
ans = [0]*n

for i in range(n):
    ans[i] = dic[l[i]]
print(*ans)

Measured memory_bytes: 125280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

/* modとる */
inline ll modu(ll a){
    return(a % mod + mod) % mod;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N = in<ll>();
    ll answer = 0;
    vector<ll> A(N);
    REP(i,N)A[i] = in<ll>();
    REP(i,62){
        ll sum = 0;
        REP(l,N){
            if(A[l] & 1LL << i)sum++;
        }
        answer +=modu(modu(sum*(N-sum))*modu(1LL << i));
        answer = modu(answer);
    }
    cout << answer << "\n";
}

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

using namespace std;

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

    long long n;
    cin>>n;
    long long a = n/100;
    long long b=(n-a*100)/10;
    long long c=(n-a*100-b*10);
    if(a==7 || b==7 || c==7)
        cout<<"Yes";
    else
        cout<<"No";


    return 0;
}


Measured memory_bytes: 3652
N = gets.to_i
Cs = Array.new(N)
Ss = Array.new(N)
Fs = Array.new(N)
(N - 1).times do |i|
  Cs[i], Ss[i], Fs[i] = gets.split.map(&:to_i)
end

N.times do |k|
  t = 0
  k.upto(N - 2) do |i|
    t = [t, Ss[i]].max
    r = (t - Ss[i]) % Fs[i]
    t += Fs[i] - r if r.positive?
    t += Cs[i]
  end
  puts t
end


Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repc(i,s,n) for(int i=s;i<n;i++)
using namespace std;
int main(void){
    int n,ans=0,x,d,tmp,count;
    cin>>n;
    vector<int> v(n);
    rep(i,n) cin>>v[i];
    sort(v.begin(),v.end());
    rep(i,n){
        x=v[i];
        repc(j,i+1,n){
            d=v[j]-x;
            tmp=v[j];
            count=2;
            while(true){
                if(binary_search(v.begin(), v.end(), tmp+d)){
                    count++;
                    tmp+=d;
                }else{
                    ans=max(ans,count);
                    break;
                }
            }
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3152