akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    int N, A, B;
    cin >> N >> A >> B;
    int cnt = 0;
    for(int i = 1; i <= N; ++i) {
        int sm = 0;
        int tmp = i;
        while(tmp > 0) {
            sm += tmp%10;
            tmp /= 10;
        }
        if(A <= sm && sm <= B) cnt += i;
    }
    cout << cnt << endl;
    return 0;
}

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

int main(){
	int n;
	scanf("%d", &n);
	map<string, int> s;
	for(int i = 0; i < n; i++) {
		int id;
		scanf("%d", &id);
		string key;
		cin >> key;
		if(id == 0) {
			int x;
			scanf("%d", &x);
			auto p = s.emplace(key, x);
			if(!p.second) (*s.find(key)).second = x;
		}else if(id == 1) {
			auto itr = s.find(key);
			printf("%d\n", (itr != s.end()) ? (*itr).second : 0);
		}else if(id == 2) {
			s.erase(key);
		}
	}
}



Measured memory_bytes: 27992
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long

int n;

int ds(int a)
{
    return
        a / 10000 % 10+
        a / 1000 % 10 +
        a / 100 % 10 +
        a / 10 % 10 +
        a / 1 % 10;
}

int main(void)
{
    cin >> n;

    int res = inf;

    loop(i, 1, n / 2 + 1)
    {
        res = min(res, ds(i) + ds(n - i));
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e18;

signed main() {
    string s;
    cin >> s;
    int N = s.size();
    int acnt = 0;
    int res = 0;
    int seq = 0;
    while(seq < N) {
        if(s[seq]=='A') acnt++;
        else if(s[seq]=='B') {
            if(seq+1 >= N) break;
            switch(s[seq+1]) {
                case 'A' :
                    acnt = 1;
                    break;
                
                case 'B' :
                    acnt = 0;
                    break;
                
                case 'C' :
                    res += acnt;
                    break;
            }
            seq++;
        } else if(s[seq]=='C') acnt = 0;
        seq++;
    }

    cout << res << endl;

    return 0;
}

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

int main(){
  string s;
  cin>>s;
  bool fl=false;
  for(int i=0; i<s.size()-1; i++){
    if(s.substr(i,2)=="AC"){
      fl=true;
      break;
    }
  }
  if(fl)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
l = list(map(int, input().split()))

l = [0] + l
from itertools import accumulate
cum =list(accumulate(l))
cum = [c%m for c in cum]

d = {}
ans = 0
for i in range(n+1):
  if cum[i] not in d:
    d[cum[i]] = 1
  else:
    ans += d[cum[i]]
    d[cum[i]] += 1
print(ans)

Measured memory_bytes: 64792
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) cin >> h[i];
    int answer = 0, m = 0;
    for (int i = n - 2; i >= 0; --i) {
        if (h[i] >= h[i + 1]) ++m;
        else {
            answer = max(answer, m);
            m = 0;
        }
    }
    cout << max(answer, m) << endl;
}


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

using namespace std;

int main()
{
    while(1){
        int x,y,s;
        cin >> x >> y >> s;
        if(x == 0){
            break;
        }
        int mx = 0;
        for(int i = 1; i < s; i++){
            for(int j = 1; j < s; j++){
                int p = i*(100+x)/100;
                int q = j*(100+x)/100;
                if(p+q == s){
                    mx = max(mx,i*(100+y)/100+j*(100+y)/100);
                }
            }
        }
        cout << mx << "\n";
    }
}



Measured memory_bytes: 3092
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
using namespace std;


typedef long long       ll;
struct edge { ll to; ll cost; };
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<ve>      vve;
typedef vector<vc>		vvc;

// マクロ
#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX 9223372036854775807
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}

// ***<ここから>****************************************************************



int main(void) {

	int N, M, Q;
	cin >> N >> M >> Q;

	vpii LR(M);
	rep(i, M) {
		int L, R;
		cin >> L >> R;
		LR[i] = make_pair(L - 1, R - 1);
	}
	vpii pq(Q);
	rep(i, Q) {
		int p, q;
		cin >> p >> q;
		pq[i] = make_pair(p - 1, q - 1);
	}

	vvi sum(N + 1, vi(N + 1, 0));
	rep(i, M) {
		sum[LR[i].first + 1][LR[i].second + 1]++;
	}

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

	rep(i, Q) {
		int ans = sum[pq[i].second + 1][pq[i].second + 1] - sum[pq[i].first][pq[i].second + 1];
		cout << ans << endl;
	}



	return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define Rall(a) (a).rbegin(), (a).rend()
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
const ll INF=1e10+1;
using namespace std;
#define NOT_EXIST -1

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

signed main(){
	int a,p;
	cin >> a >> p;
	int hen = a*3+p;
	cout << hen/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#include <bitset>
#define LIM 1000007
#define ll long long
using namespace std;
int main() {
  bitset<9> b;
  vector<int> v;
  ll n;
  cin >> n;
  while (n) {
    v.push_back(n % 10);
    n /= 10;
  }
  reverse(v.begin(), v.end());
  ll cnt = 0;
  ll crr = 0;
  for (int i = 0; i < pow(2, v.size() - 1); i++) {
    b = i;
    crr = 0;
    for (int k = 0; k < v.size(); k++) {
      crr *= 10;
      crr += v[k];
      if (b[k] || k == v.size() - 1) {
        // cout << crr << "+";
        cnt += crr;
        crr = 0;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
typedef long long ll;

#define FOR(i,a,b) for(ll i = (a);i < (b);++i)
#define REP(i,n) FOR(i,0,n)

#define debug(x) cout << #x << "=" << x << endl;

using namespace std;

int main(void){

  int n,m;
  cin >> n >> m;

  int constTime = (n-m) * 100;
  int rndTime = m * 1900;

  int ans = (constTime + rndTime) * (2 << (m-1));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	io := newIo()
	n := io.nextInt()
	dic := map[int]struct{}{}

	for range make([]struct{}, n) {
		a := io.nextInt()
		if _, in := dic[a]; !in {
			dic[a] = struct{}{}
		} else {
			delete(dic, a)
		}
	}
	fmt.Println(len(dic))
}

type io struct {
	reader    *bufio.Reader
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
	}
}

func (io *io) nextLine() string {
	var buffer []byte
	for {
		line, isPrefix, _ := io.reader.ReadLine()
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) nextString() string {
	for io.nextToken >= len(io.tokens) {
		line := io.nextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) nextInt() int {
	i, _ := strconv.Atoi(io.nextString())
	return i
}


Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
using namespace std;
int ans[100010];

int main(){
  string s;
  cin >> s;
  int n=s.size();
  int x=0,y=0;
  for(int i=0;i<n;i++){
    if(i!=0&&s[i]=='R'&&s[i-1]=='L') x=i;
    if(s[i]=='R'&&s[i+1]=='L') y=i;
    if(i!=n-1&&s[i]=='L'&&s[i+1]=='R'||i==n-1){
      int cnt=i-x+1;
      if(y%2==0){
        ans[y]=(i+2)/2-(x+1)/2;
        ans[y+1]=cnt-ans[y];
      }
      else{
        ans[y+1]=(i+2)/2-(x+1)/2;
        ans[y]=cnt-ans[y+1];
      }
    }
  }
  for(int i=0;i<n;i++) cout << ans[i] << ' ';
  cout << endl;
}

Measured memory_bytes: 1024
using System;
using System.Linq;

namespace ABC137B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            var K = input[0];
            var X = input[1];

            Console.WriteLine(string.Join(" ", Enumerable.Range(X - K + 1, (X + K - 1) - (X - K + 1) + 1)));
        }
    }
}

Measured memory_bytes: 13396
while 1:
    a0, L = map(int, raw_input().split())
    if a0 == L == 0:
        break
    d = {a0: 0}
    cur = 0
    while 1:
        cur += 1
        num = str(a0)
        num += "0"*(L - len(num))
        s = sorted(num)
        p = int("".join(s[::-1])); q = int("".join(s))
        a1 = p - q
        if a1 in d:
            print d[a1], a1, cur - d[a1]
            break
        d[a1] = cur
        a0 = a1

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

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

    int the_num_cnt = 0;
    for ( int i = 1; i <= 1010000; ++i ) {
        int tmp_num = i;
        int cnt = 0;
        while(1) {
            if ( tmp_num % 100 != 0 ) {
                break;
            }
            ++cnt;
            tmp_num /= 100;
        }
        if ( cnt != d ) {
            continue;
        }
        else if ( the_num_cnt == n - 1 ) {
            cout << i << endl;
            return 0;
        }
        else {
            ++the_num_cnt;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <queue>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define Q 1000000007

// ll T,N;
// vector<ll> a(N);
// const int M = 2;
// void dfs(vector<int> &A) {
//     // 終端条件 --- 10 重ループまで回したら処理して打ち切り
//     if (A.size() == n) {
//         return;
//     }

//     for (int v = 0; v < M; ++v) {
//         A.push_back(v);
//         dfs(A);
//         A.pop_back(); // これが結構ポイント
//     }
// }

bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

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

//   ll sum = 0, tmp = 0;
//   ll i = 1;
//   while(true){
//       tmp = sum;
//       sum += pow(26,i);
//       if(sum >= n){
//           break;
//       }
//       i++;
//   }

  vector<ll> a;
  ll tmp = n;
  while(tmp>0){
    //   cout<<tmp%26<<endl;
      a.push_back(tmp%26);
      if(tmp%26==0){
          tmp--;
      }
      tmp/=26;
  }
  
  for(ll i = a.size()-1;i >= 0;i--){
    //   cout<<a[i]<<endl;
    if(a[i]==0){
        cout<<'z';
    }else{
      char c = 'a'-1+a[i];
      cout<<c;
    }
  }
  cout<<endl;

//   cout<<a.size();
  
 
// char cc = 'a'+25;
// cout<<cc;
//   cout<< a[0] <<endl;
 

  return 0;
}

Measured memory_bytes: 3720
#include <stdio.h>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define assign_if_greater(V, T) V=max(V,T)
typedef long long ll;
typedef long double ld;
int A,B,Q;
ll As[100000+10];
ll Bs[100000+10];
ll INF=(ll)1000*1000*1000*1000;
ll min(ll a, ll b) {
  return a>b? b:a;
}
ll abs(ll a) {
  return a>0?a:-a;
}
ll* lower_bound(ll* a, ll* b, ll v){
  while(b>a+1) {
    ll* m=a+(b-a)/2;
    if(*m >= v) {
      b=m;
    } else {
      a=m;
    }
  }
  return b;
}
ll fastGet() {
  ll ret=0;
  char c=getchar_unlocked();
  // skipping
  while(c<'0' || c > '9') c=getchar_unlocked();
  do {
    ret *= 10;
    ret += (c-'0');
    c = getchar_unlocked();
  } while(c>='0' && c<='9');
  return ret;
}
void fastPut(ll v) {
  char s[256];
  int p=0;
  do {
    s[p++]=(v%10)+'0';
    v/=10;
  } while(v>0);
  while(p--)
    putchar_unlocked(s[p]);
}
int main() {
  A=fastGet();
  B=fastGet();
  Q=fastGet();
  As[0]=-INF;
  Bs[0]=-INF;
  As[A+1]=INF;
  Bs[B+1]=INF;
  REP(i,A)
    As[i+1]=fastGet();
  REP(i,B)
    Bs[i+1]=fastGet();
  REP(i,Q) {
    ll x=fastGet();
    ll* ita=lower_bound(As, As+A, x);
    ll* itb=lower_bound(Bs, Bs+B, x);
    ll ans=INF;
    ll alis[2],blis[2];
    alis[0]=*ita;
    blis[0]=*itb;
    alis[1]=ita[-1];
    blis[1]=itb[-1];
    REP(j,2)
      REP(k,2){
        ll a=alis[j],b=blis[k];
        ans = min(ans,abs(a-x)+abs(b-a));
        ans = min(ans,abs(b-x)+abs(b-a));
      }
    fastPut(ans);
    putchar_unlocked('\n');
  }
  return 0;
}


Measured memory_bytes: 2816
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

int64 fib[50];

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

  int n; cin >> n;

  fib[0] = 1; fib[1] = 1;
  for (int i = 2; i < 50; ++i) {
    fib[i] = fib[i - 1] + fib[i - 2];
  }

  cout << fib[n] << '\n';

  return 0;
}


Measured memory_bytes: 3208
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdlib>
using namespace std;

int main() {
	int n,i;
	double U,ans=0;
	char X[4];
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> U >> X;
		if (!strcmp(X,"BTC"))ans += 380000.0 * U;
		else ans += U;
	}
	cout << ans << endl;
	return(0);
}

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

int N;
string S;

int main() {
    cin >> N >> S;
    if (N == 1) { cout << "No\n"; return 0; }
    string T = S.substr(0, S.length()/2);
    if (T + T == S) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>
#include <chrono>


#define rep(i,p,q) for(ll i = p;i < q;i++)
#define ll long long

using namespace std;

vector<vector<ll>> graph;
vector<ll> query;
vector<ll> ans;
vector<ll> visited;

#include <vector>
#include <algorithm>
const long long MAX_N = 1 << 17;

long long dat[2 * MAX_N - 1];

//a
int main(void) {
	string s;
	cin >> s;
	if (s == "Sunny")cout << "Cloudy" << endl;
	else if (s == "Cloudy") cout << "Rainy" << endl;
	else cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	int a,b,c;
};

bool dp[101][101][10];

int main(){

	int N;
	scanf("%d",&N);

	int X[N];
	for(int i = 0; i < N; i++)scanf("%d",&X[i]);

	int M;
	scanf("%d",&M);

	Info info[M];

	for(int i = 0; i < M; i++){
		scanf("%d %d %d",&info[i].a,&info[i].b,&info[i].c);
		info[i].b--; //0オリジンにする
		info[i].c--;
	}

	for(int i = 0; i <= N; i++){
		for(int k = 0; k <= N; k++){
			for(int p = 0; p < M; p++)dp[i][k][p] = false;
		}
	}

	for(int func = 0; func < M; func++){
		for(int i = 0; i < N; i++){
			if(info[func].a == X[i]){
				dp[i][i+1][func] = true;
			}
		}
	}

	for(int i = N-1; i >= 0; i--){
		for(int k = i+1; k <= N; k++){
			for(int p = i+1; p < k; p++){
				for(int func = 0; func < M; func++){
					if(dp[i][p][info[func].b] == true && dp[p][k][info[func].c] == true){
						dp[i][k][func] = true;
					}
				}
			}
		}
	}

	if(dp[0][N][0]){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

	return 0;
}



Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define REP(i,n) for (int i = 0; i < n; ++ i)
#define FOR(i,a,b) for (int i = a; i <= b; ++ i)
#define FORD(i,b,a) for (int i = b; i >= a; -- i)
#define debug(x) cerr << #x << ": " << x << "\n"
#define task "0"
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll, int> li;

ll EXP[20];
int sumDigit(ll x) {
	if (x == 0) return 0;
	else return x % 10 + sumDigit(x / 10);
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	//freopen(task".inp", "r", stdin);
	//freopen(task".out", "w", stdout);
	EXP[0] = 1;
	FOR(i, 1, 18) EXP[i] = EXP[i-1] * 10;

	int k;
	cin >> k;
	long long x = 1;

	REP(khue, k) {
		cout << x << '\n';
		
		x ++;
		int s = sumDigit(x);
		li res = mp(x, s);
		for (int i = 0; EXP[i] <= x; i++) {
			int tmp = x % EXP[i+1] / EXP[i];
			x += (9 - tmp) * EXP[i];
			s += (9 - tmp);
			if (x * res.se < res.fi * s) res = mp(x, s);
		}
		x = res.fi;
	}
	//cerr << nextNum(1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,u;
  long long sum = 0;
  int A[10000000];
  cin >> N;
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  
  for(int i=0 ; i < N-1 ; i++){
    int s =i+1;
    //cout<<A[i]<<A[s]<<endl;
  if(A[i] > A[s]){
    u = A[i] - A[s];
    A[s] = A[i] ;
    sum += u;
    //cout << u <<endl;
   }
                 }
  
  cout << sum << endl;
 
}

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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define INF LLONG_MAX

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int h,w;
  cin >> h >> w;
  
  vector<string> pic(h);
  
  for(int y=0;y<h;y++){
    cin >> pic[y];
  }
  
  for(int y=0;y<h;y++){
    for(int x=0;x<w;x++){
      if(pic[y][x]=='#'){
        bool isOK = false;
        if(y>0 && pic[y-1][x]=='#') isOK = true;
        if(y<h-1 && pic[y+1][x]=='#') isOK = true;
        if(x>0 && pic[y][x-1]=='#') isOK = true;
        if(x<w-1 && pic[y][x+1]=='#') isOK = true;
        
        if(!isOK) {
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }

  cout << "Yes" << endl;
  return 0;
}



Measured memory_bytes: 3692
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int n;double out=0.0,x;string u;
	cin>>n;
	rep(i,n){
		//cout<<i<<endl;
		cin>>x>>u;
		//cout<<i<<' '<<x<<' '<<u<<endl;
		if(u=="JPY") out+=x;else out+=x*380000;
	}
	printf("%.12f\n", out);
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	std::map<std::string, int> cnt;
	for (int i = 0; i < n; i++) {
		std::string s;
		std::cin >> s;
		cnt[s]++;
	}
	std::vector<std::string> res;
	int max = -1;
	for (auto i : cnt) {
		if (i.second > max) max = i.second, res = {i.first};
		else if (i.second == max) res.push_back(i.first);
	}
	for (auto i : res) std::cout << i << std::endl;
	return 0;
}


Measured memory_bytes: 26868
int main()
{
  int  n, max=0 , k=0;
  char x[11];
  char a[4];
  a[0]='A';
  a[1]='C';
  a[2]='G';
  a[3]='T';
  for(n=0;n<11;n++)
  scanf("%s" ,&x[n]);
  
  for(n=0;n<11;n++){
  if(x[n]==a[0]||x[n]==a[1]||x[n]==a[2]||x[n]==a[3])
  k++;
    else{
      if(max<k){
        max=k;
        k=0;
      }
    }
  }
  printf("%d" , max);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

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

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

const int inf=1e9+10;

ll a,b,n;

int main(){
	cin>>a>>b>>n;
	ll mx=min(n,b-1);
	ll ans=(a*mx)/b-a*(mx/b);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    int sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    int sum2=0;
    int mini = INT_MAX;
    for(int i=0;i<n;i++)
    {
        sum2+=a[i];
        mini = min(mini,abs(sum2 - (sum-sum2)));
    }
    cout<<mini<<endl;
}


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

int main(){
   int A,B,K;
   cin>>A>>B>>K;
   
   if(2*K<B-A+1){
   for(int i=0;i<K;i++){
        cout<<A+i<<endl;
   }
   for(int i=K-1;i>-1;i--){
       cout<<B-i<<endl;
   }
   }
   
   else{
       for(int i=A;i<B+1;i++){
        cout<<i<<endl;
       }
   }

   }
   
       
   
//最初のtxtだけ通らず、REになる

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define N 100002
#define mod 1000000007
#define lld long long 
int main()
{
   lld x,y,a,b,c; cin>>x>>y>>a>>b>>c;
   lld aa[a],bb[b],cc[c];
   for(int i=0;i<a;++i)cin>>aa[i];
   for(int i=0;i<b;++i)cin>>bb[i];
   for(int i=0;i<c;++i)cin>>cc[i];
   sort(cc,cc+c);
   reverse(cc,cc+c);
   multiset<lld> mm;
   sort(aa,aa+a);
   sort(bb,bb+b);
   reverse(aa,aa+a);
   reverse(bb,bb+b);
   for(int i=0;i<x;++i)mm.insert(aa[i]);
   for(int i=0;i<y;++i)mm.insert(bb[i]);
   lld ans=0;
   int flag=0;
   int ff=0;
   while(1){
    if(mm.size()==0)break;
    lld zz=(*mm.begin());
    if(zz>cc[ff]){
        break;
    }
    mm.erase(mm.lower_bound(zz));
    ans+=cc[ff];
    ff++;
    if(ff>=c)break;
   }
   for(auto x: mm)ans+=x;
    cout<<ans;
}

Measured memory_bytes: 11008
#include <iostream>
#include <cstdio>
#define N 90005
using namespace std;

int h, w, d, q, l, r, x[N], y[N], s[N];

int abs(int p) {return p > 0 ? p : -p;}

int main()
{
	int i, j, t;
	cin >> h >> w >> d;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			scanf("%d", &t);
			x[t] = i, y[t] = j;
		}
	}
	for (i = 1; i <= h * w; i++) {
		if (i <= d) s[i] = x[i] + y[i];
		else s[i] = s[i - d] + abs(x[i] - x[i - d]) + abs(y[i] - y[i - d]);
	}
	cin >> q;
	while (q--) {
		scanf("%d %d", &l, &r);
		printf("%d\n", s[r] - s[l]);
	}
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1000000000000000000L;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int ddx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int ddy[] = {0, 1, 1, 1, 0, -1, -1, -1};

int extgcd(int a, int b, int& x, int&y) {
    int d = a;
    if(b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }else {
        x = 1;
        y = 0;
    }
    return d;
}

int inv(int a) {
    int x, y;
    extgcd(a, MOD, x, y);
    return (x + MOD) % MOD;
}

bool ifprime[100001];
bool used[100001];
int sim[50001];

int main() {
    fill(used, used + 100001, false);
    fill(ifprime, ifprime + 100001, false);
    for(int i = 2; i <= 100000; i++) {
        if(!used[i]) {
            used[i] = true;
            ifprime[i] = true;
            for(int j = 1; i * j <= 100000; j++) {
                used[i * j] = true;
            }
        }
    }

    sim[0] = 0;
    rep(i, 50000) {
        sim[i + 1] = sim[i];
        if(ifprime[i * 2 + 1] && ifprime[i + 1]) sim[i + 1]++;
    }

    int q;
    cin >> q;
    rep(i, q) {
        int l, r;
        cin >> l >> r;
        cout << sim[(r + 1) / 2] - sim[(l - 1) / 2] << endl;
    }
 
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    map<ll, ll> M;

    REP(i, N){
        ll a;
        cin >> a;
        M[a]++;
    }

    ll ans = 0;
    
    for(auto iter=M.begin(); iter!=M.end(); iter++){
        if(iter->first > iter->second){
            ans += iter-> second;
        }
        else{
            ans += iter->second - iter->first;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9516
fun main(args:Array<String>){
    val mod = 2019
    val line = readLine()!!.split(" ").map{it.toInt()}
    val l = line[0]
    val r = line[1]
    var min = 2019
    if(r-l > 2020){
        println(0)
        return
    }
    for(i in l..r-1){
        for(ii in l+1..r){
            val num = (i%mod)*(ii%mod)%mod
            if(num<min){
                min = num
            }
        }
    }
    println(min)
    return
}

Measured memory_bytes: 38124
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

int main(void){
	ll a,b,c;
	cin >> a >> b >> c;
	if(a%2==0){
		cout << "0" << endl;
	}else if(b%2==0){
		cout << "0" << endl;
	}else if(c%2==0){
		cout << "0" << endl;
	}else{
		cout << min(a*b,min(b*c,c*a)) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    long long n;
    while(cin>>n)
    {
        if(n%2==1)
        {
            cout<<(n/2)*(n/2+1)<<endl;
        }
        else
        {
            cout<<n*n/4<<endl;
        }
    }
}


Measured memory_bytes: 504
#include <iostream>

using namespace std;

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

	long long ans = 0;
	for (int i = 0; i < N; ++i) {
		int l, r;
		cin >> l >> r;
		ans += r - l + 1;
	}
	cout << ans << endl;
}


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

int d[110][110] = {};
int n, m, inf = 1e9 + 7, a[1010], b[1010], c[1010], ans;
bool used[1010];

void warshall_floyd(int n)
{
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            for (int k = 0; k < n; k++)
            {
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
            }
        }
    }
}

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (i != j)
                d[i][j] = inf;
        }
    }
    for (int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
        d[a[i]][b[i]] = c[i];
        d[b[i]][a[i]] = c[i];
    }
    warshall_floyd(n);
    for (int i = 0; i < n; i++)
    { //start
        for (int j = 0; j < n; j++)
        { //end
            if (i == j)
                continue;
            for (int k = 0; k < m; k++)
            {
                if (d[i][a[k]] + c[k] + d[b[k]][j] == d[i][j] || d[i][b[k]] + c[k] + d[a[k]][j] == d[i][j])
                    used[k] = true;
            }
        }
    }
    for (int i = 0; i < m; i++)
    {
        if (used[i] == false)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ls x<<1
#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-8;
const ull hashp=131;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=998244353;
const int maxn=1e5+100;
int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}
void solve(){
	int n;scd(n);
	int ans=0;
	rep1(i,n)rep1(j,n)rep1(k,n)
		ans+=gcd(gcd(i,j),k);ac;
}
int main(){
    //IOS;
    //freopen("fenwick.in","r",stdin);
    //freopen("fenwick.out","w",stdout);
    solve();
    
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;                                             ;;
	;;         ;;            ;;;;;;;;;       ;;    ;;
	;;        ;; ;;        ;;                ;;    ;;
	;;       ;;   ;;       ;;                ;;    ;;
	;;      ;;;;;;;;;      ;;                ;;    ;;
	;;     ;;       ;;     ;;                      ;;
    ;;    ;;         ;;      ;;;;;;;;;       ;;    ;;
    ;;                                             ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    return 0;
}

Measured memory_bytes: 3256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, m;
vector<int> g[100010];

bool used[100010];

int check(int a) {
    for (int i = 0; i < g[a].size(); i++) {
        int v = g[a][i];
        if (!used[v])
            return v;
    }
    return -1;
}

void solve() {
    deque<int> res;
    res.push_back(0);
    res.push_back(g[0][0]);
    used[0] = used[g[0][0]] = true;
    int v, w;
    while (true) {
        v = check(res.front());
        if (v >= 0) {
            res.push_front(v);
            used[v] = true;
        }
        w = check(res.back());
        if (w >= 0) {
            res.push_back(w);
            used[w] = true;
        }
        if (v < 0 && w < 0) break;
    }
    int l = res.size();
    cout << l << endl;
    for (int i = 0; i < l; i++) {
        cout << res[i]+1;
        if (i == l-1) cout << endl;
        else cout << " ";
    }
}

void input() {
    cin >> n >> m;
    int a, b;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    solve();
}


Measured memory_bytes: 6784
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP_ll(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VREP_int(v) for(std::vector<int>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int n;
	cin >> n;
	string buf;
	set<string> s;
	REP(i,n){
		cin >> buf;
		s.insert(buf);
	}
	println(s.size());

	return 0;
}


Measured memory_bytes: 19260
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<double> R(N);
  for(int i = 0; i < N; ++i) cin >> R[i];
  vector<double> X(N);
  double ans = 0;
  for(int i = 0; i < N; ++i){
    double x = R[i];
    for(int j = 0; j < i; ++j)
      x = max(x, X[j]+sqrt((R[i]+R[j])*(R[i]+R[j])-abs(R[i]-R[j])*abs(R[i]-R[j])));
    X[i] = x;
    ans = max(ans, x+R[i]);
  }
  printf("%.12f\n",ans);
}



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

using namespace std;

typedef long long ll;


int p[20], q[20], cnt;

ll N, ans;


int main() {
	cin >> N;
	if (N == 2) return puts("1") & 0;
	if (N == 3) return puts("2") & 0;
	ans = 1;
	for (int i = 2; 1ll * i * i <= (N - 1); i++) {
		if ((N - 1) % i == 0) {
			if (1ll * i * i == N - 1) ans++;
			else ans += 2;
		}
	}
	for (int i = 2; 1ll * i * i <= N; i++) {
		if (N % i == 0) {
			ll o = N;
			while (o % i == 0) o /= i;
			if ((o - 1) % i == 0) ans++;
			/*if (1ll * i * i != N) {
				
			}*/
		}
	}
	ans++;
	cout << ans << endl;
	return 0;
}



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

int main() {
	int N;
	cin >>N;
	int x[N+1];
	for(int i=1;i<=N;i++){
		cin >>x[i];
	}
	long k,mi;
	mi = pow(100,2)*100;
	for(int i=1;i<=100;i++){
		k=0;
		for(int l=1;l<=N;l++){
			k+=(x[l]-i)*(x[l]-i);
		}
		mi=min(mi,k);
	}
	cout <<mi;

}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a = [0] + a
ans = [0] * (n+1)
for i in range(n, 0, -1):
    now = 2 * i
    tmp = 0
    while now <= n:
        tmp += ans[now]
        now += i
    ans[i] = (a[i]-tmp)%2
print(sum(ans))
for i in range(n+1):
    if ans[i] == 1:
        print(i)

Measured memory_bytes: 97664
#include <stdio.h>

void bubbleSort(int A[], const int N)
{
    int i;
    int flag = 1, cnt = 0;

    while( flag ){ //ここを消して下2行でも可 (1)
    //int j;
    //for( j = 0; flag; ++j ){
        flag = 0;

        for( i = N-1; 0 < i; --i ) //ここを消して下1行でも可 (1)
        //for( i = N-1; j < i; --i )
            if( A[i] < A[i-1] ){
                int tmp = A[i];
                A[i] = A[i-1];
                A[i-1] = tmp;

                flag = 1;
                ++cnt;
            }
    }

    for( i = 0; i < N; ++i ){
        if( 0 < i ) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", cnt);
}

int main()
{
    int i;

    int N;
    scanf("%d", &N);
    int A[N];
    for( i = 0; i < N; ++i )
        scanf("%d", &A[i]);

    bubbleSort(A, N);

    return 0;
}


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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}
signed main()
{
    int N;
    cin >> N;
    vector<int> L;
    rep(i, N)
    {
        int a;
        cin >> a;
        L.push_back(a);
    }
    sort(L.begin(), L.end());
    int longest = L[N - 1];
    int all = 0;
    rep(i, N - 1)
    {
        all += L[i];
    }
    if (all > longest)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


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

int solve(int n, int m){
	vector< int > vec;
	vector< int >::iterator it;
	vector< int >::iterator eit;
	int i = 0;
	for (i = 1; i <= n; i++){
		vec.push_back(i);
	}
	i = 0;
	it = vec.end();
	eit = vec.end();
	while (vec.size() > 1){
		for (int j = 0; j<m-1; j++){
			if (it == eit){
				// cout << "it == eit" << endl;
				it = vec.begin();
			}
			// cout << "now" << endl;
			++it;
			// cout << "now2" << endl;

		}
		if (it != vec.end()){
			// cout << *it << endl;
			it = vec.erase(it);
		} else {
			it = vec.begin();
			// cout << "begin *it = " << *it << endl;
			it = vec.erase(it);
		}
		eit = vec.end();

		/*vector< int >::iterator itt = vec.begin();
		for (; itt != vec.end(); itt++){
			cout << *itt << " ";
		}*/
	}
	return vec.front();
}

int main(){
	int n, m;
	while (cin >> n >> m, n || m){
		cout << solve(n, m) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    cin >> w.at(i);
  }
  int m = int(pow(10, 18));
  int a = 0;
  int b = accumulate(w.begin(), w.end(), 0);
  for (int i = 0; i < n; i++) {
    a += w.at(i);
    b -= w.at(i);
    m = min(abs(a - b), m);
  }
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;



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

	vector<ll> lc(100);
	lc.at(0) = 2;
	lc.at(1) = 1;
	for (int i = 2; i <= n; i++)
	{
		lc.at(i) = lc.at(i - 2) + lc.at(i - 1);
	}

	println(lc.at(n));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

const int N = 50 + 5;

int cnt[N];

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n,m;
	cin >> n >> m;
	rep(i,0,m){
		int x,y;
		cin >> x >> y;
		++cnt[x];
		++cnt[y];
	}
	rep(i,1,n+1)cout << cnt[i] << '\n';
}


Measured memory_bytes: 256
// Problem : A - Frog 1
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("O3")  
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define pii pair<int,int>
#define S second
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define mem(z,i) memset(z,i,sizeof(z))
#define eps 1e-7
#define I (int)
#define mod 1000000007
#define pb push_back
const long long INF = 1000000000000000000LL;
//const int WASTE=∞
const int N=1e5+5;
int a[N],dp[N];
int f(int x){
	if(dp[x]!=-1) return dp[x];
	dp[x]=min(f(x-1)+abs(a[x]-a[x-1]),f(x-2)+abs(a[x]-a[x-2]));
	return dp[x];
}
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
  	// cout<<fixed;
  	// cout.precision(10);
   	int n;
   	cin>>n;
   	mem(dp,-1);
   	//dp[3]=min(abs(a[3]-a[1]),dp[2]+abs(a[3]-a[2]));
   	for(int x=1;x<=n;x++) cin>>a[x];
   	dp[1]=0; dp[2]=abs(a[1]-a[2]); 
   	int ans=f(n);
   	cout<<ans<<endl;
   	//for(int x=1;x<=n;x++) cout<<dp[x]<<' ';
   	
   	
   	
   	
   	
   	
   	
   	
   	
   	
   	
  	return 0;
}



Measured memory_bytes: 2560
def yn(t):
    if t:
        print("Yes")
    else:
        print("No")


n = int(input())
k = n % 10
if k == 3:
    print("bon")
elif k == 0 or k == 1 or k == 6 or k == 8:
    print("pon")
else:
    print("hon")


Measured memory_bytes: 9160
#include "bits/stdc++.h"
using namespace std;
long long s[3005][3005];
long long c[3005][3005];
long long w[3005];
int n, mod;

long long modpow(int x, int p, int MOD) {
	if(p == 0) return 1;
	if(p & 1) return (modpow(x, p-1, MOD) * x) % MOD;
	long long mid = modpow(x, p >> 1, MOD);
	return (mid * mid) % MOD;
}

int main(int argc, char const *argv[])
{
	scanf("%d %d", &n, &mod);
	for(int i = 0; i <= n; i++) s[0][i] = 1;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= n; j++) {
			s[i][j] = s[i - 1][j - 1] + s[i][j - 1] * (i + 1);
			s[i][j] %= mod;
		}
	}
	for(int i = 0; i <= n; i++) {
		c[i][0] = 1;
		for(int j = 1; j <= i; j++) {
			c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
			c[i][j] %= mod;
		}
	}
	for(int i = 0; i <= n; i++) {
		w[i] = 0;
		long long P = modpow(2, modpow(2, n - i, mod - 1), mod);
		long long Q = modpow(2, (n - i), mod);
		long long R = 1;
		for(int j = 0; j <= i; j++) {
			long long add = c[n][i];
			add *= (s[j][i] * R) % mod;
			add %= mod;
			add *= P;
			add %= mod;
			w[i] += add;
			w[i] %= mod;
			R *= Q;
			R %= mod;
		}	
	}  
	long long ans = 0;
	for(int i = 0; i <= n; i++) {
		if(i & 1) ans -= w[i];
		else ans += w[i];
		ans %= mod;
	}
	if(ans < 0) ans += mod;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 139648
N, M = [int(i) for i in input().split()]

ks = []
sss = []
for _ in range(M):
  inp = [int(i) for i in input().split()]
  ks.append(inp[0])
  sss.append(inp[1:])
  
ps = [int(i) for i in input().split()]

count = 0
for i in range(2**N):
  pattern = [(i >> j) & 1 for j in range(N)]
  ok = True
  for m in range(M):
    p = ps[m]
    ss = sss[m]
    
    if sum([int(pattern[s-1]) for s in ss]) % 2 == p:
      ok = True
    else:
      ok = False
      break
  if ok:
    count += 1
    
print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define Rep(i,a,b) for(int i=a;i<=b;++i)
#define _Rep(i,a,b) for(int i=a;i>=b;--i)
#define mem(a) memset(a,0,sizeof a)
using namespace std;
typedef long long ll;
typedef string str;

int main()
{
    int a, b;
    cin >> a >> b;
    if(a > b) swap(a,b);
    for(int i = 1; i <= b; i++)
	{
		printf("%d",a);
	}
	cout << endl;
    return 0;
}


Measured memory_bytes: 256