akhauriyash/Code-Regression huggingface dataset:
N, M = list(map(int, input().split()))
abc = []

for i in range(M):
  t = list(map(int, input().split()))
  k = list(map(int, input().split()))
  x = 0
  for j in k:
    x += (1 << (j - 1))
  abc.append(t + [x])

def nasu(n):
  ans = inf
  for i in range(1, n - 1):
    if ~n & i == 0:
      ans = min(ans, L[i] + L[n ^ i])
  return ans

inf = 10 ** 10
L = [inf] * (1 << N)

for i in range(1, N + 1):
  n = (1 << i) - 1
  while n < (1 << N):
    for j in range(M):
      if ~abc[j][2] & n == 0:
        L[n] = min(L[n], abc[j][0])
    L[n] = min(L[n], nasu(n))
    x = n & -n
    y = n + x
    n = ((n & ~y) // x >> 1) | y

if L[-1] == inf:
  print(-1)
else:
  print(L[-1])



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

int main()
{
    int k, x;
    cin >> k >> x;
    if (500 * k >= x)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	int A, B;

	cin >> A >> B;

	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0){
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
#define PB push_back

typedef struct{
  string x,i;
}Data;

string str;
Data l,m,r;
int pos;
int l0;
bool debug=0;

void printdata(Data);

Data getnum(){
  Data ret;
  while(pos<str.size() && (str[pos]=='X' || isdigit(str[pos]) ) ){
    if(str[pos]=='X'){
      ret.i+='0';
      ret.x+='1';
    }else{
      ret.i+=str[pos];
      ret.x+='0';
    }
    ++pos;
  }
  ++pos;
  if(ret.x[0]=='1' && ret.x.size()>1)l0=1;
  //printdata(ret);
  return ret;
}

string sadd(string l,string r){
  reverse(l.begin(),l.end());
  reverse(r.begin(),r.end());
  if(l.size()>r.size())swap(l,r);
  string ret;
  int c=0;
  int i;
  for(i=0;i<l.size();i++){
    int t=l[i]+r[i]+c-2*'0';
    c=t/10;
    t%=10;
    ret+=t+'0';
  }
  for(i;i<r.size();i++){
    int t=r[i]+c-'0';
    c=t/10;
    t%=10;
    ret+=t+'0';
  }
  if(c)ret+='1';
  reverse(ret.begin(),ret.end());
  return ret;
}

string mult(string ss,int r){
  reverse(ss.begin(),ss.end());
  string ret;
  int c=0;
  rep(i,ss.size()){
    int t=(ss[i]-'0')*r+c;
    c=t/10;
    t%=10;
    ret+='0'+t;
  }
  if(c)ret+='0'+c;
  reverse(ret.begin(),ret.end());
  return ret;
}

bool compare(string l,string r){
  bool ret=true;
  if(l.size()>r.size())swap(l,r);

  reverse(l.begin(),l.end());
  reverse(r.begin(),r.end());

  for(int i=0;i<l.size();i++){
    if(l[i]!=r[i])ret=false;
  }
  for(int i=l.size();i<r.size();i++){
    if(r[i]!='0')ret=false;
  }
  return ret;
}

void printdata(Data in){
  cout<<in.x<<" "<<in.i<<endl;
}

main(){
  while(getline(cin,str)){
    if(debug)cout<<str<<endl;
    pos=0;
    l0=0;
    l=getnum();
    m=getnum();
    r=getnum();
    if(debug){
      printdata(l);
      printdata(m);
      printdata(r);
    }

    Data lm;
    lm.i=sadd(l.i,m.i);
    lm.x=sadd(l.x,m.x);
    int ans=0;
    for(ans=l0;ans<10;ans++){
      Data tlm,tr;
      tlm.x=mult(lm.x,ans);
      tlm.i=lm.i;
      tr.x=mult(r.x,ans);
      tr.i=r.i;
      
      string ssl=sadd(tlm.x,tlm.i),ssr=sadd(tr.x,tr.i);
      if(compare(ssl,ssr)){
        if(debug)cout<<ssl<<" "<<ssr<<endl;
        break;
      }
    }
    if(ans==10)cout<<"NA"<<endl;
    else cout<<ans<<endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <deque>
#include <functional>
#include <initializer_list>
#include <math.h>
#include <map>
#include <random>
#include <set>
#include <stack>
#include <tuple>
#include <queue>
#include <vector>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define SORT(A) std::sort((A).begin(), (A).end())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())

using lli = long long int;
using pii = std::pair<int, int>;

// グリッド上の縦横移動
constexpr std::array<std::pair<int, int>, 4> dxdy = {
    std::pair<int, int>( 1,  0),
    std::pair<int, int>(-1,  0),
    std::pair<int, int>( 0,  1),
    std::pair<int, int>( 0, -1)
};

void VintOut(std::vector<int>& A){
    const int n = A.size();
    if(n == 0){putchar('\n'); return;}
    printf("%d", A[0]);
    for(int i = 1; i < n; ++i) printf(" %d", A[i]);
    putchar('\n');
}
void VintOut(std::vector<long long int>& A){
    const int n = A.size();
    if(n == 0){ putchar('\n'); return;}
    printf("%lld", A[0]);
    for(int i = 1; i < n; ++i) printf(" %lld", A[i]);
    putchar('\n');
}

template <typename T>
inline bool chmin(T& a, T b){
    if(b < a){ a = b; return true;}
    return false;
}

template <typename T>
inline bool chmax(T& a, T b){
    if(a < b){ a = b; return true;}
    return false;
}

inline bool isIn(int x, int y, int H, int W){
    return 0 <= x and x < H and 0 <= y and y < W;
}
inline bool bitUP(int state, int k){ return (state >> k) & 1; }
inline bool bitUP(long long int state, int k){ return (state >> k) & 1;}

// z-algorithm
template <class T> std::vector<int> z_algorithm(const T &str) {
    const int n = str.size();
    std::vector<int> resOfCP(n); resOfCP[0] = n;
    int i = 1, j = 0;
    while (i < n) {
        while (i + j < n and str[j] == str[i + j]) ++j;
        resOfCP[i] = j;
        if (j == 0) { ++i; continue;}
        int k = 1;
        while (i + k < n and k + resOfCP[k] < j) resOfCP[i + k] = resOfCP[k], ++k;
        i += k; j -= k;
    }
    return resOfCP;
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

constexpr int inf = 1e9 + 334 + 810 + 1919;
std::vector<int> A;

int main(void){
    int n; scanf("%d", &n);
    A.resize(n); REP(i, n) scanf("%d", &A[i]);
    int cnt = 0, rhs = inf;
    REP(i, n) if(A[i] <= rhs){ cnt++; rhs = A[i];}
    printf("%d\n", cnt);
    
    return 0;
}

Measured memory_bytes: 1024
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) (v).begin(), (v).end()




int main() {

	ll a, b;
	cin >> a >> b;
	a %= 500;
	cout << (a <= b ? "Yes" : "No") << endl;
	
}

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

using namespace std;
#define all(a)a.begin(),a.end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using V = vector<int>;
using P = pair<int,int>;
using G =vector<V>;

G g; V s;

void dfs(int v,int p=-1){
    for(int u:g[v]){
        if(u==p)continue;
        s[u]+=s[v];
        dfs(u,v);
    }
    return;
}

int main()
{
    int n,q;cin>>n>>q;
    g.assign(n,V());
    rep(i,n-1){
        int a,b;
        cin >>a>>b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    s.assign(n,0);
    rep(i,q){
        int p,x;
        cin >>p>>x;
        p--;
        s[p]+=x;
    }
    dfs(0);
    rep(i,n){
        cout << s[i]<< endl;
    }
    return 0;
}


Measured memory_bytes: 23424
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

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

int main() {
  string s;
  cin>>s;
  vector<vector<int>> dp((int)s.size()+2,vector<int>(2));

  dp[1][0]=1;
  dp[2][1]=1;
  for(int i=0;i<(int)s.size();i++){
    if(i>0 && s[i - 1]!=s[i])
      chmax(dp[i+1][0],dp[i][0]+1);
    if(i>1 && (s[i-2]!=s[i] || s[i-1] != s[i+1]))
      chmax(dp[i+2][1],dp[i][1]+1);
    chmax(dp[i+2][1],dp[i][0]+1);
    chmax(dp[i+1][0],dp[i][1]+1);
  }
  cout<<max(dp[s.size()][0],dp[s.size()][1])<<"\n";
  

  return 0;
}


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

typedef long long ll;

int main() {
    int N, ans = 0;
    cin >> N;
    vector<int> p(N);
    rep(i, N) cin >> p[i];
    rep(i, N - 1) {
        if (p[i] == i + 1) {
            swap(p[i], p[i + 1]);
            ans++;
        }
    }
    if (p[N - 1] == N) ans++;
    cout << ans << "\n";
}

Measured memory_bytes: 640
#include <iostream>
#include <stdlib.h>
using namespace std;

int find(long k,long* A,int n);

int main(void){
  int n;
  cin>>n;
  long A[n];
  for(long i=0;i<n;i++){
    cin>>A[i];
  }

  int q;
  cin>>q;
  long k;
  for(int i=0;i<q;i++){
    cin>>k;
    cout<<find(k,A,n)<<endl;
  }
}

int find(long k, long* A,int n){
  long low = 0;
  long high = n-1;
  long mid;
  while (high-low>10){
    mid = (high+low)/2;
    if(A[mid]>k){
      high=mid;
    }
    else{
      low=mid;
    }
  }

  for(long i=low;i<=high;i++){
    if(A[i]==k){
      return 1;
    }
  }
  return 0;
}



Measured memory_bytes: 3812
while True:
    d = input()
    if d == '0':
        break
    D = list(d)
    A_t = 0
    B_t = 0
    for i in range(1,len(D)):
        if D[i] == "A":
            A_t += 1
        elif D[i] == "B":
            B_t += 1
    if A_t > B_t:
        A_t += 1
    elif A_t < B_t:
        B_t += 1
    print(A_t, B_t)


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

class DisjointSet {
 private:
  class Node {
    friend DisjointSet;

    std::size_t parent;
    std::size_t size;

    Node(const std::size_t parent, const std::size_t size) : parent(parent), size(size) {}
  };

  std::vector<Node> nodes;

 public:
  DisjointSet(const std::size_t n) : nodes(n, Node(n, 1)) {}

  std::size_t size() { return nodes.size(); }

  std::size_t root(const std::size_t x) {
    if (nodes[x].parent == size()) return x;
    return nodes[x].parent = root(nodes[x].parent);
  }

  bool is_same(const std::size_t x, const std::size_t y) { return root(x) == root(y); }

  std::size_t size(const std::size_t x) { return nodes[root(x)].size; }

  bool unite(const std::size_t x, const std::size_t y) {
    std::size_t rx = root(x), ry = root(y);
    if (rx == ry) return false;
    if (nodes[rx].size < nodes[ry].size) std::swap(rx, ry);
    nodes[rx].size += nodes[ry].size;
    nodes[ry].parent = rx;
    return true;
  }
};

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int N, Q;
  std::cin >> N >> Q;
  DisjointSet ds(N);
  for (int i = 0; i < Q; i++) {
    int t, u, v;
    std::cin >> t >> u >> v;
    if (t == 0) {
      ds.unite(u, v);
    } else {
      if (ds.is_same(u, v)) {
        std::cout << 1 << '\n';
      } else {
        std::cout << 0 << '\n';
      }
    }
  }
  return 0;
}


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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

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

	
	string s ; cin>>s;
	
	
	if(s =="SUN"){
		writeln(7);
	}else if (s =="MON") {
		writeln(6);
	}else if (s =="TUE") {
		writeln(5);
	}else if (s =="WED") {
		writeln(4);
	}else if (s =="THU") {
		writeln(3);
	}else if (s =="FRI") {
		writeln(2);
	}else {
		writeln(1);
	}
}




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

int main () {
	int n;
	cin >> n;
	vector<int> cost;
	auto accum = 0;
	auto x = 0;
	for (auto i=0; i<n; ++i) {
		int y;
		cin >> y;
		cost.push_back(x - y);
		accum += abs(x - y);
		x = y;
	}
	cost.push_back(x - 0);
	accum += abs(x - 0);

	for (auto i=0; i<n; ++i) {
		cout << (accum - abs(cost[i]) - abs(cost[i + 1]) + abs(cost[i] + cost[i + 1])) << endl;
	}
	return 0;
}


Measured memory_bytes: 2416
N,A,B,K=map(int,input().split())
mod = 998244353
#x!のmodP逆元を求めるx^-1=x^(p-2)
table=[1]
a=1
for i in range(1,N+1):
    a=(a*pow(i,mod-2,mod))%mod
    table.append(a)

num=1
for i in range(1,N+1):
    num = (num*i) %mod


number =0
for i in range(N+1):
    if (K-A*i)%B==0 and K-A*i>=0:
        j=(K-A*i)//B
        if 0<=j<=N:
            t = (num*num)%mod
            t = (t*table[i])%mod
            t = (t*table[j])%mod
            t = (t*table[N-i])%mod
            t = (t*table[N-j])%mod
            number = (number+t)%mod
print(number)

Measured memory_bytes: 59236
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int h, w, m;
    cin >> h >> w >> m;

    map<ll, ll> r, c;
    ll r_max = 0, c_max = 0;
    vector<int> a(m), b(m);

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

        r[a[i]]++;
        r_max = max(r_max, r[a[i]]);

        c[b[i]]++;
        c_max = max(c_max, c[b[i]]);
    }

    ll x = 0, y = 0;

    for (int i = 1; i <= h; i++)
    {
        if (r[i] == r_max)
        {
            x++;
        }
    }

    for (int i = 1; i <= w; i++)
    {
        if (c[i] == c_max)
        {
            y++;
        }
    }

    ll cnt = 0;

    bool flag = false;

    for (int i = 0; i < m; i++)
    {
        if (r[a[i]] == r_max && c[b[i]] == c_max)
        {
            cnt++;
        }
    }

    if (cnt == x * y)
    {
        cout << r_max + c_max - 1 << endl;
    }
    else
    {
        cout << r_max + c_max << endl;
    }
}


Measured memory_bytes: 43132
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
using namespace std;
signed main()
{
	ios::sync_with_stdio(false);
	int x, y;
	cin >> x >> y;
	if (x%y == 0)cout << -1;
	else cout << x;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
const long long mod=998244353;

int main(){
  int N,T;
  cin>>N>>T;
  vector<int>t(N);
  for(int i=0;i<N;i++){
    cin>>t[i];
  }
  int64_t ans=0;
  for(int i=0;i<N-1;i++){
    ans+=min(T,t[i+1]-t[i]);
  }
  ans+=T;
  cout<<ans<<endl;
  return 0;                       
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll N;
    string S;
    cin >> S;

    ll flag = 0;

    sort(S.begin(), S.end());
    
        for (char i = 'a'; i <= 'z'; i++)
        {
            REP(j, S.size())
            {
                if (S.at(j) == i)
                {
                    flag = 1;
                }
            }
            if(flag==0){
                cout << i << endl;
                break;
            }
            else{
                flag = 0;
            }
            if(i=='z'){
                flag = 1;
            }
        }
        if(flag==1){
            cout << "None" << endl;
        }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main ()
{
	int a,b,t,tot=0,ans=0;
	cin>>a>>b>>t;
	if (a>t)
	{
		cout<<0;
		return 0;
	}
	else
	{
		do
		{
			tot+=a;
			ans+=b;
		}
		while(tot<=t);
	}
	cout<<ans-b;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
map<int,int> mp;
bool isp(int x)
{
	if(x<2) return 0;
	for(int i=2;i*i<=x;i++)
		if(x%i==0)
			return 0;
	return 1;
}
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int t=i;
		for(int j=2;j<=t;j++)
		{
			if(isp(j))
			{
				int a=0;
				while(t%j==0)
				{
					t/=j;
					a++;
				}
				if(mp.find(j)!=mp.end())
				{
					mp[j]+=a;
				}
				else
				{
					mp[j]=a;
				}
			}
		}
	}
	long long ans=1;
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
	{
		ans*=(it->second+1);
		ans%=1000000007;
	}
	cout<<ans<<endl;
	return 0;
}

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

#define ll long long

#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define output_s(a) printf("%s\n",(a).c_str())

//library----------------------------------------------


int main(){
    int a,b,c; cin>>a>>b>>c;
    if(a>b) c=c-(a-b);
  	if(c<0) c=0;
    printf("%d\n",c);
    return 0;  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int result = 1;
			while ((result << 1) <= n) {
				result <<= 1;
			}
			System.out.println(result);
		}
	}
}


Measured memory_bytes: 23380
// ABC109_A
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値

int main() {
    // input
    ll N, M, L;
    cin >> N >> M >> L;
    // vector<ll> vec(N);
    // REP(i, N) cin >> vec[i];
    
    // calculation
    if ((N*M)%2 == 0) {
        cout << "No" << "\n";
    } else {
        cout << "Yes" << "\n";
    }
    
    return 0;
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n;cin>>n;
    string s;cin>>s;

    vector<vector<bool>> f(n);
    vector<vector<bool>> b(n); 

    REP(i,n){
        s[i] -= '0';
        f[i].resize(10,false);
        b[i].resize(10,false);
    }

    f[0][s[0]] = true;
    FOR(i,1,n){
        REP(j,10){
            f[i][j] = f[i-1][j];
        }
        f[i][s[i]] = true;
    }

    b[n-1][s[n-1]] = true;
    ROF(i,0,n-1){
        REP(j,10){
            b[i][j] = b[i+1][j];
        }
        b[i][s[i]] = true;
    }

    set<int> result;
    FOR(i,1,n-1){
        REP(j,10){
            if(!f[i-1][j]){
                continue;
            }
            REP(k,10){
                if(!b[i+1][k]){
                    continue;
                }
                int key = 100*j + 10*s[i] + k;
                result.insert(key);
            }
        }
    }


    cout<<SIZE(result)<<endl;

	return;
}

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

Measured memory_bytes: 4608
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
#define N 100010 
int n,s,x[N]; ll p[N];
int main()
{
	n=read(),s=read();
	for(int i=1;i<=n;i++)	x[i]=read(),p[i]=read();
	int l=1,r=n; ll ans=0; int fl=2;
	while(l<r&&x[l]<s&&x[r]>s)
	{
		if(p[l]<p[r])
		{
			p[r]+=p[l]; if(fl!=0) ans+=x[r]-x[l],fl=0;  l++;
		}
		else
		{
			p[l]+=p[r]; if(fl!=1)	ans+=x[r]-x[l],fl=1; r--;
		}
	}
	if(x[l]>s)	ans+=x[r]-s;	else	ans+=s-x[l];
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   // your code goes here

    int n,c=0;
    int a[105];
    cin>>n;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
        if (i%2!=0)
        {
            if (a[i]%2!=0)c++;
        }
    }

  cout<<c;


}


Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scan.nextInt();
        }
        long answer = 0;
        long current = 0;
        int j = 0;
        for (int i = 0; i < N; i++) {
            while (j < N && (current & a[j]) == 0) {
                current += a[j];
                j += 1;
            }
            answer += (j - i);
            current ^= a[i];
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 85844
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int a[50]={0};
int b[50]={0};
int solve()
{
	int n;
	cin>>n;
	a[0]=1;
	b[0]=1;
	int temp=1;
	for(int i=1;i<=40;i++)
	{
		a[i]=temp*2;
		temp*=2;
		b[i]=(a[i]-1)*2+1;
	}
	int x=upper_bound(a,a+40,n)-a;
	cout<<b[x-1]<<endl;

}
signed main()
{
	fastio;
	clock_t start, end;
//	test
	{
		start=clock();
		solve();
		end=clock();
		double time_taken=double(end-start)/double(CLOCKS_PER_SEC);
//		cout<<time_taken<<endl;
	}
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define PB push_back
#define SP << " " <<

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VLL;

__attribute__((constructor))
void initial(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed <<setprecision(15);
}


int main(void){
    char a;
    cin >> a;
    a = a+1;
    cout << a << endl;

    return 0;
}


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

bool is_kaibun(string s, int t, int b)
{
    int count = 0;
    if ((b - t + 1) % 2 == 0)
    {
        count = (b - t + 1) / 2;
    }
    else
    {
        count = (b - t + 2) / 2;
    }
    for (int i = 0; i < count; i++)
    {
        if (s.at(t + i) != s.at(b - i))
        {
            return false;
        }
    }
    return true;
}

int main()
{
    string s, ans;
    cin >> s;
    int num = s.size();
    int half = (num + 1) / 2;
    bool a, b;
    a = is_kaibun(s, 0, half - 2);
    b = is_kaibun(s, half, num - 1);
    if (a && b)
    {
        int count;
        if ((half - 1) % 2 == 0)
        {
            count = (half - 1) / 2;
        }
        else
        {
            count = half / 2;
        }

        for (int i = 0; i < count; i++)
        {
            if (s.at(i) != s.at(num - 1 - i))
            {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
    else
    {
        cout << "No" << endl;
        return 0;
    }
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
  public static void main (String[] arg) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int D = scan.nextInt();
    
    if(N%(2*D+1) == 0){
      System.out.println(N/(2*D+1));
    } else {
      System.out.println(N/(2*D+1)+1);
    }
  }
}

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

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

  vector<ll> child_sum(N);

  for(ll i=0; i<N; i++){
    if(i == 0) continue;
    ll inp;
    cin >> inp;
    child_sum[inp-1] += 1;
  }
  for(ll i=0; i<N; i++){
    cout << child_sum[i] << endl;
  }
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int H1, H2, M1, M2;
  cin >> H1 >> M1 >> H2 >> M2;
  int t;
  cin >> t;

  int ans = {H2*60+M2-H1*60-M1};
  cout << ((ans<t)?0:ans-t) << '\n';
}


Measured memory_bytes: 3612
require 'pp'

n = gets.chomp!.to_i
a_n = gets.chomp!.split(" ").map(&:to_i).sort!

counter = Hash.new {|h, k| h[k] = 0 }
a_n.each do |a|
    counter[a] += 1
end

odd = 0
even = 0
counter.each do |v, n|
    if n % 2 == 0
        even += 1
    else
        odd += 1
    end
end 

puts odd + (even % 2 == 0 ? even : even - 1)


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

int main() {
  const double pi = acos(-1);
  double a,b,x;
  cin >> a >> b >> x;
  if (2*x <= a*a*b) {
    const double l = 2*x/(a*b);
    const double c = l / sqrt(b*b+l*l);
    const double ans = acos(c)*180/pi;
    printf("%2.15f",ans);
  }
  else {
    const double l = 2*b - 2*x/(a*a);
    const double s = l / sqrt(a*a+l*l);
    const double ans = asin(s)*180/pi;
    printf("%2.15f",ans);
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX=1000000001;

int merge_sort(int A[],int left,int right){
    if(left+1==right)return 0;
    int midth=(left+right)/2;
    int ss=merge_sort(A,left,midth)+merge_sort(A,midth,right);
    int B[midth-left+1],C[right-midth+1];
    B[midth-left]=MAX;
    C[right-midth]=MAX;
    for(int i=0;i<midth-left;i++){
        B[i]=A[left+i];
    }
    for(int i=0;i<right-midth;i++){
        C[i]=A[midth+i];
    }
    int dd=0,ff=0,i=left;
    while(dd!=midth-left||ff!=right-midth){
        if(B[dd]>C[ff]){
            A[i]=C[ff];
            ff++;
        }
        else{A[i]=B[dd];dd++;}
        i++;
        ss++;
    }
    return ss;
}

int main(){
    int n;
    scanf("%d",&n);
    int A[n+1];
    for(int i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    int k=merge_sort(A,0,n);
    for(int i=0;i<n-1;i++){
        printf("%d ",A[i]);
    }
    printf("%d\n",A[n-1]);
    printf("%d\n",k);
}



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

#define int long long

string s;

int32_t main()
{	
	cin >> s;
	int n = s.size();
	bool r = true;
	
	for(int i=0; i<n/2; i++)
		if(s[i] != s[n-1-i])
			r = false;
	
	int m = (n-1)/2;
	for(int i=0; i<m/2; i++)
		if(s[i] != s[m-1-i])
			r = false;
	
	int k = (n+3)/2;
	for(int i=k; i<n/2; i++)
		if(s[i] != s[n-1-i])
			r = false;
			
	puts(r ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    list<int> prime;
    prime.push_back(2);
    for(int i = 3; i < 100000; i += 2){
        bool is_prime = true;
        repi(j, prime){
            if(i % *j == 0){
                is_prime = false;
                break;
            }
        }
        if(is_prime){
            prime.push_back(i);
        }
    }
    repi(i, prime){
    }
    vector<int> sum(100000 + 1);
    sum[0] = 0;
    list<int>::iterator p = prime.begin();
    p++;
    for(int i = 1; i <= 100000; i++){
        if(*p != i){
            sum[i] = sum[i - 1];
            continue;
        }
        ++p;
        if(any_of(prime.begin(), prime.end(), [i](int q){ return (i + 1) / 2 == q; })){
            sum[i] = sum[i - 1] + 1;
        }else{
            //cout << i << " " << (i + 1) / 2 << endl;
            sum[i] = sum[i - 1];
        }
    }
    
    int q;
    cin >> q;
    rep(i, q){
        int l, r;
        cin >> l >> r;
        cout << sum[r] - sum[l - 1] << endl;
    }
    rep(i, 11){
        //cout << sum[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}





int main(){
  vector<bool> pos(1000,true);
  int X,N;
  cin >> X >> N;
  if(N==0) {
    cout << X << endl;
    return 0;
  }
    
  rep(i,N){
    int num; 
    cin >> num;
    pos[num] = false;
  }
  for(int i = 0; ;i++) {
    if(pos[X-i]){
      cout << X-i << endl;
      return 0;
    }
    if(pos[X+i]) {
      cout << X+i << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
#define mod 1000000007
#define abdo(); std::ios_base::sync_with_stdio(0);cin.tie(NULL);
#define lowcase(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define uppcase(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define M 80
#define LENGTH 12
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
typedef vector<int> vi;
const double PI = acos(-1.0);
int dir_r[] = {1       , 0    , -1, 0   , -1     , 1         , -1      , 1        };
int dir_c[] = {0       , 1    , 0 , -1  , -1     , 1         , 1       , -1       };



int main(void)
{
    //freopen("colors.in", "r", stdin) ;
    //freopen("auxiliary.out", "w", stdout);
    int n;cin >> n;
    if(n == 25)
    	cout << "Christmas";
    else if(n == 24)
    	cout << "Christmas Eve";
    else if(n == 23)
    	cout << "Christmas Eve Eve";
    else
    	cout << "Christmas Eve Eve Eve";

}



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

//define
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long

//constant
const int MOD = 1000000007;

//typedef
typedef vector<int> vi;
typedef vector<vector<int>> vvi;


int main(){
	int n;
	cin >> n;
	vi t(n);
	vi a(n);
	REP(i, n)
		cin >> t[i];
	REP(i, n)
		cin >> a[i];
	vector<long long int> u(n, 1e10);
	vi kaku(n, 0);
	if(n==1){
		if (t[0] == a[0]) {
			cout << 1 << endl;
			return 0;
		}
		else {
			cout << 0 << endl;
			return 0;
		}
	}
	kaku[0] = t[0];
	kaku[n - 1] = a[n-1];
	long long int res = 0;
	bool isok = true;
	for (int i = 0; i < n-1; i++) {
		if (t[i] > t[i + 1])
			isok = false;
		if (a[i] < a[i + 1])
		isok = false;
	}
	if (!isok) {
		cout << 0 << endl;
		return 0;
	}
	for(int i=1;i<n;i++){
		if (t[i] != t[i - 1]) {
			if (kaku[i] != 0 && kaku[i] != t[i]) {
				isok = false;
			}
			kaku[i] = t[i];
		}
		else {
			u[i] = t[i];
		}

	}
	for (int i = n-2; i >= 0; i--) {
		if (a[i] != a[i+1])
			if (kaku[i] != 0 && kaku[i] != a[i])
				isok = false;
			else
				kaku[i] = a[i];
		else {
			if (u[i] > a[i])
				u[i] = a[i];
		}
	}
	if (!isok) {
		cout << 0 << endl;
		return 0;
	}
	res = 1;
	for (int i = 0; i < n; i++) {
		if (kaku[i] == 0) {
			res = res*u[i];
			res = res%MOD;

		}
		if (u[i] < kaku[i])
			isok = false;
	}
	if (!isok)
		cout << 0 << endl;
	else
	cout << res << endl;
}

Measured memory_bytes: 2176
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())


void solve() {
  LL r, d, x;
  cin >> r >> d >> x;
  REP(_, 10) {
    x = r*x-d;
    cout << x << endl;
  }
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    string S;
    cin >> S;
    if(S[0] != S[1] && S[0] != S[2] && S[1] != S[2])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef unsigned long long ull;

ull gcd(ull a, ull b)
{
	if (b == 0)
		return a;
	else
	{
		if (a < b)
			return gcd(a, b % a);
		else
			return gcd(b, a % b);
	}
}

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

int main()
{
	int N;
	ull T, ans = 1;
	
	cin >> N;

	for (int i = 0; i < N; i++)
	{
		cin >> T;

		ans = lcm(ans, T);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;




int main() {
    int s,w;
    cin>>s>>w;
    if(w>=s){
        cout<<"unsafe"<<endl;
    }
    else{
        cout<<"safe"<<endl;
    }


    return 0;
}


Measured memory_bytes: 3636
n = int(input())

red = []
blue = []
for i in range(n):
    a,b = map(int,input().split())
    red.append((a,b))
for i in range(n):
    c,d = map(int,input().split())
    blue.append((c,d))
    
red_sorted = sorted(red,reverse=True)
blue_sorted = sorted(blue,key=lambda x: x[1])

count = 0
check = []
for i in red_sorted:
    for j,k in enumerate(blue_sorted):
        if (i[0] < k[0]) and (i[1] < k[1]):
            blue_sorted.pop(j)
            count += 1
            break
print(count)

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

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;

const ll MOD = 1000000007;
const ll INF = 1e17+1;
const double eps = 1e-7;
const double PI = acos(-1.0);

#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x )     cerr << #x << " = "<< x << endl;
#define endl    "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC

inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void print_case(int tn) {cout<<"Case #"<<tn<<": ";}

template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using maxpq = priority_queue<T>;
/*----------------------------------------------------------------------*/

const int N = 301;
ll d[N][N];
ll l,n,m,u,v,c;

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t clk = clock();

    cin>>n>>m>>l;
    FOR(i, 0, n) {
        FOR(j, 0, n) {
            if(i == j) d[i][j] = 0;
            else d[i][j] = INF;
        }
    }

    FOR(i, 0, m) {
        cin>>u>>v>>c;
        if(c > l) c = INF;
        u--; v--; d[u][v] = c; d[v][u] = c;
    }

    for(int k = 0; k < n; k++)
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++) {
                if(d[i][j] > d[i][k] + d[k][j]) {
                    d[i][j] = d[i][k] + d[k][j];
                }
            }

    FOR(i, 0, n) {
        FOR(j, 0, n) {
            if(d[i][j] <= l) d[i][j] = 1;
            else d[i][j] = INF;
        }
    }

    for(int k = 0; k < n; k++)
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++) {
                if(d[i][j] > d[i][k] + d[k][j]) {
                    d[i][j] = d[i][k] + d[k][j];
                }
            }

    int q; cin>>q;
    while(q--) {
        cin>>u>>v; u--; v--;
        if(d[u][v] >= INF) cout<<-1<<endl;
        else cout<<d[u][v] - 1<<endl;
    }

    cerr << endl << "Time (in ms): " << double(clock() - clk) * 1000.0 / cps << endl;
    return 0;
}

Measured memory_bytes: 1280
x,y=map(int,input().split())
if (x+y)%3:
  print(0)
  exit()

n=(x+y)//3

if x<n or 2*n<x:
  print(0)
  exit()

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

ans = cmb(n, x-n)%((10**9)+7)

print(ans)

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

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

#define REPISE (s,e) for(int i=s,i<e;i++)
#define REPJSE (s,e) for(int j=s,j<e;j++)

typedef long long ll;

using namespace std;

int main ()
{
  string S,Srep;
  ll acnt,res = 0;

  cin >> S;

  REPI(S.size()-1)
  {
    if (S[i] == 'A')
      Srep += 'A';
    else if (S[i] == 'B' && S[i+1] == 'C')
    {
      Srep += 'D';
      i++;
    }else{
      Srep += S[i];
    }
  }

  acnt = 0;
  REPI(Srep.size ())
  {
    if (Srep[i] == 'A')
      acnt++;
    else if (Srep[i] == 'D')
      res += acnt;
    else
      acnt = 0;
  }

  cout << res << endl;
  
  return 0;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b){
  if( b == 0){ return a;}
  else{ return gcd( b, a% b);}}

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



int main(){
ll N; cin >> N;
  ll res = 1;
  for(ll i = 0; i  <N; i++){
    ll t; cin >> t;
    res = lcm( res, t);}
  
  cout << res << endl; return 0;}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
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(int argc, char const *argv[]) {
  string s, t;
  cin >> s >> t;
  cout << t << s << endl;
  return 0;
}

Measured memory_bytes: 3596