akhauriyash/Code-Regression huggingface dataset:
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

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

void solve()
{
	int i,j;
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a<<endl;

}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main(){
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  rep(i, m) cin >> b[i];
  int cnt = 0;
  rep(i, n){
    int sum = 0;
    rep(j, m){
      int num;
      cin >> num;
      sum += num*b[j];
    }
    sum += c;
    if(sum>0) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */

int main() {
    int N; cin >> N;
    string S;
    map<string, int> m;
    rep(i, N) cin >> S, m[S] = 1;
    int ans = 0;
    for(auto i = m.begin(); i != m.end(); ++i) {
        ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 19064
require 'set'

class Set
  def move(dx, dy, dz)
    each do |a|
      a[0] += dx
      a[1] += dy
      a[2] += dz
    end
  end

  def invalid?(other = nil)
    if other
      return true if any? {|a|
        # other.include?(a)  Bug?
        other.to_a.include?(a)
      }
    end
    any? {|x, y, z| x < 0 || x > 1 || y < 0 || y > 1 || z < 0 }
  end

  def cleanup
    k = 0
    g = group_by(&:last)
    g.keys.sort.each do |i|
      if g[i].size == 4
        k += 1
        g[i].each do |a|
          delete(a)
        end
      else
        g[i].each do |a|
          a[2] -= k
        end
      end
    end
    k
  end

  def height
    empty? ? 0 : (map(&:last).max + 1)
  end
end

loop do
  initial_h, n = gets.split.map(&:to_i)
  break if n == 0

  initial_block = Set.new
  initial_h.times do |k|
    (0..1).each do |i|
      s = gets
      (0..1).each do |j|
        initial_block << [i, j, k] if s[j] == ?#
      end
    end
  end

  new_blocks = []
  n.times do
    new_block = Set.new
    2.times do |k|
      (0..1).each do |i|
        s = gets
        (0..1).each do |j|
          new_block << [i, j, k] if s[j] == ?#
        end
      end
    end
    new_blocks << new_block
  end

  diffs = [-1, 0, 1].repeated_permutation(2).to_a
  best = 0
  (0..8).to_a.repeated_permutation(n) do |pattern|
    block = Marshal.load(Marshal.dump(initial_block))
    h = initial_h
    cleared = 0

    (0..n-1).each do |i|
      new_block = Marshal.load(Marshal.dump(new_blocks[i]))
      new_block.move(0, 0, h)
      new_block.move(*diffs[pattern[i]], 0)
      if new_block.invalid?
        cleared = 0
        break
      end

      new_block.move(0, 0, h)
      until new_block.invalid?(block)
        new_block.move(0, 0, -1) 
      end
      new_block.move(0, 0, 1)

      block += new_block
      cleared += block.cleanup
      h = block.height
    end

    best = cleared if cleared > best
  end

  p best
end



Measured memory_bytes: 10116
fn main() {
    let (n,m,k) = {
        let v: Vec<usize> = read_vec();
        (v[0], v[1], v[2])
    };
    let fact = |n| (2..n+1).fold(F(1), |f, a| f * F(a as u64));
    let comb = fact(n*m-2) / fact(n*m-k) / fact(k-2);
    let solve = |n, m| {
        let mut res = F(0);
        let (h, w) = (F(n as u64), F(m as u64));
        for d in 1..n {
            let d = F(d as u64);
            res += d*(h-d);
        }
        res * comb * w * w
    };
    println!("{}", solve(n,m)+solve(m,n));
}
fn get_line() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf.trim().to_owned()
}

fn read<T: std::str::FromStr>() -> T{
    get_line().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T>{
    get_line().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

#[derive(Copy, Clone)]
struct F(u64);
const MOD:u64 = 1000000007;

impl F {
    pub fn new(n: i32) -> Self { F((MOD as i32 + n)as u64%MOD) }
    pub fn pow(self, mut exp: u32) -> Self {
        let mut base = self.0;
        let mut acc = 1;
        while exp > 1 {
            if (exp & 1) == 1 { acc *= base; acc %= MOD; }
            exp /= 2; base *= base; base %= MOD;
        }
        if exp == 1 { acc *= base; acc %= MOD; }
        F(acc)
    }
}
impl std::ops::Mul for F {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self {F((self.0 * rhs.0)%MOD)}
}
impl std::ops::MulAssign for F {
    fn mul_assign(&mut self, rhs: Self) {*self = F((self.0 * rhs.0)%MOD)}
}
impl std::ops::Add for F {
    type Output = Self;
    fn add(self, rhs: Self) -> Self {F((self.0 + rhs.0)%MOD)}
}
impl std::ops::AddAssign for F {
    fn add_assign(&mut self, rhs: Self) {*self = F((self.0 + rhs.0)%MOD)}
}
impl std::ops::Neg for F {
    type Output = Self;
    fn neg(self) -> Self {if self.0==0 {F(0)} else {F(MOD-self.0)}}
}
impl std::ops::Sub for F {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self {F((self.0 - rhs.0 + MOD)%MOD)}
}
impl std::ops::SubAssign for F {
    fn sub_assign(&mut self, rhs: Self) {*self = F((self.0 - rhs.0 + MOD)%MOD)}
}
impl std::ops::Div for F {
    type Output = Self;
    fn div(self, rhs: Self) -> Self {F(self.0 * rhs.pow(MOD as u32-2).0 %MOD)}
}
impl std::ops::DivAssign for F {
    fn div_assign(&mut self, rhs: Self) {*self = F(self.0 * rhs.pow(MOD as u32-2).0 %MOD)}
}
impl std::cmp::PartialEq for F {
    fn eq(&self, rhs: &Self) -> bool {self.0 == rhs.0}
}
impl std::fmt::Display for F {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}


Measured memory_bytes: 4352
// 2016/05/23 Tazoe

#include <iostream>
#include <list>
using namespace std;

int main()
{
	int N, M, Q;
	cin >> N >> M >> Q;

	list<int> L;

	for(int i=0; i<N; i++){
		L.push_back(i);
	}

	list<int>::iterator btn = L.begin();

	for(int i=0; i<M; i++){
		int a;
		cin >> a;

		if(a%2==0){	// ??¶??°
			for(int j=0; j<a; j++){
				btn++;
				if(btn==L.end()){
					btn = L.begin();
				}
			}
		}
		else{		// ?\???°
			for(int j=0; j<a; j++){
				if(btn==L.begin()){
					btn = L.end();
				}
				btn--;
			}
		}

		list<int>::iterator it = btn;
		btn++;
		if(btn==L.end()){
			btn = L.begin();
		}

		L.erase(it);
	}

	for(int i=0; i<Q; i++){
		int q;
		cin >> q;

		list<int>::iterator it;

		for(it=L.begin(); it!=L.end(); it++){
			if(*it==q)
				break;
		}

		if(it!=L.end()){	// ???????????£???
			cout << 1 << endl;
		}
		else{			// ????????????????????£???
			cout << 0 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 7440
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N;
	cin >> N;
	int count = 0;
	int countD = 0;
	for(int x = 1; x<=N; x+=2){
		for(int y = 1;y<=x;y++){
			if(x%y==0){
				countD++;
			}
		}
		if(countD==8){
			count++;
		}
		countD=0;
	}
	cout << count;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[1000005];
ll tp[1000005];
ll l[1000005];
ll h[1000005];
vector<ll> e[1000005];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll k;
    string s;
    cin >> k;
    cin >> s;
    int len = s.length();
    if(len <= k)
    {
        cout << s << "\n";
    }
    else
    {
        for(int i = 0; i < k; i++)
        {
            cout << s[i];
        }
        cout << "...\n";
    }
    return 0;
}


Measured memory_bytes: 27092
N, M=list(map(int, input().split()))
problem = []
result  = []
for _ in range(M):
    str_list = input().split(' ')
    problem.append(int(str_list[0]))
    result.append(str_list[1])

#first_AC = [False]*N
#pena     = [0]*N
first_AC = [0 for i in range(N)]
pena     = [0 for i in range(N)]
for (p, r) in zip(problem, result):
    if first_AC[p-1]==0:
        if r=='WA':
            pena[p-1] += 1
        elif r=='AC':
            first_AC[p-1]=1
collect    = sum(first_AC)
temp       = [x * y for (x, y) in zip(first_AC, pena)]
total_pena = sum(temp)
#print('%d %d' % (collect, total_pena))
print(str(collect)+' ', end='')
print(total_pena)


Measured memory_bytes: 15740
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main(){
  while (1){
    string A;
    cin >> A;
    if (A == "0"){
      break;
    }
    string B;
    cin >> B;
    string C;
    cin >> C;
    int N = A.size();
    vector<vector<long long>> dp(N + 1, vector<long long>(2, 0));
    dp[N][0] = 1;
    for (int i = N - 1; i >= 0; i--){
      for (int j = 0; j <= 9; j++){
        for (int k = 0; k <= 9; k++){
          for (int l = 0; l <= 9; l++){
            if (!(i == 0 && (j == 0 || k == 0 || l == 0))){
              for (int m = 0; m < 2; m++){
                if (A[i] == '?' || A[i] == '0' + j){
                  if (B[i] == '?' || B[i] == '0' + k){
                    if (C[i] == '?' || C[i] == '0' + l){
                      int sum = j + k + m;
                      if (sum % 10 == l){
                        dp[i][sum / 10] += dp[i + 1][m];
                        dp[i][sum / 10] %= MOD;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    cout << dp[0][0] << endl;
  }
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
bool yea(pair<int,int> a,pair<int,int> b){
  if(a.second<b.second)
    return true;
  else if(a.second==b.second){
    if(a.first>b.first)
      return true;
    else
      return false;
  }
  else
    return false;
}
signed main(){
  int a,d=1;
  long long c=0;
  cin>>a;
  vector<pair<int,int>> b(a);
  fo(i,a)
    cin>>b[i].first>>b[i].second;
  sort(b.begin(),b.end(),yea);
  fo(i,a){
    c+=b[i].first;
    if(c>b[i].second)
      d=0;
  }
  if(d)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

int main() {
    int x;
    cin >> x;
    if(x>=30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9 + 10;

ll N;

int main() {
    cin >> N;
    string res = "";
    while(N) {
        --N;
        res += (char)('a' + (N%26));
        N /= 26;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
}

Measured memory_bytes: 3628
using System.Collections.Generic;
using System.Linq;
using System;
using static System.Console;

class Program
{
  static void Main() => new Program().solve();

  void solve()
  {
    var n = int.Parse(ReadLine());
    var p = ReadLine().Split(' ').Select(int.Parse).ToArray();

    var ans = p.Aggregate(new Tuple(0, 1, false), (t, i) =>
      (i == t.cnt && !t.isSwapped)
        ? new Tuple(t.acc + 1, t.cnt + 1, true)
        : new Tuple(t.acc, t.cnt + 1, false)
    ).acc;

    WriteLine(ans);
  }

  struct Tuple
  {
    public int acc { get; set; }
    public int cnt { get; set; }
    public bool isSwapped { get; set; }

    public Tuple(int a, int b, bool c)
    {
      acc = a; cnt = b; isSwapped = c;
    }
  }
}

Measured memory_bytes: 20192
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define for1(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define endl '\n'
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    string s;
    cin >> s;
    string code = "CODEFESTIVAL2016";
    int cnt = 0;
    rep(i, s.size()) {
        if (s[i] != code[i]) {
            cnt++;
        }
    }
    cout << cnt << endl;
	return 0;
}

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

using namespace std;

#define MOD 1000000007

int dp[100000];//星iに到着する通り数
int cnt[26];//それ以前の文字aという星に行く通り数

string s,t;

int main(){ 

  int n;

  cin>>n;

  cin>>s>>t;

  cnt[s[0]-'a']=1;
  
  for(int i=1;i<n;i++){

    (dp[i]+=cnt[t[i]-'a'])%=MOD;
    
    (cnt[s[i]-'a']+=dp[i])%=MOD;
    
  }

  cout<<dp[n-1]<<endl;

  return 0;
  
}




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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n;
  cin>>n;

  ll ans=-1;
  for(ll k=2; k*(k-1)<=n*2; k++){
    if(n*2%k!=0)
      continue;
    if((n*2-k*(k-1))!=0)
      continue;
    ans=k;
  }

  if(ans>0){
    vvll a(ans);
    ll cnt=1;
    REP(i,ans){
      for(ll j=i+1; j<ans; j++){
        a[i].push_back(cnt);
        a[j].push_back(cnt);
        cnt++;
      }
    }


    yes;
    cout<<ans<<endl;
    REP(i,ans){
      cout<<a[i].size();
      REP(j,a[i].size())cout<<" "<<a[i][j];
      cout<<endl;
    }
  }
  else
    no;
}



Measured memory_bytes: 3200
n,m = map(int,input().split())
x = list(map(int, input().split()))
x_new = sorted(x)
intervals = [0]*(m-1)
for i in range(m-1):
  intervals[i] = abs(x_new[i+1] - x_new[i])
c = sorted(intervals, reverse=True)
s = 0
if n < m:
    for j in range(n-1):
        s += c[j]
    min = sum(intervals) - s
    print(min)
else:
    print(0)

Measured memory_bytes: 13968
fun main() {
    val builder = StringBuilder()

    val t = readInputLine().toInt()

    repeat(t) {
        val n = readInputLine().toInt()
        val aArr = readInputLine().split(" ").map { it.toLong() }
        val s = readInputLine().toCharArray()

        val dp = Array(n + 1) { mutableSetOf<Long>() }

        dp[n].add(0L)

        for (i in n - 1 downTo 0) {
            when(s[i]) {
                '0' -> {
                    dp[i] = dp[i + 1].toMutableSet()
                    var tmp = aArr[i]

                    for (b in dp[i + 1]) {
                        if (tmp xor b < tmp) {
                            tmp = tmp xor b
                        }
                    }

                    if (tmp != 0L) {
                        dp[i].add(tmp)
                    }
                }
                else -> {
                    var tmp = aArr[i]

                    for (b in dp[i + 1]) {
                        if (tmp xor b < tmp) {
                            tmp = tmp xor b
                        }
                    }

                    if (tmp == 0L) {
                        dp[i] = dp[i + 1].toMutableSet()
                    }
                }
            }
        }

        if (dp[0].contains(0L)) {
            builder.appendln(0)
        } else {
            builder.appendln(1)
        }
    }

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 56380
#include<iostream>
using namespace std;
int main()
{
	bool oh=false;
	int x,k;
	cin>>x>>k;
	int v=x*500;
	if(v>=k) oh =true;
	if(oh==true) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	
	return 0;
}


Measured memory_bytes: 256
import fractions
A,B = map(int,input().split())
GCD = fractions.gcd(A,B)
if GCD == 1:
    print(1)
    exit()
    
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

Bunkai = factorization(GCD) 
print(len(Bunkai) + 1)


Measured memory_bytes: 66668
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 998244353
  #define N 200005
  #define INF 1000000000000
  #define eps 1e-6
	vector<pair<int,int>> v;
	int g[N];
bool check(int x,int val)
{

		if(v[x].first > val)
		{
			return true;
		}

		return false;
}
int binarysearch(int low,int high,int val)
{
	while(low <= high)
	{
		int mid = low + (high-low)/2;
		if(check(mid,val))
		{
			high = mid - 1;
		}
		else
		{
			low = mid + 1;
		}
	}
	return low;
}
int32_t main()
{
  // #ifndef ONLINE_JUDGE
  //   freopen("input.txt", "r", stdin);
  //   freopen("output.txt", "w", stdout);
  //   #endif
    IOS


	int n,d,a;
	cin >> n >> d >> a;


	for(int i = 1; i <= n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.PB({x,y});
	}

	sort(all(v));

	int ans = 0;
	for(int i = 0; i < n;i++)
		{
			if(i)g[i] += g[i-1];
			int x = v[i].second - a*g[i];
			if(x <= 0) continue;
			int k = max((x + a - 1)/a,0LL);
			ans += k;
			g[i] += k;
			int y = binarysearch(i,n,v[i].first+2*d);
				g[y]-=k;		
		}



		cout << ans;

	return 0;
}

Measured memory_bytes: 6512
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<String>();
    if n == "SUN" {
        println!("{}", 7);
    } else if n == "MON" {
        println!("{}", 6);
    } else if n == "TUE" {
        println!("{}", 5);
    } else if n == "WED" {
        println!("{}", 4);
    } else if n == "THU" {
        println!("{}", 3);
    } else if n == "FRI" {
        println!("{}", 2);
    } else if n == "SAT" {
        println!("{}", 1);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
n, a, b = map(int, input().split())
data = sorted(map(int, input().split()), reverse = True)
s = sum(data[:a])
k = a
last = data[a-1]
p = sum(map(lambda x: x == last, data[:a]))
if data[0] == last:
  q = sum(map(lambda x: x == last, data[:b]))
else:
  q = p  
z = sum(map(lambda x: x == last, data))

r = 1
res = 0
for i in range(q):
  r *= z - i
  r //= i + 1
  if i >= p-1:
    res += r  
    
print(s/k)
print(res)  

Measured memory_bytes: 3064
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Iterator;

class Graph {
	public int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	public LinkedList<Integer> visited;
	public LinkedList<Integer> count;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		visited = new LinkedList<Integer>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	
	public boolean ifVisited(int v) {
		return visited.contains(v);
	}
	
	public void setVisited(int v) {
		visited.add(v);
	}
	
	public List<Integer> getNeighbors(int v){
		return adjList.get(v);
	}
	
	public void BFS(int s) {
		ArrayList<Integer> toVisit = new ArrayList<Integer>();
		toVisit.add(s);
		
		count = new LinkedList<Integer>();
		for(int i=0;i<totalVertex;i++) {
			count.add(i, -1);
		}
		count.set(0, 0);
		
		
		while(toVisit.size()>0) {
			int v = toVisit.remove(0);
			setVisited(v);
			List<Integer> neighbors = getNeighbors(v);
			for(int i=0;i<neighbors.size();i++) {
				int v1 = neighbors.get(i);
				
				if((ifVisited(v1)==false)&&(toVisit.contains(v1)==false)) {
					toVisit.add(v1);
					count.set(v1, count.get(v)+1);
				}
				
			}
		}
	}
		

}



public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.BFS(0);
		
		for(int i=0;i<g.totalVertex;i++) {
			System.out.println(i+1+" "+g.count.get(i));
		}
	}
}


Measured memory_bytes: 28448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll chars = 'z' - 'a' + 1;
    string s, t;
    cin >> s >> t;
    vector<vector<ll>> idx(chars);
    rep(i, len(s)) idx[s[i] - 'a'].push_back(i);
    ll lp = 0, cur = -1;
    rep(i, len(t)) {
        ll c = t[i] - 'a';
        if (sz(idx[c]) == 0) {
            cout << -1 << endl;
            return 0;
        }
        auto it = upper_bound(all(idx[c]), cur);
        if (it == idx[c].end()) {
            lp++;
            cur = *idx[c].begin();
        }
        else {
            cur = *it;
        }
    }
    cout << (len(s) * lp + cur + 1) << endl;
    return 0;
}


Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> g[100001];
int parent[100001];

int visited[100001];


int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        int u,v;
        cin>>u>>v;
        g[u].pb(v);
        g[v].pb(u);
    }
    memset(parent , -1 , sizeof(parent));
    queue<int> q;
    q.push(1);
    visited[1]=1;
    while(!q.empty())
    {
        int u = q.front();
        q.pop();
        for(auto e:g[u])
        {
            int v = e;
            
            if(!visited[v]){
            q.push(v);
            parent[v]=u;

            visited[v]=1;
        }
        }
    }
    int ans=1;
    for(int i=2;i<=n and ans;i++){
        if(parent[i]==-1){
            ans=0;
        }
    }
    if(ans){
        cout<<"Yes"<<endl;
        for(int i=2;i<=n;i++){
            cout<<parent[i]<<endl;
        }
    }
    else{
        cout<<"No"<<endl;
    }



}


































// #define pi 3.14159265358979323846
// int main()
// {
//     double a,b,h,m;
//     cin>>a>>b>>h>>m;
//     double  angle1 = (pi / 6.0) * h;
//     double angle2 = (pi / 30.0) * m;
//     double anglebtwn;
//     if(angle1 > angle2){
//         anglebtwn = angle1 - angle2;
//     }
//     else{
//         anglebtwn = angle2 - angle1;
//     }
//     if(anglebtwn > 180)anglebtwn -= 180;
//     cout<<setprecision(15)<< sqrt( (a*a + b*b - (2*a*b*cos(anglebtwn))) );
//
// }


Measured memory_bytes: 10900
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

string S;

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

  cin >> S;
  int a = stoi(S.substr(0,2));
  int b = stoi(S.substr(2,2));
  if (IN(a,1,12) && IN(b,1,12)) {
    cout << "AMBIGUOUS" << endl;
  } else if (!IN(a,1,12) && !IN(b,1,12)) {
    cout << "NA" << endl;
  } else if (IN(a,1,12)) {
    cout << "MMYY" << endl;
  } else if (IN(b,1,12)) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define uu unsigned
#define io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mkp make_pair
#define ss second
#define ff first
#define mit(a,b) map<a,b>::iterator
#define sit(a) set<a>::iterator
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define pprint(x) print(x),putchar(' ')
#define fprint(x) print(x),putchar('\n')
#define printcas cout<<"Case "<<cas<<": "
#define _ continue;
#define endl '\n'
#define __ cout<<endl;continue;
#define vec4d(nam,type,a,b,c,d,fix) vector<vector<vector<vector<type>>>> nam(a,vector<vector<vector<type>>>(b,vector<vector<type>>(c,vector<type>(d,fix))))
const ll oo=(1ll<<60);
int gi(){
    int x=0,w=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')w=0,ch=getchar();
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return w?x:-x;
}
void print(ll x)
{
    if(x < 0) putchar('-'),x = -x;
    if(x > 9) print(x / 10);putchar(x % 10 + '0');
}
 main()
{
     io;
    int T=1;
    //T=gi();
    //cin>>T;
    //for(int cas=1;cas<=T;cas++)
    while(T--)
    {
       int n=gi(),k=gi(),i,j,l;
       vi v(n);
       for(auto &x:v){x=gi();}
       int low=1,high=MOD,mid;
       while(low<=high)
       {
           mid=((low+high)>>1);
           int cnt=0;
           for(auto x:v)
           {
               x--;
               cnt+=x/mid;
           }
           if(cnt<=k)high=mid-1;
           else low=mid+1;
       }
       fprint(low);

    }
    return 0;
}


Measured memory_bytes: 3972
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long S = 0;
		for(int i = 1 ; i <= N ; ++i){
			if(i % 3 == 0 || i % 5 == 0 ){
				continue;
			}
			S = S + i;
		}
		System.out.println(S);
				
	}
}


Measured memory_bytes: 27140
import math
N = int(input())

ans = 0

p1_array = [N]
for i in range(2, int(math.sqrt(N) + 1)):
    if N % i == 0:
        if N == i * i:
            p1_array.append(i)
            break
        else:
            p1_array.append(i)
            p1_array.append(N//i)


for p in p1_array:
    n = N
    while(n % p == 0):
        n = n // p
    if n % p == 1:
        ans += 1

if N != 2:
    N = N-1
    p2_array = [N]
    for i in range(2, int(math.sqrt(N) + 1)):
        if N % i == 0:
            if N == i * i:
                p2_array.append(i)
                break
            else:
                p2_array.append(i)
                p2_array.append(N//i)
    ans += len(p2_array)

print(ans)


Measured memory_bytes: 40284
#include <stdio.h>

int main(void){
   int n,max,min,i;
   scanf("%d",&n);
   int data[n];

   for(i=0;i<n;i++)
      scanf("%d",&data[i]);

   max=data[0]; min=data[0];
   for(i=1;i<n;i++){
      if(max<data[i]) max=data[i];
      if(min>data[i]) min=data[i];
   }

   printf("%d\n",max-min);
   return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int a,b,i,j;
  scanf("%d%d",&a,&b);
  printf("100 100\n");
  for(i=1;i<51;i++){for(j=0;j<100;j++){a-=(i%2)*(j%2);printf("%c",((i%2)*(j%2)*(a>0))?'.':'#');}printf("\n");}
  for(i=0;i<50;i++){for(j=0;j<100;j++){b-=(i%2)*(j%2);printf("%c",((i%2)*(j%2)*(b>0))?'#':'.');}printf("\n");}
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>

using namespace std;

typedef long long ll;

int main(void){
    ll r, d,x;
    cin >> r >> d >> x;
    for(ll i = 0;i < 10; i++){
        x = r * x - d;
        cout << x << endl;
    }
    return 0;
}


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

public class Main{
    public static void main(String[] aaa){
        Scanner s = new Scanner(System.in);
        Set<String> hset = new HashSet<String>();
        int n,q,i,count=0;
        String a,b;
        n = s.nextInt();
        for(i=0;i<n;i++){
            a = s.next();
            b = s.next();
            if(a.equals("insert"))hset.add(b);
            else{
                if(hset.contains(b))System.out.println("yes");
                else System.out.println("no");
            }
        }
    }
}


Measured memory_bytes: 253120
attrs = Array.new
while line = $stdin.gets
    attrs << line.chomp.split.map{|v| v.to_i }
end

N, K = attrs.shift
P = attrs.shift

first = P[0...K].inject(:+)
current = 0
m = 0 # max
for i in (K - 1)...(P.length) do
  if current == 0 then
    current = first
  else
    current = current - P[i - K] + P[i]
  end
  expected = (current + K) / 2.0
  m = [m, expected].max
end
puts m

Measured memory_bytes: 19468
#include <iostream>
#include <vector>
#define LL long long

using namespace std;

int main(void){

    LL n, i, sum = 0;

    vector<LL> v;


    cin >> n;

    for(LL i = 0; i < n; i++){
        LL tmp;
        cin >> tmp;
        v.push_back(tmp);
    }

    for(LL i = 0; i < n; i++){
        for(LL j = i + 1; j < n; j++){
            sum += v[i] * v[j];
        }
    }

    cout << sum << endl;
}


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





int main(){
  int a=0,un=0;
  int n;
  string q;
  bool j=true;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>q;
    if(q=="A"){a++;}
    if(q=="Un"){un++;}
    if(a<un){j=false;}
  }
  if(a!=un){j=false;}
  if(j){cout<<"YES"<<endl;}
  else{cout<<"NO"<<endl;}
  
  
  return 0;
}



Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	
	string t;
	cin >> t;
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	
	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;    
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<double,double> Pdouble;

const int INF = 2000000000;
const int MOD = 1000000007;

const int MAX_N = 110;
const int MAX_M = 110;

char maze[MAX_N][MAX_M + 1];

int main() {
  ll n;
  ll x;
  ll y;
  cin >> n;
  x = n/500;
  n = n-500*x;
  y = n/5;
  //cout << x << " " << y << " " << endl;
  cout << x*1000+y*5 << endl;
}

Measured memory_bytes: 256
a,b = map(int,input().split())
S = input()
ans = True
for s in range(a+b+1):
    if s == a:
        if S[s] != "-":
            ans = False
    if s != a:
        if S[s] == "-":
            ans = False
if ans:print("Yes")
else:print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

void Main()
{
  i64 n,k;
  cin >> n >> k;

  vi f(2*n+1);
  f[0] = 1;
  rep(i,1,2*n){
    f[i] = f[i-1]*i;
    f[i] %= MOD;
  }


  i64 ans = f[2*n-1];
  ans *= pow_mod(f[n],MOD-2,MOD);
  ans %= MOD;
  ans *= pow_mod(f[n-1],MOD-2,MOD);
  ans %= MOD;

  if(n-1<=k){
    cout << ans << endl;
    return;
  }

  rep(i,k+1,n){
    i64 c = 1;
    c *= f[n];
    c %= MOD;
    c *= pow_mod(f[n-i],MOD-2,MOD);
    c %= MOD;
    c *= pow_mod(f[i],MOD-2,MOD);
    c %= MOD;
    c *= f[n-1];
    c %= MOD;
    c *= pow_mod(f[n-i-1],MOD-2,MOD);
    c %= MOD;
    c *= pow_mod(f[i],MOD-2,MOD);
    c %= MOD;
    ans += MOD - c;
    ans %= MOD;
  }

  cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<ll,pair<int,int>> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

char c[4] = {'A','T','C','G'};
ll dp[100][110];


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

    int n;
    cin >> n;
    ll ans = 0;
    vector<string> v;
    map<string,int> mp;
    int cnt = 0;
    REP(i,4) {
        REP(j,4) {
            REP(k,4) {
                string ss = "";
                ss += c[i];
                ss += c[j];
                ss += c[k];
                if (ss == "AGC" || ss == "ACG" || ss == "GAC") continue;
                v.pb(ss);
                mp[ss] = cnt;
                dp[cnt][3] = 1;
                cnt++;
            }
        }
    }
    for (int i = 3; i < n; i++) {
        REP(j,cnt) {
            char cc = v[j][0];
            REP(k,4) {
                string ss = v[j].substr(1,2);
                ss += c[k];
                if (ss == "AGC" || ss == "ACG" || ss == "GAC") continue;
                string sss = ss.substr(1,2);
                sss = cc + sss;
                if (sss == "AGC") continue;
                sss = v[j].substr(0,2);
                sss += c[k];
                if (sss == "AGC") continue;
                dp[mp[ss]][i+1] += dp[mp[v[j]]][i];
                dp[mp[ss]][i+1] %= MOD;
            }
        }
    }
//    REP(i,cnt) {
//        cout << v[i] << " ";
//        for (int j = 3; j <= n; j++) {
//            cout << dp[i][j] << " ";
//        }
//        cout << endl;
//    }
    REP(i,cnt) {
        ans += dp[i][n];
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <queue>
#include <set>
#define maxn 20009
using namespace std;
long long a[maxn], sum = 0;
long long b[maxn];
int n;

long long f(int x){
	return 0;
}

int p[maxn];
bool flag[maxn];
int tot = 0;

set<long long>st;

void init(){
	for(int i = 2; i < maxn; i++){
		if(!flag[i])
			p[tot++] = i;
		for(int j = 0; j < tot && 1LL * i * p[j] < maxn; j++){
			flag[i * p[j]] = 1;
			if(i % p[j] == 0)
				break;
		}
	}
}

long long gcd(long long x, long long y){
	if(x == 0) return y;
	else return gcd(y % x, x);
}

void solve(long long x){
	for(long long i = 2; i * i <= x; i++){
		if(x % i == 0){
			while(x % i == 0){
				x = x / i;
			}
			st.insert(i);
		}
	}
	if(x != 1) st.insert(x);
}

int main(){
	init();
	cin >> n;
	for(int i = n; i >= 0; i--)
		cin >> a[i];
	
	for(int i = 0; i < tot; i++){
		bool ok = 1;
		for(int j = 0; j < p[i]; j++)
			b[j] = 0;
		if(abs(a[0]) % p[i] != 0) ok = 0;
		for(int j = 0; j <= n; j++){
			b[j % (p[i] - 1)] += a[j];
		}
		for(int j = 0; j < p[i]; j++){
			b[j] %= p[i];
			if(b[j] != 0){
				ok = 0;
				break;
			}
		}
		if(ok == 1){
			st.insert(p[i]);
		}
	}
	
	long long g = 0;
	for(int i = 0; i <= n; i++)
		g = gcd(g, abs(a[i]));
	
	
	solve(g);
	
	for(auto it = st.begin(); it != st.end(); ++it){
		cout << (*it) << endl;
	}
	return 0;
}


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

int main(){
    int D, N;
    cin >> D >> N;

    int ans = 0;
    if(D == 0){
        ans = N < 100 ? N : 101;
    }else{
        int x = 1;
        for(int i = 0; i < D; i++)
            x *= 100;
        if(N < 100){
            ans = x * N;
        }else if(D == 1){
            ans = x * 100 + N;
        }else{
            ans = 100 * (x + N);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
	int n, m, i, j, a, b, s, t, d[100003][3] = {};
	vector<int> g[100003];

	scanf("%d%d", &n, &m);
	for (i = 0; i < m; i++) {
		scanf("%d%d", &a, &b);
		g[a - 1].push_back(b - 1);
	}
	scanf("%d%d", &s, &t);

	s--;
	t--;

	for (i = 0; i < n; i++) for (j = 0; j < 3; j++) {
		d[i][j] = INF;
	}

	P p;
	int ds, pv, pr, nv, nr;
	priority_queue<P, vector<P>, greater<P>> pq;
	pq.push(P(0, s * 3));
	d[s][0] = 0;
	while (!pq.empty()) {
		p = pq.top();
		pq.pop();
		ds = p.first;
		pv = p.second / 3;
		pr = p.second % 3;
		if (d[pv][pr] < ds) {
			continue;
		}
		for (i = 0; i < g[pv].size(); i++) {
			nv = g[pv][i];
			nr = (pr + 1) % 3;
			if (d[nv][nr] > ds + 1) {
				d[nv][nr] = ds + 1;
				pq.push(P(ds + 1, nv * 3 + nr));
			}
		}
	}

	if (d[t][0] == INF) {
		printf("-1\n");
	}
	else {
		printf("%d\n", d[t][0] / 3);
	}

	return 0;
}

Measured memory_bytes: 6912
#include <cstdio>
#include <iostream>
#include <cassert>
#include <vector>

using namespace std;

int main(void) {

	int a = 0, b = 0;

	int cnt = 0;

	cin >> a;
	cin >> b;

	if (a <= b) {
		cnt = a;
	}
	else {
		cnt = a - 1;
	}

	cout << cnt << endl;

	return 0;

}

Measured memory_bytes: 256
x=int(input())
d=[]
for i in range(1,int(x**(0.5))+1):
    if x%i==0:
        d.append(i)
        d.append(int(i/x))
for m in d:
    a=0
    f=0
    for b in range(-5*(10)**2,5*(10)**2,1):
        a=m+b
        if a**5-b**5==x:
            print(a,b)
            exit()


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

#define st first
#define nd second
#define pb push_back

typedef long long   ll;
typedef double      db;
typedef long double ldb;

typedef pair <int, int> pii;
typedef pair <ll,  ll>  pll;
typedef pair <ll,  db>  pdb;
typedef pair <ldb, ldb> pldb;

template <typename T>
void   Debug (T begin, T end);
int    si    ();
ll     sl    ();
string ss    (int); 
db     sf    ();
ldb    slf   ();
void   pi    (int, char = '\n');
void   pl    (ll, char = '\n');
void   pf    (db, char = '\n');
void   plf   (ldb, char = '\n');
void   ps    (string, char = '\n');

ll russian(ll, ll, ll);
ll fast_power(ll, ll, ll);
ll slow_power(ll, ll, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);

const int INF  = 1e9;
const ll  LINF = 1e18;

int main()
{
    pi((si() - 1) / 2);

    return 0;
}

template <typename T>
void Debug(T begin, T end)
{
    printf("\nDEBUG:\n");
    while (begin != end)
        printf("%d ", *begin),
        begin++;
    printf("\n\n");
}

template <typename T>
T scanf_t(string s)
{
    T a;
    scanf(s.c_str(), &a);
    return a;
}

template <typename T>
void printf_t(T a, string s, char end_l)
{
    s.push_back(end_l);
    printf(s.c_str(), a);
}

int si() { return scanf_t<int>("%d"); }
ll sl() { return scanf_t<ll>("%lld"); }
db sf() { return scanf_t<db>("%f"); }
ldb slf() { return scanf_t<ldb>("%Lf"); }

void pi(int a, char end_l) { printf_t<int>(a, "%d", end_l); }
void pl(ll a, char end_l) { printf_t<ll>(a, "%lld", end_l); }
void pf(db a, char end_l) { printf_t<db>(a, "%lf", end_l); }
void plf(ldb a, char end_l) { printf_t<ldb>(a, "%Lf", end_l); }

void ps(string a, char end_l)
{
    string s = "%s";
    s.push_back(end_l);
    printf(s.c_str(), a.c_str());
}

string ss(int NN)
{
    char T[NN];
    scanf("%s", T);
    return (string)T;
}

ll fast_power(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = (r * a) % m;
        a = (a * a) % m;
        k >>= 1LL;
    }
    return r;
}

ll slow_power(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = russian(r, a, m);
        a = russian(a, a, m);
        k >>= 1LL;
    }
    return r;
}

ll russian(ll a, ll k, ll m)
{
    ll r = 0LL;
    while (k)
    {
        if (k & 1LL)
            r = (r + a) % m;
        a = (a + a) % m;
        k >>= 1LL;
    }
    return r;
}

ll gcd(ll a, ll b)
{
    while (b)
        swap(a %= b, b);
    return a;
}

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


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

bool move(string s , int a , int c){
	a-- ;
	for(int i = a ; i < c-1 ; i++ ){
		if(s[i] == '#' && s[i+1] == '#') return false ;
	}
	return true ;
}

int main() {
	int n , a , b , c , d ;
	string s ; 
	cin >> n >> a >> b >> c >> d >> s ;
	bool possible = false ;
	if(c > d){
		for(int i = b-1 ; i < d ; i++){
			if(s.substr(i-1,3) == "..."){
				possible = true ; break ;
			}
		}
		possible *= move(s,a,c);
	}else{
		possible = true ;
		possible *= move(s,a,c) && move(s,b,d) ;
	}
	if(possible) cout << "Yes" ;
	else cout << "No" ;
	return 0; 
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}

int main(){
  int N;
  cin >> N;
  int h=N/2;
  
  vector<int> d(N);
  cin >> d; //vectorもシンプルにinできる
  
  //昇順
  std::sort(d.begin(), d.end());
  
  int vari = d[h]-d[h-1];
    
  cout << vari << endl;
}

Measured memory_bytes: 640
#include<stdio.h>  
int a[105][105];
int b[10050];  
   
int main()  
{  
    int H,W;  
    while(scanf("%d%d",&H,&W)!=EOF)  
    {  
        int t,k=0;  
        scanf("%d",&t);  
        for(int i=0;i<t;i++)  
        {
		scanf("%d",&b[i]);
	}
        for(int i=0;i<H;i++)  
        {  
            if(i%2==0)  
            {
	         for(int j=0;j<W;j++)  
            	 {  
                	a[i][j]=k+1;  
          	      	b[k]--;  
            	        if(b[k]==0) k++;  
            	 }
	     }
            else if(i%2==1)  
            {
	         for(int j=W-1;j>=0;j--)  
     	       	 {  
        	        a[i][j]=k+1;  
            	        b[k]--;  
                	if(b[k]==0) k++;  
                 }  
            }
        }  
        for(int i=0;i<H;i++)  
        {  
            for(int j=0;j<W-1;j++)  
            {
		    printf("%d ",a[i][j]);
            }
            printf("%d\n",a[i][W-1]);  
        }  
    }  
}

Measured memory_bytes: 256