akhauriyash/Code-Regression huggingface dataset:
use proconio::input;

const MOD: usize = 1_000_000_007;

fn main() {
  input! {
    s: String,
  }
  let n = 13;
  let mut chars = s.chars().collect::<Vec<char>>();
  let mut dp = vec![0;n];
  dp[0] = 1;

  let mut mul = 1;
  let mut index = chars.len() - 1;
  loop {
    let c = chars[index];
    let mut next_dp = vec![0;n];
    if c == '?' {
      for i in 0..10 {
        for ii in 0..n {
          next_dp[(i * mul + ii) % n] += dp[ii];
          next_dp[(i * mul + ii) % n] %= MOD;
        }
      }
    } else {
      let i = c.to_digit(10).unwrap() as usize;
      for ii in 0..n {
        next_dp[(i * mul + ii) % n] += dp[ii];
        next_dp[(i * mul + ii) % n] %= MOD;
      }
    }
    mul *= 10;
    mul %= n;
    dp = next_dp;
    
    if index == 0 {
      break
    }
    index -= 1;
  }
  
  println!("{}", dp[5]);
}

Measured memory_bytes: 2700
#include<stdio.h>
int main(){
  int N, v, A[100], i, j;
  scanf("%d",&N);
  for(i = 0; i < N; i++){
    scanf("%d",&A[i]);
  }
  for(i = 0; i < N-1; i++){
    printf("%d ",A[i]);
  }
  printf("%d",A[N-1]);
  printf("\n");
  for(i = 1; i <= N - 1; i++){
    v = A[i];
    j = i - 1;
    while( j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    for(j = 0; j < N-1; j++) printf("%d ",A[j]);
    printf("%d",A[N-1]);
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2104
#include<stdio.h>

int main(){
    
    int N,M;
    scanf("%d",&N);
    scanf("%d",&M);
    
    int L[M];
    int R[M];
    
    int Lmax=0;
    int Rmin=N;
    for(int i=0;i<M;i++){
        scanf("%d",&L[i]);
        if(L[i] > Lmax){
            Lmax = L[i];
        }
        scanf("%d",&R[i]);
        if(R[i] < Rmin){
            Rmin = R[i];
        }
    }
    
    int answer = Rmin - Lmax + 1;
    
    if(answer > 0){
        printf("%d",answer);
    }
    else{
        printf("0");
    }
    printf("\n");
    
    return 0;
}

Measured memory_bytes: 896
using System;

namespace Project
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			while (true)
			{
				string s = Console.ReadLine();
				if (s == "-") break;
				int m = int.Parse(Console.ReadLine());
				char[,] c = new char[m + 1, s.Length];
				for (int i = 0; i < s.Length; i++)
				{
					c[0, i] = s[i];
				}
				for (int i = 1; i < m+1; i++)
				{
					int h = int.Parse(Console.ReadLine());
					for (int j = 0; j < s.Length; j++)
					{
						if (j - h >= 0)
						{
							c[i, j-h] = c[i - 1, j];
						}
						else
						{
							c[i, j - h +s.Length] = c[i - 1, j];
						}
					}
				}
				for (int i = 0; i < s.Length; i++)
				{
					Console.Write(c[m, i]);
					if (i == s.Length - 1) Console.Write("\n");
				}
			}
		}
	}
}

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

int main() {
  int N, K, x, s;
  cin >> N >> K;
  s=0;
  for(int i=0; i<N; i++){
    cin >> x;
    if(x <= K-x){//Aが近い
      s+=x*2;
    }
    else{//Bが近い
      s+=(K-x)*2;
    }
  }
  cout << s << endl; 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int dx[]={1,-1,0,0};
const int dy[]={0,0,-1,1};
int n,m;
char a[1010][1010];
int ans[1010][1010];
vector<pair<int,int> > v;
int main(){
	memset(ans,0,sizeof(ans));
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>a[i][j];
			if(a[i][j]=='#')v.push_back(make_pair(i,j));
		}
	}
	int front=0;
	int rear=v.size();
	int cnt=0;
	while(front<rear){
		int x=v[front].first;
		int y=v[front].second;
		cnt=ans[x][y];
		for(int i=0;i<4;i++){
			int ax=x+dx[i];
			int ay=y+dy[i];
			if(ax>=0&&ax<n&&ay>=0&&ay<m&&a[ax][ay]=='.'){
				ans[ax][ay]=ans[x][y]+1;
				a[ax][ay]='#';
				v.push_back(make_pair(ax,ay));
				rear++;
			}
		}
		front++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 15596
#include<iostream>
#include<vector>
using namespace std;
int N;
vector<int> have;
vector<int> maxn;
int func(){
	int Q;
	cin >> Q;
	for(int i=0;i<Q;++i){
		int t, x, d;
		cin >> t >> x >> d;
		if(t == 1){
			have[x] += d;
			if(have[x] > maxn[x])return x;
		}else{
			have[x] -= d;
			if(have[x] < 0)return x;
		}
	}	
	return 0;
}
int main(){
	cin >> N;
	have.resize(N+1, 0);
	maxn.resize(N+1);
	for(int i=1;i<=N;++i){
		cin>>maxn[i];
	}
	cout << func() << endl;	
	return 0;
}



Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
#include <string>
using namespace std;

int main(){
    string s; cin >> s;
    int p = 0 , m = 0 ;
    for ( int i = 0 ; i < 4 ; i++ ){
        if ( s.at(i) == '+' ) p++;
        else m++; 
    }
    int ans = p - m;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n,m;
    cin >> n >> m;
    vi a(m);
    rep(i,m)cin >> a[i];
    int ans = max(a[0]-1, n-a[m-1]);
    rep(i,m-1){
        ans = max(ans, (a[i+1]-a[i])/2);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3164
// #define LOCAL
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char c) {return to_string((string) &c);}
string to_string(bool b) {return (b ? "true" : "false");}
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) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll h,w; cin >> h >> w;
    string s[h];
    rep(i,h)cin >> s[i];
    ll dx[] = {0,1};
    ll dy[] = {1,0};
    auto is_out = [&](ll x, ll y){
       if(x < 0 || x >= h || y < 0 || y >= w)return true;
       return false;
    };
    ll ans = 0;
    if(s[0][0] == '#')ans++;
    deque<Pll> deq;
    vector<vector<ll>> used(h, vector<ll>(w, INF));
    used[0][0] = ans;
    deq.emplace_back(0,0);

    while(!deq.empty()){
        auto p = deq.front();deq.pop_front();
        ll x = p.first, y = p.second;
        ll c = used[x][y];
        rep(i,2){
            ll nx = x + dx[i];
            ll ny = y + dy[i];
            if(is_out(nx, ny))continue;
            if(used[nx][ny] <= c)continue;
            if(s[nx][ny] == '#' && s[x][y] == '.'){
                used[nx][ny] = c + 1;
                deq.emplace_back(nx, ny);
            }
            else{
                used[nx][ny] = c;
                deq.emplace_front(nx, ny);
            }
        }
        debug(used);
    }

    cout << used[h-1][w-1] << endl;
}

Measured memory_bytes: 384
#include <cstdio>

int N, M;
int p1[200010], p2[200010];
int a, b;

int main()
{
	int i;
	scanf("%d%d", &N, &M);
	for(i=0; i<M; i++){
		scanf("%d%d", &a, &b);
		a--, b--;
		if(a==0)
			p1[b] = 1;
		else if(b==0)
			p1[a] = 1;
		else if(a==N-1)
			p2[b] = 1;
		else if(b==N-1)
			p2[a] = 1;
	}
	int ok = 0;
	for(i=0; i<N; i++){
		if(p1[i] == 1 && p2[i]==1){
			ok = 1; 
			break;
		}
	}
	if(ok)
		printf("POSSIBLE\n");
	else
		printf("IMPOSSIBLE\n");
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vvi;
typedef vector <ll> vl;
typedef vector <vector <ll>> vvl;
typedef vector <bool> vb;
typedef vector <vector <bool>> vvb;

//const int kINF_int = INT_MAX;
//const long long kINF_long = LONG_LONG_MAX;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

template <typename type1, typename type2>
ostream &operator<<(ostream &out, const pair <type1, type2> &p) {
    out << '[' << p.first << ", " << p.second << ']';
    return out;
}

template <typename type>
ostream &operator<<(ostream &out, const vector <type> &massive) {
    for (const type &i : massive) {
        out << i << ' ';
    }
    return out;
}

template <typename type>
void print(const vector <type> &massive, const string &sep, const string &end) {
    if (!massive.empty()) {
        cout << massive[0];
        for (int i = 1; i < massive.size(); ++i) {
            cout << sep << massive[i];
        }
    }
    cout << end;
}

template <typename type>
void print(const vector <type> &massive) {
    print(massive, " ", "\n");
}

template <typename type>
void print(const type &element, const string &end) {
    cout << element << end;
}

template <typename type>
void print(const type &element) {
    print(element, "\n");
}

void solve() {

}

int main() {
    fast();

    //freopen("../input.txt", "r", stdin);

    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({a * c, b * c, a * d, b * d});

    return 0;
}


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

int main(){
    int N, D, X, S;
    cin >> N >> D >> X;
    vector<int> A(N);
    for (int l = 0; l < N; l++){
        cin >> A[l];
    }
    for (int j = 0; j < N; j++){
        for (int k = 0; k*A[j]+1 <= D; k++){
            S++;
        }
    }
    cout << S+X << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <set>
using namespace std;


#define ll long long int


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, m;
    cin>>n>>m;
    
    vector<int> a(n);
    
    int count = 0;
    int sum = 0;
    
    for(int i = 0; i<n; i++){
        cin>>a[i];
        sum += a[i];
    }
    
    for(int i=0; i<n; i++){
        if(4*m*a[i] >= sum){
            count++;
        }
    }
    
    if(count >= m){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

using Weight = int;
using Flow = int;
struct Edge {
	int s, d; Weight w; Flow c;
	Edge() {};
	Edge(int s, int d, Weight w = 1) : s(s), d(d), w(w), c(w) {};
};
bool operator<(const Edge &e1, const Edge &e2) { return e1.w < e2.w; }
bool operator>(const Edge &e1, const Edge &e2) { return e2 < e1; }

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int s, int d, Weight w = 1) { g[s].emplace_back(s, d, w); }


struct UnionFind {
	vector<int> parent;
	int size;
	UnionFind(int n) :parent(n, -1), size(n) {}
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x == y)return false;
		if (size_of(x) < size_of(y))swap(x, y);
		parent[x] += parent[y]; parent[y] = x; size--;
		return true;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
	int size_of(int x) { return -parent[root(x)]; }
};

//????°???¨?????¨ (Minimum Spanning Tree)
//Prim O(|E|log|V|)
//root ????????°?????????????????????????±?
pair<Weight, Edges> prim(const Graph &g, int root = 0) {
	int n = g.size();
	Edges mst;
	Weight total = 0;
	vector<bool> v(n);
	priority_queue<Edge, vector<Edge>, greater<Edge>> pq;
	pq.emplace(-1, root, 0);
	while (pq.size()) {
		Edge e = pq.top(); pq.pop();
		if (v[e.d])continue;
		v[e.d] = true;
		total += e.w;
		if (e.s != -1)mst.emplace_back(e);
		for (auto &f : g[e.d])
			if (!v[f.d])
				pq.emplace(f);
	}
	return make_pair(total, mst);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int V, E; cin >> V >> E;
	Graph g(V);
	rep(i, 0, E) {
		int s, t, w; cin >> s >> t >> w;
		add_edge(g, s, t, w);
	}
	auto res = prim(g);
	cout << res.first << endl;
	return 0;
}

Measured memory_bytes: 10636
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	if(n%2 == 1){
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0, five = 10;
	while(five <= n){
		ans += n / five;
		five *= 5;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	string s;
	int board[ 9 ];

	while ( cin >> s ){
		for ( int i = 0; i < 9; ++i ){
			switch( s[ i ] ){
				case 'o': board[ i ] = 1; break;
				case 'x': board[ i ] = 2; break;
				case 's': board[ i ] = 0; break;
			}
		}

		int winner = 0;
		for ( int i = 0; i < 3; ++i ){
			if ( board[ i*3 + 0 ] && board[ i*3 + 0 ] == board[ i*3 + 1 ] && board[ i*3 + 0 ] == board[ i*3 + 2 ] ){
				winner = board[ i*3 + 0 ];
				break;
			}else if( board[ 0 + i ] && board[ 0 + i ] == board[ 3 + i ] && board[ 0 + i ] == board[ 6 + i ] ){
				winner = board[ 0 + i ];
				break;
			}
		}
		if ( !winner && board[ 4 ] && ( board[ 0 ] == board[ 4 ] && board[ 4 ] == board[ 8 ] ) || ( board[ 2 ] == board[ 4 ] && board[ 4 ] == board[ 6 ] ) ){
			winner = board[ 4 ];
		}

		switch ( winner ){
			case 0: cout << "d" << endl; break;
			case 1: cout << "o" << endl; break;
			case 2: cout << "x" << endl; break;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi atan(1.0)*4
#define pb(x) push_back(x)
#define in(x) insert(x)
#define fl(x,y) for(ll i=x;i<y;i++)
#define vi vector<long long>
#define vs  vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
string en="\n";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define fi first
#define se second
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
/*bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
*/
//bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int main()
{
    ll a,b,c,t,n,p,q,r,y,yy,sum,ct=0,flag=0;
    string s1,s2,s3;
    set<ll>st;
    char ch;
    map<ll,ll>mp;
    deque<char>d1,d2,d3;
    vector<ll>v,vv,vz;
    cin>>n;
    fl(0,n)
    {
        cin>>t; v.pb(t);
    }
    sort(all(v));
    ll mx=v[n-1];
    ll mn=v[0];
    ll ans=8734643875673468;
    ll s;
    for(ll i=mn;i<=mx;i++)
    {
        s=0;
        for(ll j=0;j<n;j++)
        {
            s+=(i-v[j])*(i-v[j]);
        }
        ans=min(ans,s);
    }
    cout<<ans<<endl;
}






Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<complex>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
typedef complex<double> xy_t;

int main() {
    ll n; cin >> n;
    ll ans = 0;
    for (ll i = 1; i * i + i < n; ++i) {
        if (n % i == 0) {
            //cout << i << endl;
            ans += n / i - 1;
        }
    }
    cout << ans << endl;
}


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

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

    static class ABC144_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();

            if ((N >= 1) && (N <= 81)) {
                for (int i = 1; i <= 9; i++) {
                    for (int j = 1; j <= 9; j++) {
                        if ((i * j) == N) {
                            out.println("Yes");
                            return;
                        }
                    }
                }

            }
            out.println("No");
        }

    }
}



Measured memory_bytes: 21844
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define ll long long
#define umapii unordered_map <int,int>
#define umapll unordered_map<ll,ll>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define vs vector<string>
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pi>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define endl '\n'
#define all(v) (v).begin(),(v).end()
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define MP(a,b) make_pair(a,b)
#define debug(x)       cerr<< #x << " : " << x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[i].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";

/* ordered set: 
tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
member functions :
1. order_of_key(k) : number of elements strictly lesser than k
2. find_by_order(k) : k-th element in the set
*/
ll modexp(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}

const int inf = 1e9 + 7;
int main(){
    IOS;
    ll a , b , c , k;
    cin >> a >> b >> c >> k;
    if(k <= a){
        cout << k << endl;
        return 0;
    }
    if(k <= (a + b)){
        cout << a << endl;
    } else{
        ll d = (k - (a + b));
        cout << (a - d) << endl;
    }
    #ifdef LOCAL
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";       
    #endif
    // g++ -DLOCAL -std=c++17 f.cpp
}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
template<typename T, typename U> T &ctmax(T &x, const U &y){ return x = max<T>(x, y); }
template<typename T, typename U> T &ctmin(T &x, const U &y){ return x = min<T>(x, y); }



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n, m, k;
	cin >> n >> m >> k;
	vector<int> a(n), b(m);
	for(auto i = 0; i < n; ++ i){
		cin >> a[i];
	}
	for(auto i = 0; i < m; ++ i){
		cin >> b[i];
	}
	long long asum = 0, bsum = accumulate(b.begin(), b.end(), 0LL);
	int res = 0;
	for(auto i = 0, j = m; i <= n; ++ i){
		while(j > 0 && asum + bsum > k){
			-- j;
			bsum -= b[j];
		}
		if(asum + bsum <= k) ctmax(res, i + j);
		if(i < n){
			asum += a[i];
		}
	}
	cout << res << "\n";
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 4768
#include <iostream>
#include <algorithm>
#include <fstream>
#include <utility>
#include <iomanip>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#define IO ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;

using namespace std;
const ll INF = 1e18;
const int mod = 1e9 + 7, N = 1e5 + 5, inf = 1e9;
int n, m, s, t, u, v;
vector<int>arr[N];

int bfs()
{
    queue<pair<int, int>>q;
    bool vis[N][5] = {};
    q.push({ s, 0 });
    vis[s][0] = true;
    while(q.size())
    {
        u = q.front().first;
        int ken = q.front().second;
        q.pop();

        if(u == t && ken % 3 == 0)
            return ken / 3;

        for(auto i : arr[u])
        {
            if(!vis[i][(ken + 1) % 3])
            {
                q.push({i, ken + 1});
                vis[i][(ken + 1) % 3] =true;
            }
        }
    }
    return -1;
}

int main()
{
    IO;
    cin >> n >> m;
    for(int i =0; i < m; i++)
    {
        cin >> u >> v;
        arr[u].push_back(v);
    }
    cin >> s >> t;
    cout << bfs() << '\n';
    return 0;
}

Measured memory_bytes: 9552
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int D, N, times;
	cin >> D >> N;
	if (N == 100) { N++; }
	times = (int)pow(100, D);
	cout << times*N << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	
	string s; cin>>s;
	stack<char> ss;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'B') {
			if(!ss.empty()){
				ss.pop();
			}
			continue;
		}
		else{
			ss.push(s[i]);
		}
	}
	string res = "";
	while(!ss.empty()){
		res += ss.top();
		ss.pop();
	}
	reverse(res.begin(),res.end());
	cout<<res;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int i;
	int a, b, ans;
	int order;
	int judge;
	
	while( scanf("%d %d",&a, &b) != EOF )
	{	
		judge = 10;
		ans = a + b;
		
		for( i = 1 ; i <= 10 ; i++ )
		{
			if( ans / judge == 0 )
			{
				order = i;
				break;
			}
			judge *= 10;
		}
		printf("%d\n",order);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
int getV(int X){
	int Sum=0;
	while (X>0){
		Sum+=X%10;
		X/=10;
	}
	return Sum;
}
int main(int argc, char* argv[])
{
	int N,A,B;
	cin>>N;
	int minV=1e9;
	for (A=1,B=N-1;A<=N-1,B>=1;A++,B--){
		int v=getV(A)+getV(B);
		if (minV>v){
			minV=v;
		}
	}
	cout<<minV<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll under[1000500];
ll over[1000500];
ll n, q, k, d;

void query(int now) {
    ll delta = (over[now+1] - under[now+1] + 1 + n) % n;
    if(delta * 2 >= n || delta == 0) {
        under[now] = 1;
        over[now] = n;
        return;
    }
    ll after = under[now+1];
    if(after > n / 2) after - n / 2;
    ll new_under = ((after-1) * 2 + 1) % n;
    under[now] = new_under;
    over[now] = (new_under + delta * 2 - 1 + n) % n;
    return;
}

bool isin(ll under, ll over, ll val) {
    if(under <= over) {
        if(((under <= val) && (val <= over))) {
            //cout << -1 << endl;
            return true;
        }
    } else {
        if(((val >= under) || (val <= over))) {
            //cout << -1 << endl;
            return true;
        }
    }
    //cerr << "FAILED " << under << " " << over << " " << val << endl;
    return false;
}

ll one(ll now) {
    if(now % 2 == 0) {
        return now / 2;
    }
    return n / 2 + (now + 1) / 2;
}

ll zero(ll now) {
    if(now % 2 == 0) {
        return n / 2 + now / 2;
    }
    return (now + 1) / 2;
}

int main() {
    cin >> n >> q >> k >> d;
    over[q] = d;
    under[q] = d;
    for(int i = q - 1; i >= 0; i--) {
        query(i);
    }
    for(int i = 0; i <= q; i++) {
        //cout << under[i] << " " << over[i] << endl;
    }
    /*
    if(under[0] < over[0]) {
        if(!((under[0] <= k) && (k <= over[0]))) {
            //cout << -1 << endl;
            return 0;
        }
    } else {
        if(!((k >= under[0]) || (k <= over[0]))) {
            //cout << -1 << endl;
            return 0;
        }
    }
    */
    if(!isin(under[0], over[0], k)) {
        cout << -1 << endl;
        return 0;
    }
    vector<int> ans;
    ll now = k;
    for(int i = 1; i <= q; i++) {
        ll NEW = zero(now);
        //cout << i << " NEWNUMBER : " << NEW << endl;
        if(isin(under[i], over[i], NEW)) {
            ans.push_back(0);
            now = NEW;
            //cout << "0 " << now << endl;
            continue;
        }
        NEW = one(now);
        ans.push_back(1);
        now = NEW;
        //cout << "1 " << now << endl;
    }
    for(int i = 0; i < ans.size(); i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 21240
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <string>

using namespace std;

int main(){
  int N, A;
  cin >> N >> A;
  if(N % A == 0){
    cout << 0 << endl;
  }else{
    cout << 1 << endl;
  }
}


Measured memory_bytes: 256
# nCr(n, r, m): 組合せ
# nHr(n, r, m): 重複組合せ
MOD = 10**9 + 7
fac = [1,1] # 階乗 n!
inv = [0,1] # 逆元 1/n
finv = [1,1] # 逆元の階乗 (n^-1)! = (1/n)!

def finv_init(n, m):
    for i in range(2, n+1):
        fac.append( (fac[-1] * i ) % m )
        inv.append( (-inv[m%i] * (m//i)) % m )
        finv.append( (finv[-1] * inv[-1]) % m )

def nCr(n, r, m):
    if (n<0 or r<0 or n<r): return 0
    r = min(r, n-r)
    return fac[n] * finv[n-r] * finv[r] % m

def nHr(n, r, m): return nCr(n+r-1, r, m)

s = int(input())
finv_init(s, MOD) # 初期設定
ans = 0
for n in range(1, s+1):
    if s < 3*n: continue
    ans += nHr(n, s - 3*n, MOD)
print(ans % MOD)


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());

        int b[] = new int[m];
        for(int i = 0; i < m; i++){
            b[i] = Integer.parseInt(sc.next());
        }

        int a[][] = new int[n][m];

        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                a[i][j] = Integer.parseInt(sc.next());
            }
        }

        int sum = 0;
        int cnt = 0;

        for (int i = 0; i < n; i++) {
            sum = 0;
            for (int j = 0; j < m; j++) {
                sum += a[i][j] * b[j];

                
            }
            if(sum + c > 0){
                cnt ++;
            }
        }

        System.out.println(cnt);
    }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int n, m, q;
vector<vector<int>> vx;
void all_dfs(int i, int p, vector<int> v) {
  if (i == n) {
    vx.push_back(v);
    return;
  }

  rep(j, p, m + 1) {
    vector<int> nv = v;
    nv.push_back(j);
    all_dfs(i + 1, j, nv);
  }
}

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

  cin >> n >> m >> q;

  vector<int> v;
  all_dfs(0, 1, v);

  vector<int> a(q), b(q), c(q), d(q);
  rep(i, 0, q) cin >> a[i] >> b[i] >> c[i] >> d[i];

  ll ans = 0;
  rep(i, 0, vx.size()) {
    ll cost = 0;
    rep(j, 0, q) {
      if (vx[i][b[j] - 1] - vx[i][a[j] - 1] == c[j])
        cost += d[j];
    }
    chmax(ans, cost);
  }

  cout << ans << endl;
}


Measured memory_bytes: 9804
N=int(input())
ab=[]
for i in range(N):
    a,b=map(int,input().split())
    ab.append([b,a])
cd=[]
for i in range(N):
    c,d=map(int,input().split())
    cd.append([c,d])
cd.sort(key=lambda x:(x[0],x[1]))
ab.sort(key=lambda x:(-x[0],-x[1]))
ans=0
for i in cd:
    c,d=i[0],i[1]
    for j in ab:
        b,a=j[0],j[1]
        if a<c and b<d :
            ans+=1
            ab.remove([b,a])
            break
print(ans)


Measured memory_bytes: 39152
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	int n;
	vector<int> p;
	int P;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> P;
		p.push_back(P);
	}
	int t, v;
	int MAXP, MINP;
	int count = 0;
	for (t = 1; t < n - 1; t++) {
		MAXP = max(p[t - 1], max(p[t], p[t + 1]));
		MINP = min(p[t - 1], min(p[t], p[t + 1]));
		if (p[t] != MAXP && p[t] != MINP) {
			count++;
		}
	}
	cout << count;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint K, A, B; cin >> K >> A >> B;
    range(i, A, B + 1) {
        if (i % K == 0) {
            cout << "OK" << "\n";
            return 0;
        }
    }
    cout << "NG" << "\n";
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N, K;
    cin >> N >> K;
    int h;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> h;
        if (h >= K) ans++;
    }
    cout << ans << endl;
    return 0;
    
}


Measured memory_bytes: 256
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

# A,Bの組み合わせを全探索し, 上位のみ切り出す
AB = [a+b for a in A for b in B]
AB.sort(reverse=True)
AB = AB[:min(3001,X*Y*Z+1)]

# 切り出したa+bの上位要素と, cで全探索する
ABC = [ab+c for ab in AB for c in C]
ABC.sort(reverse=True)

for i in range(K):
    print(ABC[i])


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

#define PI acos(-1)
#define pb push_back
#define int long long int
#define mp make_pair
#define pi pair<int, int>
#define pii pair<pi, int>
#define fir first
#define sec second
#define MAXN 100001
#define MAXL 20
#define mod 1000000007

signed main()
{
  int n;
  cin >> n;
  int ans = 0;
  vector<int> v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  sort(v.rbegin(), v.rend());
  ans += v[0];
  bool kappa = true;
  int ptr = 1;
  for (int i = 1; i < n - 1; i++)
  {
    ans += v[ptr];
    kappa = !kappa;
    if (kappa)
      ptr++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4784
#include <stdio.h>

int main(void) {
	int zrm;
	scanf("%d", &zrm);
	zrm % 111 != 0 ? printf("%d\n", (zrm / 111 + 1) * 111) : printf("%d\n", (zrm / 111) * 111);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    int sum = 0;
    cin >> a >>b;
    for(int i=0;i<2;i++){
        if(a <= b){
            sum+=b;
            b--;
        } else {
            sum+=a;
            a--;
        }
    }
    cout << sum;
}


Measured memory_bytes: 256
<?php
class Dice{
  public $label=[1,2,3,4,5,6];#index+1????????¢?????????
  public $pos=[0,1,2];#?????¢,?????¢,??\??¢???index ???????????¢???5-index
  function __construct($sLabel){$this->label=explode(' ',$sLabel,6);}
  function move($s){
    $x=$this->pos[0];
    if($s=='E'){
      $this->pos[0]=5-$this->pos[2];
      $this->pos[2]=$x;
    }
    elseif($s=='W'){
      $this->pos[0]=$this->pos[2];
      $this->pos[2]=5-$x;
    }
    elseif($s=='N'){
      $this->pos[0]=$this->pos[1];
      $this->pos[1]=5-$x;
    }
    elseif($s=='S'){
      $this->pos[0]=5-$this->pos[1];
      $this->pos[1]=$x;
    }
  }
  function spin($s){
    $x=$this->pos[1];
    if($s=='L'){
      $this->pos[1]=$this->pos[2];
      $this->pos[2]=5-$x;
    }
    elseif($s=='R'){
      $this->pos[1]=5-$this->pos[2];
      $this->pos[2]=$x;
    }
  }
  function toTop($label){
    for($j=0;$j<4;$j++){
      if($this->top()==$label) return 1;
      $this->move('N');
    }
    for($j=0;$j<2;$j++){
      $this->move('E');
      if($this->top()==$label) return 1;
      $this->move('E');
    }
    return 0;
  }
  function toSpin($label){
    for($j=0;$j<4;$j++){
      if($this->front()==$label) return 1;
      $this->spin('L');
    }
    return 0;
  }
  function isSame($dice){
    if(!$dice->toTop($this->top())) return 0;
    if(!$dice->toSpin($this->front())) return 0;
    if($dice->right()!=$this->right()) return 0;
    if($dice->bottom()!=$this->bottom()) return 0;
    if($dice->back()!=$this->back()) return 0;
    if($dice->left()!=$this->left()) return 0;
    return 1;
  }
  function top(){return $this->label[$this->pos[0]];}
  function front(){return $this->label[$this->pos[1]];}
  function right(){return $this->label[$this->pos[2]];}
  function bottom(){return $this->label[5-$this->pos[0]];}
  function back(){return $this->label[5-$this->pos[1]];}
  function left(){return $this->label[5-$this->pos[2]];}
}

$n=trim(fgets(STDIN));
$d=[];
for($i=0;$i<$n;$i++) $d[]=new Dice(trim(fgets(STDIN)));

$l=$n-1;
$F=1;
for($i=0;$i<$l;$i++){
  for($j=$i+1;$j<$n;$j++){
    if($d[$i]->isSame($d[$j])){$F=0;break;}
  }
}

echo ($F)?'Yes':'No';
?>

Measured memory_bytes: 15556
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=1e9;
const long long LINF=1e18;
#define int long long
//template
template <typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;
    res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
//main
signed main(){
  string s,t;cin>>s>>t;
  int N=s.size();
  std::vector<int> v(223456),a(223456);
  std::vector<int> w(11);
  w[0]=0;
  for(int i=1;i<=10;i++)w[i]=w[i-1]+i;
  reverse(t.begin(),t.end());

  a[0]=1;
  for(int i=0;i<N;i++){
    if(t[i]=='?')a[i+1]=a[i]*10%MOD;
    else a[i+1]=a[i];
    a[i+1]%=MOD;
  }

  v[0]=0;
  int now=1;
  for(int i=0;i<N;i++){
    if(t[i]=='?')v[i+1]=v[i]*10%MOD+w[9]*now%MOD*a[i];
    else v[i+1]=v[i]*1+(t[i]-'0')*now%MOD*a[i]%MOD;
    now*=10;now%=MOD;
    v[i+1]%=MOD;
  }

  reverse(t.begin(),t.end());

  int gyaku=pw(10,MOD-2);
  now=pw(10,N-1);

  int ans=0,res=0,flg=0;
  for(int i=0;i<N;i++){
    //cout<<i<<" "<<ans<<endl;
    int j=s[i]-'0';
    //cout<<i<<" "<<j<<endl;
    if(t[i]=='?'){
      if(j>0){
        ans+=res*j%MOD*a[N-i-1]%MOD;
        ans+=w[j-1]*now%MOD*a[N-i-1]%MOD;
        ans+=v[N-i-1]*j%MOD;
        ans%=MOD;
      }
      res+=j*now%MOD;
      res%=MOD;
      now*=gyaku;
      now%=MOD;
      continue;
    }

    if(s[i]<t[i]){
      flg=1;
      break;
    }

    if(s[i]>t[i]){
      ans+=res*a[N-i-1];
      ans+=(t[i]-'0')*now%MOD*a[N-i-1]%MOD;
      ans+=v[N-i-1];
      ans%=MOD;
      flg=1;
      break;
    }

    assert(s[i]==t[i]);
    res+=j*now%MOD;
    res%=MOD;
    now*=gyaku;
    now%=MOD;
  }

  if(!flg) ans+=res;
  ans%=MOD;

  //for(int i=0;i<5;i++)cout<<v[i]<<" ";cout<<endl;
  //for(int i=0;i<5;i++)cout<<a[i]<<" ";cout<<endl;
  fin(ans);
}



Measured memory_bytes: 7220
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

vector <ll> v ;

int gcd (int a ,int b ,int c){
    int x = min(a, min(b,c));
    for (int i=x ; i>=1 ; i--)
        if (a%i==0 &&b%i==0 &&c%i==0)
            return i;
    return 1 ;
}


int main()
{
int a ;
cin >> a ;
int b=a , c =a;
ll ans=0;
for (int i = 1 ; i <= a ; i++)
    for (int j = 1 ; j <= b ; j++)
        for (int k = 1 ; k <= c ; k++)
            ans+=gcd(i,j,k);

cout << ans;

}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll ans=0;
	for(ll i=1;i<=n;i++){
		if(i%3==0||i%5==0){
			continue;
		}
		ans+=i;
	}
	cout <<ans;
	// your code goes here
	return 0;
}


Measured memory_bytes: 3672
n = int(input())
d = list(map(int,input().split()))
mod = 998244353
new = [0 for _ in range(max(d)+1)]
for x in d:
  new[x] += 1
if d[0] != 0:
  print(0)
elif new[0] != 1:
  print(0)
else:
  ans = 1
  for i in range(1,max(d)+1):
    ans *= new[i-1] ** new[i]
    #print(new[i],new[i-1],ans)
    ans %= mod
  print(ans)

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

int n;
string s;

string f() {
	char t = s[0];
	int m = 1;
	string res = "";
	for (int i = 1; i < s.size(); i++) {
		if (t == s[i]) {
			m++;
		}
		else {
			res += to_string(m);
			res	+= s[i - 1];
			t = s[i];
			m = 1;
		}
	}
	res += to_string(m);
	res += s[s.size() - 1];
	return res;
}

int main(){
	while (cin >> n && n != 0) {
		cin >> s;
		for (int i = 0; i < n; i++) {
			s = f();
		}
		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define mod 1000000007 
#define rep(i,j,l) for(int i=j;i<=l;i++)
#define dec(i,j,l) for(int i=j;i>=l;i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull; 



int main() {  
   ll n,a,b;
   cin>>n>>a>>b; 
   ll x=n%(a+b); 
   if(x>=a) 
   x=a;
   else x;
   ll ans=n/(a+b)*a+x ; cout<<ans;
}


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main() {
    int n;
    cin >> n;
    map<int, int> odd;
    map<int, int> even;
    rep(i, n) {
        int tmp;
        cin >> tmp;
        if (i%2==0) {
            even[tmp]++;
        }
        else {
            odd[tmp]++;
        }
    }
    pair<int, int> mx_odd ={ 0, 0 };
    pair<int, int> sec_odd ={ 0, 0 };
    for (auto itr = odd.begin();itr!=odd.end();itr++) {
        if (itr->second>=mx_odd.second) {
            sec_odd = mx_odd;
            mx_odd ={ itr->first, itr->second };
        }
        else if (itr->second >= sec_odd.second) {
            sec_odd ={ itr->first, itr->second };
        }
    }
    int out = 1e6;
    for (auto itr = even.begin();itr!=even.end();itr++) {
        if (itr->first==mx_odd.first) continue;
        out = min(n-mx_odd.second - itr->second, out);
    }
    for (auto itr = even.begin();itr!=even.end();itr++) {
        if (itr->first==sec_odd.first) continue;
        out = min(n-sec_odd.second - itr->second, out);
    }
    cout << out << endl;

    return 0;
}

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

using namespace std;

const int maxn = 3010;
double p[maxn], dp[maxn][maxn];
int n;

int main()
{
    ios::sync_with_stdio(false);
    cout << setprecision(9) << fixed;
    cin >> n;

    for (int i = 1; i <= n; i++)
        cin >> p[i];
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 0; j <= i; j++)
            dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][max(0, j - 1)] * p[i];

    cout << dp[n][n - n / 2];

    return 0;
}


Measured memory_bytes: 69120
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto w = sread();
    // writeln(w);
    long[char] ary;
    foreach (i; 0 .. (w.length))
    {
        ary[w[i]] = ary.get(w[i], 0) + 1;
    }
    // writeln(ary);
    foreach (value; ary)
    {
        // writeln(value);
        if (value % 2 == 0)
        {
            continue;
        }
        else
        {
            writeln("No");
            return;
        }
    }
    writeln("Yes");

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


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

int main() {
  string s, t, r;
  int a, b;
  cin>>s>>t;
  map<string, int> cnt;
  cin>>a>>b;
  cnt[s] = a, cnt[t] = b;
  cin>>r;
  cnt[r]--;
  cout<<cnt[s]<<' '<<cnt[t];
}

Measured memory_bytes: 3604
s = input()
if s == "SUN":
    ans = 7
if s == "MON":
    ans = 6
if s == "TUE":
    ans = 5
if s == "WED":
    ans = 4
if s == "THU":
    ans = 3
if s == "FRI":
    ans = 2
if s == "SAT":
    ans = 1
print(ans)

Measured memory_bytes: 38256
#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int a[4];
	int b[4];

	int B,H;

	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		B = 0;
		H = 0;

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (a[i] == b[j]) {
					B++;
				}
			}
		}

		for (int i = 0; i < 4; i++) {
			if (a[i] == b[i]) {
				B--;
				H++;
			}
		}

		cout << H << " " << B << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==
*/

main :-
    get_number(N, A, B),
    X is min(N * A, B),
    writeln(X).


Measured memory_bytes: 8120