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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(auto i=(a); i<(b); ++i)
#define REP(i,n) rep(i,0,n)
#define all(v) (v).begin(), (v).end()
#define rs resize
#define DBG(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl

const ld PI = acos(-1.0);
template<class T> using min_queue =
priority_queue<T, vector<T>, greater<T>>;
template<class T> int sz(const T &x) {
    return (int) x.size(); // copy the ampersand(&)!
}

template<class T> ostream& operator<<(ostream &os, vector<T> &v) {
    os << "\n[";
    for(T &x : v) os << x << ',';
    return os << "]\n";
}

struct pairhash {
    public:
    template<typename T1, typename T2>
    size_t operator()(const pair<T1, T2> &p) const {
        size_t lhs = hash<T1>()(p.x);
        size_t rhs = hash<T2>()(p.y);
        return lhs ^ (rhs+0x9e3779b9+(lhs<<6)+(lhs>>2));
    }
};

const ll MOD = 998244353;
const ll BASE = 1000000000000000000%MOD;

//vector<vvi> adj;
vvi nim;

void run() {
	ll N;
	cin >> N;

	ll maxNim = 0;
	for (ll i = 0; i < 3; i++) {
		vvi adj(N);
		nim.pb(vi(N, 0));
		ll M;
		cin >> M;
		for (ll j = 0; j < M; j++) {
			ll a, b;
			cin >> a >> b;
			a--; b--;
			if (a > b) swap(a, b);
			adj[a].pb(b);
		}

		for (ll j = N-1; j >= 0; j--) {
			vector<bool> U(adj[j].size()+2, false);
			for (ll k : adj[j]) {
				if (nim[i][k] < U.size()) U[nim[i][k]] = true;
			}
			for (ll k = 0; k < U.size(); k++) {
				if (!U[k]) {
					//cout << j << ": " << k << endl;
					nim[i][j] = k;
					break;
				}
			}
			maxNim = max(maxNim, nim[i][j]+1);
		}
	}

	vvi nimScore(3, vi(maxNim, 0));
	for (ll i = 0; i < 3; i++) {
		ll p = 1;
		for (ll j = 0; j < N; j++) {
			p *= BASE;
			p %= MOD;
			nimScore[i][nim[i][j]] += p;
			nimScore[i][nim[i][j]] %= MOD;
		}
	}
	
	ll res = 0;
	for (ll i1 = 0; i1 < maxNim; i1++) {
		for (ll i2 = 0; i2 < maxNim; i2++) {
			if ((i1^i2) < maxNim && (i1^i2) >= 0) {
				res += (nimScore[0][i1]*nimScore[1][i2])%MOD*nimScore[2][i1^i2];
				res %= MOD;
			}
		}
	}
	//cout << maxNim << endl;
	cout << res << endl;
	//cout << nimScore[0][0] << ", " << nimScore[1][0] << ", " << nimScore[2][0] << endl;
}

signed main() {
    // DON'T MIX "scanf" and "cin"!
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(20);
    run();
    return 0;
}


Measured memory_bytes: 7000
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int L, R, d, cnt;
    L = sc.nextInt();
    R = sc.nextInt();
    d = sc.nextInt();
    cnt = 0;

    for (int i = L; i <= R; i++) {
      if (i % d == 0)
        cnt++;
    }
    System.out.println(cnt);
  }
}

Measured memory_bytes: 35604
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;

signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(ALL(a));
    if(n%3!=0){
        rep(i,n){
            if(a[i]!=0){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
    
    ll x=a[0],y=a[n/3],z=a[2*n/3];
    rep(i,n){
        if(i<n/3&&a[i]!=x){
            cout << "No" << endl;
            return 0;
        }
        if(n/3<=i&&i<2*n/3&&a[i]!=y){
            cout << "No" << endl;
            return 0;
        }
        if(2*n/3<=i&&a[i]!=z){
            cout << "No" << endl;
            return 0;
        }
    }
    if((x^y^z)==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 3996
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
 
#define PI 3.14159265
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
const ll limit = 2e9;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};
 
//const int mod = 998244353;
 
struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);	
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};

int w[107];
vector<pair<int,int> > g[107];
void add(int u, int v, int w){
    g[u].push_back(make_pair(v,w));
    g[v].push_back(make_pair(u,w));
}
int findTheCity(int n, vector<vector<int>>& edges, int dt) {
    for(int i = 0; i < (int)edges.size();i++){
        int u = edges[i][0];
        int v = edges[i][1];
        int w = edges[i][2];
        add(u,v,w);
    }
    
	
	int ans = inf;
	for(int i = 0; i < n; i++){
		clr(w,inf);
		w[i] = 0;
		for(int k = 1; k <= n-1; k++){
			for(int j = 0; j < n; j++){
				for(int l = 0; l < (int)g[j].size(); l++){
					int u = j;
					int v = g[j][l].first;
					int weigth = g[j][l].second;
					if(w[u] + weigth < w[v]){
						w[v] = w[u] + weigth;
					}
				}
			}
		}
		int cont = 0;
		cout<<i<<":\n";
        for(int k = 0; k < n; k++){
            if(k != i && w[k] <= dt){
				cout<< k<<"-"<<w[k];
                cont++;
            }
            cout<<endl;
        }
        
		ans = min(cont, ans);
	}
	
	return ans;
}

map<int,int> tab;
int a[1007], b[1007];
int h, n;
int solve(int m){
	if(tab[m] != 0)
		return tab[m];
	if(m <= 0)
		return 0;
	int mini = inf;
	for(int k = 1; k <= n; k++){
		mini = min(solve(m - a[k]) + b[k] , mini);
	}
	tab[m] = mini;
	return tab[m];
}
int main(){
	cin>> h >> n;
	for(int i = 1; i <= n; i++){
		cin>> a[i] >> b[i];
	}
	cout<<solve(h);
	return 0;
}












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

void solve(int64_t A, string B)
{
    int64_t b = 0;
    b += (B.at(0) - '0') * 100;
    b += (B.at(2) - '0') * 10;
    b += B.at(3) - '0';
    int64_t res = A * b;
    res /= 100;
    cout << res << endl;
}

int main()
{
    int64_t A;
    cin >> A;
    string B;
    cin >> B;
    solve(A, B);
    return 0;
}


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

int main() {
	int H, W;
	int cnt = 0;
	cin >> H >> W;
	for(int i = 0; i < H; i++) {
		string s;
		cin >> s;
		for(int j = 0; j < s.size(); j++) cnt += s[j] == '#';
	}
	if(cnt == H+W-1)
		cout << "Possible" << endl;
	else
		cout << "Impossible" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N;
	while(cin>>N)
	{
		vector<int> v(N),ans(N+1);
		for(int i=1;i<N;i++)
		{
			cin>>v[i];
		}
		for(int i=1;i<=N;i++)
		{
			ans[i]=0;
		}
		ans[1]=v[1];
		ans[2]=v[1];
		for(int i=2;i<N;i++)
		{
			ans[i]=min(ans[i],v[i]);
			ans[i+1]=v[i];
		}
		int sum=0;
		for(int i=1;i<=N;i++)
		{
			sum+=ans[i];
		}
		cout<<sum<<'\n';
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];

		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
		}

		String anser = "APPROVED";

		for (int i : A) {
			if (i % 2 == 0) {
				if (i % 3 != 0 && i % 5 != 0)
					anser = "DENIED";
			}
		}

		System.out.println(anser);
	}

}


Measured memory_bytes: 22868
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
using namespace std;
char a[200005];
int dp[3000];
int mod=2019;
ll sum;
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
namespace imzzy{
	#define endl '\n'
	#define ccf std::cout<<"phi**k"<<endl
	#define rgi register int
	#define ll long long
	class fastin{private:int _ch,_f;
	public:inline fastin&operator>>(char&c){c=getchar();return*this;}
	template<typename _Tp>inline fastin&operator>>(_Tp&_x){
	_x=0;while(!isdigit(_ch))_f|=(_ch==45),_ch=getchar();
	while(isdigit(_ch))_x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
	_f&&(_x=-_x,_f=0);return*this;}fastin(){_ch=_f=0;}
	}fin;class fastout{private:int _num[32],_head;
	public:inline fastout&operator<<(char c){putchar(c);return*this;}
	template<typename _Tp> inline fastout&operator<<(_Tp _x){
	_Tp _k;if(_x==0){putchar('0');return *this;}if(_x<0)putchar('-'),_x=-_x;
	while(_x>0)_k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
	while(_head>0)putchar(_num[_head]),--_head;return*this;}fastout(){_head=0;}
	}fout;inline void P_INIT(){
	#ifdef D_STDOUT_UNBUFFERED
	setbuf(stdout,NULL);
	#endif
}}using namespace imzzy;
// ----------------------------
// #define int ll
// using namespace std;
const int maxn=100004;
const int mod=1000000007,inf=1201201201;

int a[maxn];
signed main()
{P_INIT();
	// freopen("yy.in","r",stdin);
	// freopen("yy.out","w",stdout);
	int n,l,p=0; fin>>n>>l;
	for(rgi i=1;i<=n;++i) fin>>a[i];
	for(rgi i=1;i<n&&!p;++i) if(a[i]+a[i+1]>=l) p=i;
	if(!p) return puts("Impossible"),0;
	puts("Possible");
	for(rgi i=1;i<p;++i) fout<<i<<endl;
	for(rgi i=n-1;i>p;--i) fout<<i<<endl;
	fout<<p;
	return 0;
}
// ----------------------------
// by imzzy


Measured memory_bytes: 3996
#include<memory>
template<typename T> class SegmentTree {
 public:
  SegmentTree(int size) : SIZE(size), ROOT(std::make_unique<Node>()) {}
  void update(int left, int right, T value) {update(left, right + 1, value, ROOT, 0, SIZE);}
  T find(int left, int right) {return find(left, right + 1, ROOT, 0, SIZE);}
 private:
  struct Node {
    T value, lazy;
    std::unique_ptr<Node> lchild, rchild;
    Node(T value = 0, T lazy = 0) : value(value), lazy(lazy), lchild(nullptr), rchild(nullptr) {}
  };
  inline void push(const std::unique_ptr<Node>& n, int l, int r) {
    if(not n->lchild) n->lchild = std::make_unique<Node>();
    if(not n->rchild) n->rchild = std::make_unique<Node>();
    n->value += n->lazy * (r - l);
    n->lchild->lazy += n->lazy;
    n->rchild->lazy += n->lazy;
    n->lazy = 0;
  }
  T update(int a, int b, T v, const std::unique_ptr<Node>& n, int l, int r) {
    push(n, l, r);
    if(a <= l && r <= b) {n->lazy = v; push(n, l, r); return n->value;}
    if(b <= l || r <= a) return n->value;
    return n->value = update(a, b, v, n->lchild, l, (l+r)/2) + update(a, b, v, n->rchild, (l+r)/2, r);
  }
  T find(int a, int b, const std::unique_ptr<Node>& n, int l, int r) {
    push(n, l, r);
    if(a <= l && r <= b) return n->value;
    if(b <= l || r <= a) return 0;
    return find(a, b, n->lchild, l, (l+r)/2) + find(a, b, n->rchild, (l+r)/2, r);
  }
  const int SIZE;
  std::unique_ptr<Node> ROOT;
};

#include<bits/stdc++.h>
using namespace std;

using LL = long long;

int main() {
  LL N, Q, S, T;
  cin >> N >> Q >> S >> T;

  LL ans = 0;
  vector<LL> A(N + 1);
  SegmentTree<LL> segtree(N + 1);
  for(auto i = 0; i <= N; ++i) {
    cin >> A[i];
    segtree.update(i, i, A[i]);
    if(!i) continue;
    if(A[i-1] < A[i]) ans -= (A[i] - A[i-1]) * S;
    else              ans += (A[i-1] - A[i]) * T;
  }

  for(auto i = 0; i < Q; ++i) {
    LL L, R, X;
    cin >> L >> R >> X;

    if(0 < X) {
      auto l = segtree.find(L-1, L-1);
      auto r = segtree.find(L, L);
      if(l > r && l < r + X) ans += (r - l) * T - (r + X - l) * S;
      else if(l > r)         ans -= X * T;
      else                   ans -= X * S;
      if(R < N) {
        l = segtree.find(R, R);
        r = segtree.find(R+1, R+1);
        if(l < r && l + X > r) ans += (r - l) * S + (l + X - r) * T;
        else if(l < r)         ans += X * S;
        else                   ans += X * T;
      }
    }

    if(0 > X) {
      auto l = segtree.find(L-1, L-1);
      auto r = segtree.find(L, L);
      if(l < r && l > r + X) ans += (r - l) * S + (l - r - X) * T;
      else if(l < r)         ans -= X * S;
      else                   ans -= X * T;
      if(R < N) {
        l = segtree.find(R, R);
        r = segtree.find(R+1, R+1);
        if(l > r && l + X < r) ans += (r - l) * T - (r - l - X) * S;
        else if(l > r)         ans += X * T;
        else                   ans += X * S;
      }
    }

    segtree.update(L, R, X);
    cout << ans << endl;
  }
}

Measured memory_bytes: 41932
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main()
{
	int A, B, C, X, way = 0;
	cin >> A >> B >> C >> X;

	for (int i = 0; i <= A; i++) {
		for (int j = 0; j <= B; j++) {
			for (int k = 0; k <= C; k++) {
				if (500 * i + 100 * j + 50 * k == X)
					way++;
			}
		}
	}

	cout << way << endl;
}

Measured memory_bytes: 256
/*input
2
1 2
3
1 100
2 100
100 1000

*/

#include <bits/stdc++.h>

using namespace std;

map<int, int> cnt;

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int n, q; int64_t sum = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x; cin >> x;
    cnt[x]++;
    sum += x;
  }

  cin >> q;
  while (q--) {
    int b, c; cin >> b >> c;
    int m = cnt[b], d = c - b;
    sum += (int64_t)m * d;
    cout << sum << '\n';
    cnt[c] += m;
    cnt[b] = 0;
  }

  return 0;
}

Measured memory_bytes: 7932
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

int main ()
{
    string s;
    cin >> s;

    int diff = 753;
    for (int i = 0; i <= s.size() - 3; i++) {
    	int t = stoi(s.substr(i, 3));
    	diff = min(diff, abs(753 - t));
    }

    cout << diff << endl;

    return 0;
}


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

int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int n_a = min(a, k);
    k -= n_a;
    int n_b = min(b, k);
    k -= n_b;
    int n_c = k;
    cout << n_a - n_c << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n,chara[26],i;
	double r=1;
	string s;
	cin>>n;
	cin>>s;
	for(i=0;i<26;i++) chara[i]=0;
	for(i=0;i<n;i++){
		chara[s[i]-'a']++;
	}
	for(i=0;i<26;i++){
		r=r*(chara[i]+1);
		r=fmod(r,pow(10,9)+7);
	}
	r--;
	cout<<(int)r<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,i,a;
	set <int> s;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(s.find(a)==s.end())
		s.insert(a);
		else{
			s.erase(a);
		}
	}
	printf("%d",s.size());
}

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

using namespace std;
int main(){
  string s;
  cin >>s;
  long k;
  cin >> k;
  
  int res=1;
  long ptr=0;
  while(ptr<s.length()&&ptr<k){
    if(s[ptr]!='1') {res=s[ptr]-'0';
                     break;}
    ptr++;
  }
  
 cout << res << endl;
  
  
}

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

int main() { 
    ll n;
    std::cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    vector<vector<ll>> edges(n);
    for (int i = 0; i < n-1; i++) {
        ll p,q;
        std::cin >> p>>q;
        p--;q--;
        
        edges[p].push_back(q);
        edges[q].push_back(p);
    }
    vector<ll> d(n+10,1e15);
    d[0] = 0;
    vector<ll> ans(n);
    function<void(int, int)> rec = [&] (int now, int par) {
        ll index = distance(d.begin(),lower_bound(d.begin(),d.end(),a[now]));
        ll moto = d[index];
        d[index] = a[now];
        ans[now] = distance(d.begin(),upper_bound(d.begin(),d.end(),1e10));
        for (auto e : edges[now]) {
            if(e==par)continue;
            rec(e, now);
        }
        d[index] = moto;
    };
    rec(0,-1);
    for (int i = 0; i < n; i++) {
        std::cout << ans[i]-1 << std::endl;
    }
}

Measured memory_bytes: 35848
import java.util.*

fun main(args:Array<String>):Unit {
    val prime = primes(35000)
    while(true){
        val n = readLine()!!.trim().toInt()
        if (n == 0) return
        println(
                prime.takeWhile{it * 2 <= n}.count{
                    prime.binarySearch(n - it) >= 0
                }
        )
    }
}
fun primes(upper:Int):Array<Int> {
    val stack = Stack<Int>()
    val isPrime = Array(upper + 1){it % 2 == 1}
    stack.push(2)
    for (i in 3 .. upper step 2){
        if (isPrime[i]){
            stack.push(i)
            if (i * i <= upper) for (j in i .. upper step i){
                isPrime[j] = false
            }
        }
    }
    return stack.toTypedArray()
}


Measured memory_bytes: 31552
/*

    author : s@if

*/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define 		NIL 			-1
#define		 	fi	 		    first
#define 		sec 			second
#define 		MAX 			INT_MAX
#define			INF 			1e9
#define 		ll 			    long long
#define 		PI 			    acos(-1.0)
#define			MOD 			1000000007
#define 		PLL 			pair<ll,ll>
#define 		PII			    pair<int,int>
#define 		ull 			unsigned long long
#define 		For(i,a,b) 		for(int i=a;i<=(int)b;i++)
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> new_data_set;

//*find_by_order(k)  gives the kth element;
//order_of_key(item)   gives the index(number of element strictly less than item) of item;


inline int in() {int x; scanf("%d", &x); return x; }
bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};    // King's move
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hx[]={-2,-2,-1,+1,+2,+2,-1,+1};    // Knight's move
int hy[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)2e5+9;


int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    cin>>x>>y; bool flag = false;

    for(i=0; i<=x; i++)
    {
        p = i, q = x-i;
        if(p*2 + q*4==y){
            flag = true;
        }
    }

    if(flag) cout<<"Yes\n";
    else cout<<"No\n";

  //  main();

    return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)


Measured memory_bytes: 3612
Scanf.(Array.(
  let n,x=scanf" %d %d"@@fun u v->u,v in
  let s,p=make 50 1,make 50 1 in
  init 49 (fun i->
    s.(i+1)<-2*s.(i)+3;
    p.(i+1)<-2*p.(i)+1) |> ignore;
  let rec f lv ofs =
    (* if lv=1 then (
      if ofs=1 then 0
      else if ofs=5 then 3
      else ofs-1 *)
    if lv=0 then (
      assert (ofs=1); 1
      (* if ofs=1 then 1 else 0 *)
    ) else (
      let r=s.(lv-1) in
      if ofs=1 then 0
      else if ofs<=1+r   then f (lv-1) (ofs-1)
      else if ofs =2+r   then 1 + f (lv-1) r
      else if ofs<=2+r+r then 1 + f (lv-1) r + f (lv-1) (ofs-2-r)
      else if ofs =3+r+r then 1 + 2 * f (lv-1) r
      else failwith ""
    )
  in print_int @@ f n x
));;

Measured memory_bytes: 384
N = int(input())
l = []
ans = 'No'
for _ in range(N):
    #d = list(map(int,input().split()))
    a,b = map(int,input().split())
    d = a - b
    l.append(d)

for i in range(2,N):
    if l[i] == 0 and l[i-1] == 0 and l[i-2] == 0:
        ans = 'Yes'
        break

print(ans)

Measured memory_bytes: 9184
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(N):
    for _ in range(a[i]):
        ans.append(i+1)
for i in range(H):
    if i % 2:
        print(*(list(reversed(ans[i * W:(i + 1) * W]))))
    else:
        print(*ans[i * W:(i + 1) * W])


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

vector<vector<int64_t>> memo(20, vector<int64_t>(10, -1));
int64_t solve(int64_t i, int64_t j) {
    if (i == 1) {
        return 1;
    }

    if (memo[i][j] != -1) {
        return memo[i][j];
    }

    int64_t result = 0;
    for (int64_t k = max(j - 1, (int64_t)0); k <= min(j + 1, (int64_t)9); k++) {
        result += solve(i - 1, k);
    }
    return result;
}

int main() {
    int64_t K;
    cin >> K;

    int64_t total_num = 0;
    string ans;
    for (int64_t d = 1; ; d++) {
        for (int64_t first = 1; first < 10; first++) {
            int64_t curr_num = solve(d, first);
            if (total_num + curr_num >= K) {
                //ここに答えがある
                ans += to_string(first);
                int64_t pre = first;
                for (int64_t i = d - 1; i > 0; i--) {
                    for (int64_t j = max(pre - 1, (int64_t)0); j <= min(pre + 1, (int64_t)9); j++) {
                        int64_t num = solve(i, j);
                        if (total_num + num >= K) {
                            //この桁はこれが答え
                            ans += to_string(j);
                            pre = j;
                            break;
                        } else {
                            total_num += num;
                        }
                    }
                }
                cout << ans << endl;
                return 0;
            } else {
                total_num += curr_num;
            }
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define mod 1000000007ll
#define inf 9999999999999999ll

void bfs(ll node,vv &e,vb &vis)
{
    vis[node]=true;
    queue <ll> q;
    q.push(node);
    while(!q.empty())
    {
        ll u=q.front();
        q.pop();
        for(ll i=0;i<e[u].size();i++)
        {
            ll v=e[u][i];
            if(!vis[v])
            {
                vis[v]=true;
                q.push(v);
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vv e(n,vi());
    for(ll i=0;i<m;i++)
    {
        ll u,v,z;
        cin>>u>>v>>z;
        u--;
        v--;
        e[u].pb(v);
        e[v].pb(u);
    }
    vb vis(n,false);
    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        if(!vis[i])
        {
            bfs(i,e,vis);
            ans++;
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 7412
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define forr(i,p,n) for(int i=p;i<n;i++)
#define tam 12000
#define offset 50000
using namespace std;
typedef long long  ll;
typedef pair<ll,ll> ii;
typedef pair<ll,ii> iii;
const ll MOD=1e9+7;
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int a,b;
    cin>>a>>b;
    int maxx=a+b;
    maxx=max(maxx,a-b);
    maxx=max(maxx,a*b);
    cout<<maxx<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    vector<int> SA = atcoder::suffix_array(S);
    vector<int> v = atcoder::lcp_array(S, SA);
    ll N = S.size();
    ll ans = N * (N + 1) / 2;
    for(auto tmp : v) ans -= tmp;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 15640
open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let (N, X, Y) = readInts() |> triple

let len i j =
  let l a b = abs (a-b)
  min ((l i X)+1+(l Y j)) (l i j)

let result =
  let bin = Array.create 3000 0
  for i in 1..(N-1) do
    for j in (i+1)..N do
      Array.modify bin (len i j) inc
  bin

for k in 1..(N-1) do
  printfn "%d" result.[k]

Measured memory_bytes: 14044
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,m,best;
  bool f = false;
  cin >> n >> m;
  best = m;
  for(int i = 0; i < n; i++){
    int a,b;
    cin >> a >> b;
    m += a - b;
    if(f || m < 0){
      best = 0;
      f = true;
      continue;
    }
    best = max(best,m);
  }
  cout << best << endl;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,m;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	std::cout<<std::fixed<<std::setprecision(30);
	cin>>n>>m;
	Yes(n==m);
	return 0;
}

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

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

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll N    = 1e5 + 10;
const ll MOD  = 1e9 + 7;
const ll INF  = 1e18;

string t;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> t;
    for (int i = 0; i < t.size(); i++) {
        if (t[i] == '?')
            t[i] = 'D';
    }
    cout << t << endl;
    return 0;
}


Measured memory_bytes: 3780
{-# LANGUAGE FlexibleInstances #-}
 
-- StdIn
 
class In a where stdin :: IO a
instance In [Int] where stdin = map read . words <$> getLine
 
solve :: Int -> Int -> Int -> Int -> Int
solve a b c d = max 0 $ (min b d) - (max a c)

main :: IO ()
main = do
  [a, b, c, d] <- stdin
  print $ solve a b c d
  --print $ solve 0 75 25 100
  --print $ solve 0 33 66 99
  --print $ solve 10 90 20 80


Measured memory_bytes: 508
#include <iostream>
#include <fstream>

using namespace std;

int gcd(int x,int y);
int main(){

    int x,y;

    cin >> x >> y;

    cout << gcd(x,y) << endl;

    return 0;
}

int gcd(int x,int y){
    int temp = x;
    if(x>y){
        x = y;
        y = temp;
    }
    int r=x;
    while(r > 0){
        r = y%x;
        y = x;
        x = r;
    }
    return y;
}


Measured memory_bytes: 3112
/*
** author:mahmoud magdy
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

inline int D()
{
    int m ;
    cin>>m;
    return m ;
}
inline ll lD()
{
    ll m ;
    cin>>m;
    return m ;
}
inline double dD()
{
    double m;
    cin>>m;
    return m;
}
void fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

int main()
{
    fast();
    string s;
    cin>>s;
    deque<char>ans;
    for(int i=0; i<s.length(); ++i)
    {
        ans.push_back(s[i]);
    }
    int q=D();
    int c = 0;
    while(q--)
    {
        int a= D();
        if(a==1)
        {
            c++;
            continue;
        }
        if(a==2)
        {
            int f=D();;
            char cr;
            cin>>cr;
            if(f==2&&c%2!=0)
            {
                ans.push_front(cr);
            }
            else if (f==2&&c%2==0)
            {
                ans.push_back(cr);
            }
            if(f==1&&c%2!=0)
            {
                ans.push_back(cr);
            }
            else if (f==1&&c%2==0)
            {
                ans.push_front(cr);
            }
        }
    }
    if(c%2==0)
    {
        for(int i=0; i<ans.size(); ++i)
        {
            cout<<ans[i];
        }
    }
    else
    {
        for(int i=ans.size()-1; i>=0; --i)
        {
            cout<<ans[i];
        }
    }
}


Measured memory_bytes: 976
#include <iostream>
#include <map>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

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

    map<int, int> num;
    REP(i, n) num.insert(make_pair(i+1, -1));

    bool ans = true;
    REP(i, m) {
        int s, c; cin >> s >> c;
        if (num[s] != -1 && num[s] != c)  ans = false;
        else num[s] = c;
        if (n == 3 && s == 1 && c == 0) ans = false;
        if (n == 2 && s == 1 && c == 0) ans = false;
    }

    if (ans) {
        if (n != 1 && num[1] == -1) num[1] = 1;
        string s;
        for (auto itr = num.begin(); itr != num.end(); itr++) {
            if (itr->second == -1) s += '0';
            else s += itr->second + '0';
        }
        cout << stoi(s) << '\n';
    } else
        cout << -1 << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

const double PI=3.14159265358979;

int main(int argc, char* argv[])
{
    double a,b,c;
    scanf("%lf%lf%lf", &a, &b, &c);
    c=c/180.0*PI;
    double L=a+b+sqrt(a*a+b*b-2*a*b*cos(c));
    double h=b*sin(c);
    double S=h*a/2;

    printf("%.10lf\n%.10lf\n%.10lf\n", S,L,h);

    return 0;
}



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



int main(){
    string s;
    cin>>s;
    string ans="No";
    if((s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2])||(s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[1])||(s[0]==s[3]&&s[1]==s[2]&&s[0]!=s[1]))ans="Yes";
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>

using namespace std;

int main() {
	string s[100];
	int n, l;
	cin >> n >> l;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	sort(s, s + n);
	for (int i = 0; i < n; i++) {
		cout << s[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
//1と2を書き間違えて30分とかしました。つらい
//道路でつながってる都市間にだけ鉄道を貼るようにすればOK -> 嘘
//愚直に数えるのを「連結成分ごとに」すればよい -> 通りそう
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

struct UF {
	int num[200001];
	
	void init(int n) {
		for (int i = 0; i < n; i++) {
			num[i] = i;
		}
	}
	
	int root(int x) { if (num[x] == x) return x; return (num[x] = root(num[x])); }
	void marge(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return;
		num[x] = y;
	}
	
	int is_same(int x, int y) {
		return root(x) == root(y);
	}
};

UF uf1;
UF uf2;

vector<int> group1[200000];
vector<int> group2[200000];

int n, k, l;
int a, b;

signed main() {
	int i, j;
	
	cin >> n >> k >> l;
	uf1.init(n);
	uf2.init(n);
	
	for (i = 0; i < k; i++) {
		cin >> a >> b;
		a--; b--;
		uf1.marge(a, b);
	}
	
	for (i = 0; i < l; i++) {
		cin >> a >> b;
		a--; b--;
		uf2.marge(a, b);
	}
	
	for (i = 0; i < n; i++) {
		group1[uf1.root(i)].push_back(i);
		group2[uf2.root(i)].push_back(i);
	}
	
	/*cout << "group1" << endl;
	for (i = 0; i < n; i++) {
		for (j = 0; j < group1[i].size(); j++) {
			cout << group1[i][j] << " ";
		}
		cout << endl;
	}
	
	
	cout << "group2" << endl;
	for (i = 0; i < n; i++) {
		for (j = 0; j < group2[i].size(); j++) {
			cout << group2[i][j] << " ";
		}
		cout << endl;
	}*/
	
	static int ans[200001];
	static bool used[200001] = {false};
	
	for (i = 0; i < n; i++) {
		if (used[i]) continue;

		queue<int> que;
		int rt1 = uf1.root(i);
		int rt2 = uf2.root(i);
		
		if (group1[rt1].size() < group2[rt2].size())
		{
			for (j = 0; j < group1[rt1].size(); j++) {
				if (uf1.is_same(i, group1[rt1][j]) && uf2.is_same(i, group1[rt1][j])) {
					//cout << group1[rt1][j] << " ";
					ans[i]++;
					que.push(group1[rt1][j]);
				}
			}
		}
		else {
			for (j = 0; j < group2[rt2].size(); j++) {
				if (uf1.is_same(i, group2[rt2][j]) && uf2.is_same(i, group2[rt2][j])) {
					//cout << group2[rt2][j] << " ";
					ans[i]++;
					que.push(group2[rt2][j]);
				}
			}
		}
		//cout << "fin" << i << " " << " root" << rt1 << " " << rt2 << endl;
		
		while (!que.empty()) {
			ans[que.front()] = ans[i];
			used[que.front()] = true;
			que.pop();
		}
	}
	
	for (i = 0; i < n; i++) {
		cout << ans[i];
		if (i + 1 < n) cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 23936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
int bi[maxn],li[maxn],ri[maxn],od[maxn],rod[maxn];
ll calc[maxn],presum[maxn],base;
int n,x;
bool less2(int a,int b)
{
	return calc[a]>calc[b];
}
inline ll check(ll K)
{
	int num=(int)(K/(1ll*x));
	int rem=(int)(K%x);
	ll res=-1,tmp;
	int j;
//	cout<<K<<" "<<num<<" "<<rem<<endl;
	for(int i=0;i<n;i++)
	{
		tmp=base;
		j=od[i];
		tmp+=li[j]*1ll*bi[j];
		if(rem>=bi[j])
		{
			tmp+=ri[j]*1ll*(rem-bi[j]);
		}
		else
		{
			tmp-=li[j]*1ll*(bi[j]-rem);
		}
		if(i<num)
		{
			tmp+=presum[num+1];
			tmp-=calc[j];
		}
		else
		{
			tmp+=presum[num];
		}
	//	cout<<res<<" "<<tmp<<endl;
		res=max(res,tmp);
	}
//	system("pause");
	return res;
}
int main()
{
	scanf("%d%d",&n,&x);
	for(int i=0;i<n;i++)
	{
		scanf("%d%d%d",&bi[i],&li[i],&ri[i]);
		calc[i]=x*1ll*ri[i]-bi[i]*1ll*(ri[i]-li[i]);
		od[i]=i;
		base-=li[i]*1ll*bi[i];
	//	cout<<calc[i]<<" "<<base<<endl;
	}
	sort(od,od+n,less2);
	for(int i=0;i<n;i++)
		rod[od[i]]=i;
	for(int i=1;i<=n;i++)
	{
		presum[i]=presum[i-1]+calc[od[i-1]];
//		cout<<presum[i]<<endl;
	}
	ll lb=-1,rb=n*1ll*x;
	while(rb-lb>1)
	{
		ll mid=(lb+rb)/2;
		if(check(mid)>=0)rb=mid;
		else lb=mid;
	}
	printf("%lld\n",rb);
	return 0;
}

Measured memory_bytes: 3712
n = int(input())
s = str(input())
k = int(input())
x = s[k-1]
s_list = list(s)
str_changed = ''
for i in range(len(s)):
    if s_list[i] != x:
        s_list[i] = '*'
str_changed = "".join(s_list)
print(str_changed)

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int main()
{
   vector<int> primes(999999+1,1);
   primes[0]=primes[1]=0;
   for(int c=2;c<primes.size();c++)
   {
       if(primes[c] == 0) continue;
       for(int c2=c+c;c2<primes.size();c2+=c) primes[c2]=0;
   }
   for(int c=1;c<primes.size();c++) primes[c]+=primes[c-1];

   int query;
   while(cin>>query) cout<<primes[query]<<endl;
}

Measured memory_bytes: 4892
N = int(input())
def cd(n):
  ls = []
  for i in range(1,int(n**(1/2))+1):
    if n % i == 0:
      ls += [i, n//i]
  return ls

ans = len(set(cd(N-1))) - 1
for j in set(cd(N)):
  a = N
  if not j == 1:
    while a % j == 0:
      a //= j    
    if a % j == 1:
      ans += 1
print(ans)

Measured memory_bytes: 9920
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
int mod = 998244353;
// int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
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; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(11);
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define mp make_pair
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

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

int sort_greater(int m, int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
	return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t, sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;

map<string, int> memo;

using P=pair<int, int>;

/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
ll findIndex(int value, vector<ll> a)
{

	for (ll i = 0; i < (ll)a.size(); i++) {
		if (a[i] == value) {
			return i;
		}
	}
	return -1;
}

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (ll j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}

const int INF = 1001001001;

bool che(string s) {
	if (s[0] != 'A')return false;
	int c = 0;
	for (int i = 2; i < s.size()-1; i++) {
		if (s[i] == 'C')c++;
	}
	if (c != 1)return false;
	int up = 0;
	rep(i, s.size()) {
		if (s[i] >= 'A' && s[i] <= 'Z')up++;
	}
	if (up != 2)return false;
	return true;
}
int main() {
	ll x;
	cin >> x;
	for (ll i = -5000; i <= 5000; i++) {
		for (ll j = -5000; j <= 5000; j++) {
			if (i * i * i * i * i - j * j * j * j * j == x) {
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
	return 0;
}













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

int main(){
int p,n,bef,aft,a;
scanf("%d",&p);
for(int q=0;q<p;q++){
scanf("%d",&n);
int up=0,down=0;
scanf("%d",&bef);
for(int i=1;i<n;i++){
scanf("%d",&aft);
a=aft-bef;
if(a > up){
	up=a;
}
if(a < down){
	down=a;
}
bef=aft;
}

cout<<up<<" "<<down*-1<<endl;
}
}

Measured memory_bytes: 0
module Main (main) where

import qualified Data.ByteString.Char8     as C8
import           Data.Maybe

main :: IO ()
main = do
  [n] <- readInts
  print . showAnswer $ solve n

type Input  = (Int)
type Output = Int

solve :: Input -> Output
solve = length . filter (=='1') . show

showAnswer :: Output -> Answer
showAnswer = Number

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

data Answer
  = YesNo Bool
  | YESNO Bool
  | AB Bool
  | Number Int
  | Compare Ordering

instance Show Answer where
  show (YesNo b)   = if b then "Yes" else "No"
  show (YESNO b)   = if b then "YES" else "NO"
  show (AB b)      = if b then "A"   else "B"
  show (Number i)  = show i
  show (Compare o)
    | o == EQ = "="
    | o == LT = "<"
    | o == GT = ">"

Measured memory_bytes: 380
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		long[] a = new long[n];
		boolean flg = false;
		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sc.next());
			if (a[i] == 0)
				flg = true;
		}
		if (flg) {
			System.out.println(0);
			return;
		}

		long b = a[0];
		for (int i = 1; i < n; i++) {
			if (a[i] > Long.MAX_VALUE / b) {
				System.out.println(-1);
				return;
			}
			b = b * a[i];
			if (b > 1000000000000000000l) {
				System.out.println(-1);
				return;
			}

		}

		System.out.println(b);

	}

}


Measured memory_bytes: 60428
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	map<string, string> mp;
	mp["Sunny"] = "Cloudy";
	mp["Cloudy"] = "Rainy";
	mp["Rainy"] = "Sunny";

	string s;
	cin >> s;
	cout << mp[s] << endl;


	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            var filePath = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                $"{Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location)}.in");
            Console.SetIn(new StreamReader(filePath));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var A = items[0];
            var B = items[1];
            var C = items[2];
            var hearable = B / A;
            var answer = Math.Min(hearable, C);
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
  	int num=s.length();
  	int ans=0;
  	for(int i=0;i<num/2;i++){
      	if(s[i]!=s[num-i-1])ans++;
    }
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256