akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200005;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    ll ans = 1;
    rep(i,m) ans *= 2;
    PRINT(ans*((n-m)*100+1900*m));
}


Measured memory_bytes: 3632
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

const int MXN = 2e5, IINF = 1e9 + 10, INF = 1e18 + IINF + 10, MOD = 1000000007;
const ld PI = 4.0 * atanl(1.0), PREC = .000001;
const char nl = '\n';

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.end(), x.begin()
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define ins insert

int n, m, t, a[MXN];

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

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

int main() {
  fast();
  string s;
  cin >> s;
  map<char, int> mp;
  FOR(i, 0, s.length()) { mp[s[i]]++; }
  if (mp['S'] == 0 and mp['N'] > 0 or (mp['N'] == 0 and mp['S'] > 0)) {
    cout << "No";
    return 0;
  }
  if (mp['W'] == 0 and mp['E'] > 0 or (mp['E'] == 0 and mp['W'] > 0)) {
    cout << "No";
    return 0;
  }
  cout << "Yes";
  return 0;
}


Measured memory_bytes: 3664
#include<iostream>
#include<set>
using namespace std;
const int MAX_N=101;
const int MAX_K=100100;
int N,K,A[MAX_N];
int grundy[MAX_K];
void solve(){
    grundy[0]=0;
    for(int j=1;j<=K;j++){
        set<int>s;
        for(int i=0;i<N;i++){
            if(A[i]<=j)s.insert(grundy[j-A[i]]);
        }
        int g=0;
        while(s.count(g)!=0)g++;
        grundy[j]=g;
    }
    if(grundy[K])cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}
int main(){
    cin>>N>>K;for(int i=0;i<N;i++)cin>>A[i];
    solve();
}

Measured memory_bytes: 4032
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#define llint long long int

int main(void){

  int n;
  std::cin >> n;
  std::vector<int> a(3*n);
  for(int i=0; i<3*n; i++){
    std::cin >> a[i];
  }

  std::vector<llint> top_sum_max;
  std::multiset<int> first_set;
  llint sum = 0;
  for(int i=0; i<n; i++){
    first_set.insert(a[i]);
    sum+=a[i];
  } //nlogn

  top_sum_max.push_back(sum);
  
  for(int i=n; i<2*n; i++){
    first_set.insert(a[i]);
    auto it = first_set.begin();
    sum = sum + a[i] - *it;
    first_set.erase(it);
    top_sum_max.push_back(sum);
  } // nlogn

  //for(const auto& elem: top_sum_max){
  //  std::cout << elem << " ";
  //}
  //std::cout << std::endl;

  
  std::vector<llint> end_sum_min;
  std::multiset<int, std::greater<int> > end_set;
  sum = 0;
  for(int i=3*n-1; i>=2*n; i--){
    end_set.insert(a[i]);
    sum += a[i];
  }
  end_sum_min.push_back(sum);
  for(int i=2*n-1; i>=n; i--){
    end_set.insert(a[i]);
    auto it = end_set.begin();
    sum = sum + a[i] - *it;
    end_set.erase(it);
    end_sum_min.push_back(sum);
  }

  //for(const auto& elem: end_sum_min){
  //  std::cout << elem << " ";
  //}
  //std::cout << std::endl;

  llint result = top_sum_max[top_sum_max.size()-1] - end_sum_min[0];
  for(int i=1; i<top_sum_max.size(); i++){
    llint temp = top_sum_max[top_sum_max.size()-1-i] - end_sum_min[i];
    if(result < temp) result = temp;
  }

  std::cout << result << std::endl;
  return 0;
}


Measured memory_bytes: 13172
import java.util.*;
class Main{
	public static void main(String [] args){
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt(), D=sc.nextInt(), X=sc.nextInt(), arr[]=new int[N], total=X+N;
		for(int i=0 ; i<N ; i++){
			arr[i] = sc.nextInt();
		}

		for(int i=0 ; i<N ; i++){
			for(int j=1; ;j++){
				if(arr[i]*j+1<=D){
					total++;
				}else{
					break;
				}
			}
		}
		System.out.println(total);
	}
}

Measured memory_bytes: 21716
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
       long n = sc.nextLong();
       long num = 0;
       for(long i = 1 ; i <= n ; i++) {
    	   if(i % 2 == 0)
    		   continue;
    	   if(yakusuKosu(i) == 8) {
    		   num++;
    	   }


       }
       System.out.println(num);

    }
    public static long yakusuKosu(long m){
      long n = m;
		long num = 1;
		HashMap<Long, Long> map = new HashMap<>();
			for(long i = 2 ; i <= Math.sqrt(n) ; i++) {
			if(n % i != 0)
				continue;
			n /= i;
			map.put(i, map.getOrDefault(i,  0L) + 1L);
			if(n == 1)
				break;
          i--;
		}
		if(n != 1)
			map.put(n, map.getOrDefault(n,  0L) + 1L);
		for(long t : map.keySet()) {
			num *= map.get(t) + 1;

		}
		return num;

	}
    public static long pow(long ml, long a, long b){
        if(b == 1)
          return ml;
          ml *= a;
          b--;
    		return b == 0 ? ml : pow(ml , a ,b);
    	}
}





Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define MOD 1000000007
template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int N;
vector<vector<int>> G;
long long dp[100001][2];

long long dfs(int cur, int pre, int color){
    if(dp[cur][color] != -1) return dp[cur][color];
    long long both = 1;
    long long white = 1;
    for(int nxt : G[cur]){
        if(nxt == pre) continue;
        long long wh = dfs(nxt, cur, 0);
        long long bl = dfs(nxt, cur, 1);
        both *= (wh + bl) % MOD;
        white *= wh;
        both %= MOD;
        white %= MOD;
    }
    dp[cur][0] = both;
    dp[cur][1] = white;
    return dp[cur][color];
}

int main(){
    cin >> N;
    G.resize(N);
    for(int i=0; i<N-1; i++){
        int x, y;
        cin >> x >> y;
        x--; y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    REP(i, N) REP(j, 2)
        dp[i][j] = -1;
    long long ans = (dfs(0, -1, 0) + dfs(0, -1, 1)) % MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 15616
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int a;
    string s;
    
    while(1){
        a=0;
        getline(cin,s);
        if(s=="0")break;
        for(int i=0;i<s.length();i++)a += s[i]-48;
        cout << a << endl;
    }
    
    
}



Measured memory_bytes: 3016
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,f = 0;
  cin >> n;
  for (int i = 0; i < n; ++i)
  {
    int a;
    cin >> a;
    if (a%2 == 0)
    {
      if(a%3 != 0 && a%5 != 0)
      {
        f =1;
      }
    }
  }
  if( f == 1)
  {
    cout << "DENIED";
  }
  else
    cout << "APPROVED";
  return 0;
}


Measured memory_bytes: 256
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;
typedef pair<LL, LL> II;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<II> ans;
	if (n == 2) {
		LL a, b;
		cin >> a >> b;
		if (a - b > b - a) {
			ans.push_back(II(a, b));
		} else {
			ans.push_back(II(b, a));
		}
	} else {
		vector<LL> a, b;
		for (int i = 0; i < n; ++i) {
			LL x;
			cin >> x;
			if (x < 0) {
				a.push_back(x);
			} else {
				b.push_back(x);
			}
		}
		sort(a.rbegin(), a.rend());
		sort(b.begin(), b.end());
		if (b.empty()) {
			ans.push_back(II(a.front(), a.back()));
			LL prev = a.front() - a.back();
			for (int i = 1; i < (int)a.size() - 1; ++i) {
				ans.push_back(II(prev, a[i]));
				prev = prev - a[i];
			}
		} else if (a.empty()) {
			ans.push_back(II(b.front(), b[b.size() - 2]));
			LL prev = b.front() - b[b.size() - 2];
			for (int i = 1; i < (int)b.size() - 2; ++i) {
				ans.push_back(II(prev, b[i]));
				prev = prev - b[i];
			}
			ans.push_back(II(b.back(), prev));
		} else {
			for (int i = 0; i < (int)b.size() - 1; ++i) {
				ans.push_back(II(a[0], b[i]));
				a[0] = a[0] - b[i];
			}
			int prev = b.back();
			for (int i = 0; i < (int)a.size(); ++i) {
				ans.push_back(II(prev, a[i]));
				prev = prev - a[i];
			}
		}
	}
	cout << (ans.back().first - ans.back().second) << endl;
	for (auto kv : ans) {
		cout << kv.first << " " << kv.second << endl;
	}
	return 0;
}


Measured memory_bytes: 4492
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#define inf 1e9+7
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl;
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;

bool kaibun(string s){
    bool ans=true;
    ll n=s.size();
    for(ll i=0;i<s.size();i++){
        if(s[i]!=s[n-1-i]) ans=false;
    }
    return ans;
}

int main() {
    string s;
    cin >> s;
    ll n=s.size();
    ll a=(n-1)/2-1;
    string d="";
    rep(i,a+1) d+=s[i];
    string e="";
    for(ll i=a+2;i<n;i++) e+=s[i];
    if(kaibun(s) && kaibun(d) && kaibun(e)) cout << "Yes" << endl;
    else cout <<"No" << endl;
}
 



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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "<" << #__VA_ARGS__ << ">:", debug_out(__VA_ARGS__)
#define INF LLONG_MAX


int main()
{
  double a, b, h, m;
  double t, p;
  static const double pi = 3.141592653589793;
  cin >> a >> b >> h >> m;
  t = h * 30 + 30 * m / 60;
  p = m * 6;
  debug(t);
  debug(p);
  double d = max(t, p) - min(t, p);
  d = min(d, 360-d);
  cout << setprecision(25) << (double)sqrt(-2 * a * b * cos(d * pi / 180) + a * a + b * b)<< endl;
}


Measured memory_bytes: 4248
/*input
19
3141592653589793238
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

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

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

const int N = 30001;
bool l[N][10];
bool r[N+1][10];
int n;
string s;
set< int > all;

void solve(){
  	cin >> n >> s;
  	RE(i,n){
  		REP(j,10)l[i][j] = l[i-1][j];
  		if(i > 1)l[i][s[i-2]-'0'] = 1;
  	}
  	for(int i = n;i > 0;i--){
  		REP(j,10)r[i][j] = r[i+1][j];
  		if(i < n)r[i][s[i]-'0'] = 1;
  	}
  	RE(i,n){
  		int cur = s[i-1]-'0';
  		REP(prev,10){
  			REP(wow,10){
  				if(l[i][prev] and r[i][wow])all.insert(prev+10*cur+100*wow);
  			}
  		}
  	}
  	//print(all);
  	cout << all.size();
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

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

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

	int c = N % 10;
	N /= 10;
	int b = N % 10;
	N /= 10;
	int a = N % 10;

	if (a == b) {
		if (b == c) { cout << a << b << c << endl; }
		else if (b > c) { cout << a << b << b << endl; }
		else if (b < c) { cout << a + 1 << b + 1 << b + 1 << endl; }
	} else if (a < b) {
		a += 1;
		cout << a << a << a << endl;
	} else if (a > b) {
		if (b >= c) { cout << a << a << a << endl; }
		else if (b < c) {
			if (a >= c) { cout << a << a << a << endl; }
			else if (a < c) { 
				a += 1;
				cout << a << a << a << endl;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 256
<?php

while (($line = trim(fgets(STDIN))) !== '0') {
    $n = (int)$line;
    $arr = array();
    for ($i = 0; $i < $n; $i++) {
        fscanf(STDIN, '%d', $m);
        $arr[$i] = $m;
    }
    sort($arr);

    $arr2 = array(0);
    for ($i = 1; $i < $n; $i++) {
        $arr2[] = $arr2[$i - 1] + $arr[$i - 1];
    }
    echo array_sum($arr2), PHP_EOL;
}

Measured memory_bytes: 9652
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

typedef long long ll;
const ll mod = 1000000007;
ll dp[100001][13];

int main() {
    string s;
    cin>>s;
    dp[0][0] = 1;
    for (int i = 0; i < s.size(); i++) {
        int c;
        if (s[i] == '?') c = -1;
        else c = s[i] - '0';

        for (int j = 0; j < 10; j++) {
            if (c != -1 && c != j) continue;
            for (int k = 0; k < 13; k++) {
                dp[i+1][(k * 10 + j) % 13] = (dp[i+1][(k * 10 + j) % 13] + dp[i][k]) % mod;
            }
        }
    }
    ll ans = dp[s.size()][5];
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 10752
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<iostream>
#include<vector>

using namespace std ;

int vtonum(vector<int> v )
{
	int num = 0 ,base = 10 ;
	for(int i = 0; i < v.size(); ++i)
	{
		if(i == 0)
		{
			num += v[i] ;
		}
		else
		{
			num += v[i] * (base) ;
			base *= 10 ;
		}
	}
	return num ;
}

int main()
{
	int N,L,S,ans,d, i = 0;
	vector<int> v ;
	while(1)
	{
		cin >> N ;
		ans = 0 ;
		if(N == 0)
		{
			break ;
		}
		while(1)
		{
			if(N == 6174)
			{
				cout << ans << endl ;
				break ;
			}
			v.resize(4) ;
			i = 0 ;
			for(d = 1000; d >= 1; d /= 10)
			{
				v[i] = N /d ;
				N %= d ;
				++i ;
			}
			if(v[0] == v[1] && v[1] == v[2] && v[2] == v[3])
			{
				cout << "NA" << endl ;
				break ;
			}
			std::sort(v.begin(),v.end()) ;
			S = vtonum(v) ;
			std::sort(v.begin(),v.end(),std::greater<int>()) ;
			L = vtonum(v) ;
			N = S - L ;
			++ans ;
		}
	}
	return 0 ;
}

Measured memory_bytes: 1212
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)


function main()
    N = readline()
    flag = false
    for i in 1:3
        if N[i]=='7'
            flag = true
        end
    end
    if flag
        println("Yes")
    else
        println("No")
    end
end

main()

Measured memory_bytes: 155996
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long double A, B;
  cin >> A >> B;
  cout << (ll)(A * B + 0.001) << endl;
  return 0;
}



Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(a.rbegin(), a.rend());
  int count = 0, yes = 0;
  ll ans = 1;
  rep(i, n - 1) {
    if (count == 0) count++;
    if (a[i] == a[i + 1]) {
      if (i != n - 2) {
        count++;
      } else {
        count++;
        if (count >= 4) {
          if (ans == 1) {
            ans = a[i] * a[i];
            yes = 2;
          } else {
            ans *= a[i];
            yes++;
          }
        } else if (count == 2 || count == 3) {
          ans *= a[i];
          yes++;
        }
      }
    } else {
      if (i != n - 2) {
        if (count == 0 || count == 1) {
          count = 0;
          continue;
        } else if (count == 2 || count == 3) {
          ans *= a[i];
          yes++;
          count = 0;
        } else {
          if (ans == 1) {
            ans = a[i] * a[i];
            yes = 2;
            break;
          } else {
            ans *= a[i];
            yes++;
          }
        }
      }
    }
    if (yes == 2) break;
  }
  if (yes == 2)
    cout << ans << endl;
  else
    cout << 0 << endl;
  return 0;
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int a, b;
    cin>> a>> b;
    a--;
    b--;

    cout <<( (b+a-1)/a);
    nl;



    return 0;
}




Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var K = input[1];
            var Q = input[2];
            var P = Enumerable.Repeat(K - Q, N).ToArray();
            for (int i = 0; i < Q; i++) P[ReadInt() - 1]++;
            for (int i = 0; i < N; i++) Console.WriteLine(P[i] > 0 ? "Yes" : "No");

            Console.WriteLine();
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 18908
N, M, K = map(int,input().split())
jdg = 0
for L in range(1, N+1):
    for C in range(1, M+1):
        if ((M-C)*L + (N-L)*C == K or (M-C)*L + (N-L)*C == N*M-K) and jdg == 0:
            jdg += 1
            print("Yes")
            break
if jdg == 0 :
    print("No")

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

int main() {
    ll x, y;
    cin >> x >> y;

    int ans = 0;
    while (x <= y) {
        ans++;
        x *= 2;
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define INF (1<<30)-1
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n,h; cin >> n >> h;
  vi a(n),b(n); rep(i,n) cin >> a[i] >> b[i];
  sort(all(a),greater<int>());
  sort(all(b),greater<int>());
  int sum = 0, ans = 0, i = 0;
  while(sum < h){
    ans++;
    if(a[0] < b[i]){
      sum += b[i];
      i++;
    }else sum += a[0];
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> X(M);
    for(int i=0; i<M; i++){
        cin >> X.at(i);
    }
    if(N>=M){
        cout << 0 << endl;
        return 0;
    }
    sort(X.begin(), X.end());
    vector<int> distanse(M-1);
    for(int i=0; i<M-1; i++){
        distanse.at(i)=X.at(i+1)-X.at(i);
    }
    sort(distanse.begin(), distanse.end());
    long long ans=0;
    for(int i=0; i<distanse.size()-(N-1); i++){
        ans+=distanse.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {
	
	static String letters;
	public static void main (String[] args)
	{
		Scanner sc = new Scanner(System.in);
		letters=sc.next();
		
		System.out.println (finder(letters));
	}
	
	
	
	static String finder (String str)
	{
		int count ;
		for(int i = 0; i<26;i++)
		{
			count = 0;
			for (int j = 0; j <letters.length() ;j++)
			{
				if (letters.charAt(j)==('a'+i))
					count++;
			}	
			if (count==0)
				return((char)('a'+i) +"");
		}
		return ("None");
	}
}


Measured memory_bytes: 40660
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll n, s[110000], ans = 0, c = 0;
int main() {
	cin >> n;
	REP(i, n) {
		ll a; cin >> a;
		s[a]++;
	}
	REP(i, 110000) {
		ans += max(0ll, s[i] - 1);
		if (s[i] % 2 == 0 and s[i] > 0)c++;
	}
	if (c % 2 == 1)cout << n - ans - 1 << endl;
	else cout << n - ans << endl;
}


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

int main(){
  int n, k;
  cin >> n >> k;
  int a[100010];
  for ( int i = 0; i < n; ++i ) cin >> a[i];

  int M = 0, G;
  for ( int i = 0; i < n; ++i ) {
    M = max(M, a[i]);
    if ( i == 0 ) {
      G = a[i];
      continue;
    }
    G = __gcd( G, a[i]);
  }
  if ( M >= k && k % G == 0) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
const int P=2e5;
const int Q=2e5+2;
#define FOR(i,a,b) for (i = (a); i < (b); i++)
#define ROF(i,a,b) for (i = (a); i > (b); i--)
int j,x,y,i,n,c[10];
char s[55];
using namespace std;
int th(int a[])
{
    int d[10],s,t=0;
    memset(d,0,sizeof(d));
    for(i=0;i<n-1;i++){
            s=0;
        for(j=1;j<a[i];j++)
          if(d[j]==0) s++;
        t=t+s*c[n-i-1];
        d[a[i]]=1;
    }
    return t;
}
int main()
{
    int a[10],b[10];
    cin>>n;
    c[1]=1;
    for(i=2;i<n;i++)
        c[i]=i*c[i-1];
    FOR(i,0,n)
      cin>>a[i];
    FOR(i,0,n)
      cin>>b[i];
    x=th(a);
    y=th(b);
    cout<<abs(x-y);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 100

int main(void) {
    int r, c, i, j, sum = 0;
    int sr[MAX] = {0}, sc[MAX] = {0};
    int C[MAX][MAX];

    scanf("%d %d", &r, &c);

    for(i=0; i<r; ++i) {
      for(j=0; j<c; ++j) {
        scanf("%d", &C[i][j]);
      }
    }

    for(i=0; i<r; ++i) {
      for(j=0; j<c; ++j) {
        printf("%d ", C[i][j]);
        sr[j] += C[i][j];
        sc[i] += C[i][j];
      }
      printf("%d\n",sc[i]);
      sum += sc[i];
    }

    for(i=0; i<c; ++i) {
        printf("%d ", sr[i]);
    }
    printf("%d\n", sum);

    return 0;
}



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

size_t pickup(size_t next, vector<int>& T, int C, int K) {
    int start = T[next] + K;
    int people = 0;
    while (T[next] <= start && next<T.size()) {
        ++people; // pick up
        ++next; // next index
        if (people == C) {
            break;
        }
    }
    return next;
}

int main() {
    int N, C, K;
    cin >> N >> C >> K;
    vector<int> T(N);
    for (auto &x: T) cin >> x;

    sort(T.begin(), T.end());
    int bus = 0;
    int next=0;
    while (next < T.size()) {
        next = pickup(next, T, C, K);
        ++bus;
    }
    cout << bus << endl;
}

Measured memory_bytes: 3720
N, M, K = map(int, input().split())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))

a = [0]
b = [0]

# Aの机だけを上から読んでいく時のそれぞれの読了時間(Bは考慮しない)
for i in range(N):
    a.append(a[i] + A_list[i])
# 同じくBの読了時間
for i in range(M):
    b.append(b[i] + B_list[i])

ans, j = 0, M
# Aの机にある本を読まない場合からスタート
for i in range(N + 1):
    if a[i] > K:
        break
    # Kに収まるようにjを上から見ていく(単調増加)
    while b[j] + a[i] > K:
        j -= 1
    # 条件を満たすうち、最大なものを求める
    ans = max(ans, i + j)

print(ans)

Measured memory_bytes: 47408
package main

import "fmt"

func main() {

	var a int
	var nowStat int

	fmt.Scan(&a)

	max := 0

	var total int

	for i := 0; i < a; i++ {
		fmt.Scan(&nowStat)

		if max < nowStat {
			max = nowStat
		}
		total += nowStat
	}

	total = total - max/2

	fmt.Println(total)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const double PI = acos(-1);
const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}



int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll n;
    cin >> n;
    ll ans = 0;
    REP(i, 1, 1000000){
        REP(j, 1, 1000000){
            ll a = i;
            ll b = j;
            if(a * b >= n){
                break;
            }
            ll c = n - a * b;
            if(a * b + c == n) ans++;
        }
    }
    print(ans);
    


}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;

int main() {
    string a,ans;
    cin >> a;
    for (int i=0;i<a.size();++i){
        if (a[i]!='B'){
            ans+=a[i];
        }else{
            if (ans.size()!=0){
                ans.pop_back();
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iterator>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DT long long
#define forn(i,n)for(i=0;i<n;i++)
#define forc(i,c,n)for(i=c;i<=n;i++)

int main() {
	ifstream fin("Text.txt");
	int i, j, q;
	double sa, sc;
	DT h,w,a, b, c, d, n, m, k, s = 0, t = 0, c4=0,c2=0;
	cin >> n;
	//scanf("%I64d", &n);
	//fin >> n;
	map<DT, DT>mp;
	vector<DT>vc(max(2*n,(long long)2));
	forn(i, n) {
		cin >> a;
		//scanf("%I64d", &a);
		mp[a]++;
	}
	map<DT, DT>::iterator it1, it2;
	it1 = mp.begin();
	while (it1!=mp.end())
	{
		if (it1->second > 3) {
			vc[t] = it1->first;
			vc[t + 1] = it1->first;
			t += 2;
		}
		else if (it1->second > 1) {
			vc[t] = it1->first;
			t ++;
		}
		it1++;
	}
	sort(vc.rbegin(), vc.rend());
	cout << vc[0] * vc[1] << endl;
	return 0;
}

Measured memory_bytes: 8064
A, B, C, X, Y = map(int, input().split())
ans = min(A*X+B*Y, max(X, Y)*2*C)
if X<=Y:
  ans = min(ans, C*2*X + B*(Y-X))
if Y<=X:
  ans = min(ans, C*2*Y + A*(X-Y))
print(ans)

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

public class Main {
	public static void main ( String[] args ) {
		Scanner sc = new Scanner(System.in);
		String[] field;
		while ( sc.hasNext() ) {
			String result = "";
			field = new String[8];
			for ( int i = 0; i < 8; i++ )
				field[i] = sc.nextLine();
			for ( int i = 0; i < 8; i++ ) {
				int a = field[i].indexOf("1");
				if ( a != -1 ) {
					int b = field[i].lastIndexOf("1");
					if ( b - a == 3 ) result = "C";
					else if ( b - a == 1 && i < 7 ) {
						if ( field[i+1].charAt(a) == '1' && field[i+1].charAt(b) == '1' )
							result = "A";
						else if ( a < 6 && field[i+1].charAt(a+1) == '1' && field[i+1].charAt(b+1) == '1' )
							result = "E";
						else if ( a > 0 && field[i+1].charAt(a-1) == '1' && field[i+1].charAt(b-1) == '1' )
							result = "G";
					} else if ( b - a == 0 ) {
						if ( i < 5 && field[i+1].charAt(a) == '1' && field[i+2].charAt(a) == '1' && field[i+3].charAt(a) == '1' )
							result = "B";
						else if ( i < 6 && a > 0 && field[i+1].charAt(a) == '1' && field[i+1].charAt(a-1) == '1' && field[i+2].charAt(a-1) == '1' )
							result = "D";
						else if ( i < 6 && a < 7 && field[i+1].charAt(a) == '1' && field[i+1].charAt(a+1) == '1' && field[i+2].charAt(a+1) == '1' )
							result = "F";
					}
				}
			}
			System.out.println(result);
			if ( sc.hasNext() ) sc.nextLine();
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
//void chmin(int &a, int b) { if (a > b) a = b; }
//void chmax(int &a, int b) { if (a < b) a = b; }

const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

int main() {
    int n,k;
    cin >> n >> k;
    int tmp = 0;
    while(n){
        n /= k;
        tmp++;
    }
    cout << tmp << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

//HEADER FILES AND NAMESPACES
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp>   
using namespace std;
using namespace __gnu_pbds;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; 
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ll MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy

vector <ll> ifact(1000005), fact(1000005), inv(1000005);

void init() {
	fact[1] = 1;
    fact[0] = 1;
	ifact[1] = 1;
    ifact[0] = 1;
    inv[1] = 1;
	for(int i=2;i<=1000000;i++) {
		fact[i] = (fact[i-1] * i) % MOD;
		inv[i] = (MOD - (MOD/i) * inv[MOD%i] % MOD) % MOD;
	}
    for(int i=2;i<=1000000;i++) {
        ifact[i] = (ifact[i-1] * inv[i]) % MOD;
    }
}



ll combine(ll n, ll r) {
	ll res = 1;
	ll num = fact[n];
    ll deno = (ifact[n-r] * ifact[r]) % MOD;
    res = (num * deno) % MOD;
	return res;
}

ll logpow(ll x, ll y) {
	if(x == 0) {
		return 1;
	}
	ll res = 1;
	while(y > 0) {
		if(y & 1) {
			res = (res * x) % MOD;
		}
		x = (x * x) % MOD;
		y>>=1;
	}
	return res;
}
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);  

#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r+", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w+", stdout);
#endif  
	
	init();
    int N;
    cin >> N;
    ll ans = (8*MOD + logpow(10,N) -2*(logpow(9,N)) + logpow(8,N)) % MOD;
    cout << ans << '\n';
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 26584
#include <iostream>
#include <string>

using namespace std;
int main(void){
    // Your code here!
  string w,s;
  int count=0;
  int W,S;
  cin>>w;
  while(1){
      cin>>s;
      int e=0;
      if(s=="END_OF_TEXT"){
          break;
      }
      for(int i=0;i<min(s.size(),w.size());i++){
          W=w[i];S=s[i];
          if(W==S||W==(S+32)){
              e++;
          }
          if(e==max(s.size(),w.size())){
             count++;
          }
      }
  }
  cout<<count<<endl;
}



Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define lli long long int
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ff first
#define ss second
#define pb push_back

vector <vector<int> > vect(100001);
vector <int> vis(100001);
lli dp[100001],maxlen=0;

lli func(int i)
{
	if(vis[i]==1)
		return dp[i];
	else{
		vis[i]=1;
		dp[i]=0;
		loop(j,0,vect[i].size()){
			dp[i]=max(dp[i],1+func(vect[i][j]));
		}
	}
	return dp[i];
}

lli solve(int n)
{
	for(int i=1;i<n+1;i++)
	{
		if(vis[i]==-1){
			vis[i]=1;
			dp[i]=0;
			loop(j,0,vect[i].size())
				dp[i]=max(dp[i],1+func(vect[i][j]));
		}
		maxlen=max(maxlen,dp[i]);
	}
	return maxlen;
}

int main()
{
	fastIO

	int n,m,a,b;
	cin>>n>>m;

	for(int i=0;i<n+1;i++)
		vis[i]=-1;

	for(int i=0;i<m;i++)
	{
		cin>>a>>b;
		vect[b].push_back(a);
	}

	cout<<solve(n);
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll pow_mod(ll a, ll n, ll p)
{
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*a%p;
        a = a*a%p;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a, ll MOD)
{
    ll b = MOD, u = 1, v = 0;
    while(b){
        ll t = a/b;
        a -= t*b;   swap(a,b);
        u -= t*v;   swap(u,v);
    }
    u %= MOD;
    if(u < 0) u+= MOD;
    return u;
}

int main()
{
    ll MOD = 1e9+7;
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    unordered_map<ll,ll> mp;
    vector<unordered_map<ll,ll>> vmp(n);
    for(i = 0;i < n;++i){
        ll tmp = a.at(i);
        ll sn = sqrt(tmp);
        vector<pair<ll,ll>> insuu;
        ll so = 2;
        ll num = 0;
        while(true){
            if(tmp%so == 0){
                tmp /= so;
                ++num;
            }else{
                if(num != 0){
                    insuu.emplace_back(so,num);
                    num = 0;
                }
                ++so;
            }
            if(tmp == 1){
                insuu.emplace_back(so,num);
                break;
            }
            if(so > sn){
                insuu.emplace_back(tmp,1);
                break;
            }
        }
        for(auto x:insuu){
            vmp.at(i)[x.first] = x.second;
            if(mp.count(x.first)){
                if(mp[x.first] < x.second) mp[x.first] = x.second;
            }else{
                mp[x.first] = x.second;
            }
        }
    }
    ll ans = 0;
    ll lsd = 1;
    for(auto x:mp){
        ll so = x.first;
        ll num = x.second;
        ll tmp = pow_mod(so, num, MOD);
        lsd *= tmp;
        lsd %= MOD;
    }
    unordered_map<ll,ll> somap;
    for(i = 0;i < n;++i){
        ll tmp = lsd;
        for(auto x:vmp.at(i)){
            ll so =  x.first;
            ll num = x.second;
            ll tmp2;
            if(somap.count(so)){
                tmp2 = somap[so];
            }else{
                tmp2 = modinv(so, MOD);
                somap[so] = tmp2;
            }
            ll tmp3 = pow_mod(tmp2, num, MOD);
            tmp *= tmp3;
            tmp %= MOD;
        }
        ans += tmp;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <algorithm>

#include <vector>
#include <deque>
template<typename T>
std::vector<T> zero_one_bfs(std::vector<std::vector<std::pair<unsigned long, T>>> &graph, unsigned long s) {
  std::vector<T> cost(graph.size(), std::numeric_limits<T>::max());
  cost[s] = 0;
  std::deque<unsigned long> deque;
  deque.push_front(s);
  while (!deque.empty()) {
    auto v = deque.front();
    deque.pop_front();
    for (auto e : graph[v]) {
      if (e.second == 0 && cost[e.first] > cost[v]) {
        deque.push_front(e.first);
        cost[e.first] = cost[v];
      } else if (e.second == 1 && cost[e.first] > cost[v] + 1) {
        deque.push_back(e.first);
        cost[e.first] = cost[v] + 1;
      }
    }
  }
  return std::move(cost);
}

int main() {
  int K;
  std::cin >> K;
  std::vector<std::vector<std::pair<unsigned long, int>>> graph(K);
  for (int i = 1; i < K; ++i) {
    graph[i].push_back({(i + 1) % K, 1});
    graph[i].push_back({(i * 10) % K, 0});
  }
  auto cost = zero_one_bfs(graph, 1ul);
  std::cout << cost[0] + 1 << std::endl;
  return 0;
}

Measured memory_bytes: 8064
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

char s[100001];

int main()
{
	cin >> s;
	int c0 = 0, c1 = 0;
	int len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == '0')
			c0++;
		else if (s[i] == '1')
			c1++;
	}
	cout << min(c0, c1) *2<< endl;

}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cstdio>
#include<cctype>
using namespace std;
string str2;
int main(){
	int num=0,count[1000]={0};
	char ch[1000];
	double x;
	string str,ring;
	while(cin>>str){
		for(int i=0;i<str.size();i++){
			if(isupper(str[i])){
				str[i]+='a'-'A';
			}
			num=str[i]-'a';
			count[num]++;
		}
	}
	for(int j=0;j<26;j++){
		str2=j+'a';	
		cout<<str2<<" : "<<count[j]<<endl;
	}
	return 0;

}

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

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

int main() {
	int n;
	ll c, k;
	cin >> n >> c >> k;
	ll t[n];
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	sort(t, t + n);
	ll ans = 0;
	int index = 0;
	while(index < n) {
		ll time = t[index] + k;
		ll cap = 1;
		if (index == n - 1) {
			cout << (ans + 1) << endl;
			return 0;
		}
		for (int j = index + 1; j < n; j++) {
			if (t[j] <= time && cap < c) {
				cap++;
				if (j == n - 1) {
					cout << (ans + 1) << endl;
					return 0;
				}
			} else {
				ans++;
				index = j;
				break;
			}
		}
		if (index > n - 1){
			cout << ans << endl;
			return 0;
		}
	}
	

	return 0;
}

Measured memory_bytes: 1024
// きさま！ 見ているなッ！

#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>
#include<thread>

using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<ll>;

const ll MOD = 1000000007;


int main()
{
	int N; cin >> N;
	vec A(N);
	map<int, ll> cnt;

	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
		cnt[A[i]]++;
	}

	ll total = 0;
	for (auto c : cnt)
	{
		total += c.second*(c.second - 1) / 2;
	}

	for (int i = 0; i < N; ++i)
	{
		int c = cnt[A[i]];

		ll ans = total;
		ans -= c*(c - 1) / 2;
		ans += (c-1)*(c - 2) / 2;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 10240