akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
#include <cassert>
#include <bitset>

using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i--)
#define forIt(it, a) for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define ft(a) __typeof((a).begin())
#define ll long long
#define ld long double
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define bitcount(n) __builtin_popcountll(n)
#define randchar() ((rand() % 26) + 'a')


typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int N = 100000 + 7;
const int M = 20000007;
const int inf = 1e9 + 7;
const long long linf = 1ll * inf * (inf - 1);
const double pi = acos(-1);
const double eps = 1e-7;
const bool multipleTest = 0;


int n, k;
int a[N];

void solve() {
	cin >> n >> k;
	for (int i = 0; i < n; ++i) cin >> a[i];
	sort(a, a + n);
	
	if (k > a[n - 1]) {
		puts("IMPOSSIBLE");
		return;
	}
	
	int d = a[0];
	for (int i = 1; i < n; ++i) d = __gcd(a[i], d);
//	cout << d << '\n';
	if (d == 1 || (a[n - 1] - k) %  d == 0) {
		puts("POSSIBLE");
	} else {
		puts("IMPOSSIBLE");
	}
	
	
	
}

int main() {
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin);
#endif
	//	freopen("out.txt", "w", stdout);
	// 	ios_base::sync_with_stdio(false);
	// 	cin.tie(NULL);
	
	//	setbuf(stdout, NULL);
	
	int Test = 1;
	if (multipleTest) {
		cin >> Test;
	}
	for(int i = 0; i < Test; ++i) {
		//		printf("Case #%d\n", i + 1);
		//		cout << "Case #" << i + 1 << '\n';
		solve();
	}
	
#ifdef _LOCAL_
	cout<<"\n" << 1.0 * clock() / CLOCKS_PER_SEC<<endl;
#endif
}


Measured memory_bytes: 640
N = int(input())
A = [[0]*2 for i in range (N)]
tmp = list(map(int,input().split()))
for i in range (N):
    A[i][0] = tmp[i]
#print(A)

for i in range (N):
    A[i][1] = i+1

#print(A)
A.sort()
#print(A)

ans = []
for i in range (N):
    ans.append(str(A[i][1]))

output=" ".join(ans)

print(output)

Measured memory_bytes: 71840
from fractions import gcd

n = int(input())
a = list(map(int,input().split()))
l = [0]
r = [0]*n

first = a[0]
for i in a:
    first = gcd(first,i)
    l.append(first)
    
last = a[-1]
for i in range(len(r))[::-1]:
    last = gcd(last,a[i])
    r[i] = last
    
r.append(0)
ans = 0
    
for i in range(len(a)):
    a = l[i]
    b = r[i+1]
    temp = gcd(a,b)
    ans = max(ans,temp)
    
print(ans)

Measured memory_bytes: 16120
#include <cmath>
#include <map>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a <= b) cout<<a<<endl;
	else cout<<a-1<<endl;
	return 0;
}

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

ll keta(ll a){
    string s = to_string(a);
    return s.size();
}

int main(){
    ll N;
    cin >> N;
    ll ans = 1e15;
    for(ll i = 1; i*i <= N; i++){
        if(N % i != 0) continue;
        ans = min(ans, max(keta(i), keta(N/i)));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)



int main() {
	ll n, ans=0;
	in(n);
	

	vll d(n);
	rep(i, 0, n) {
		in(d[i]);
	}

	rep(i, 0, n-1) {
		rep(j, i+1, n) {
			ans += d[i] * d[j];
		}
	}

	outn(ans);

	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int i,ct0=0,ct1=0,ct2=0,ct3=0;
  vector<char> data(4);
  cin >>data.at(0)>>data.at(1)>>data.at(2)>>data.at(3);
  for(i=0;i<=3;i++){
    if(data.at(0)==data.at(i)){
      ct0++;
    }
    if(data.at(1)==data.at(i)){
      ct1++;
    }
    if(data.at(2)==data.at(i)){
      ct2++;
    }
    if(data.at(3)==data.at(i)){
      ct3++;
    }
  }

  if((ct0==2)&&(ct1==2)&&(ct2==2)&&(ct3==2)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

  return 0;
}


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

using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int N;
int A[200011];
int R[200011];

int ring(int a, int b, int c) {
    return (a<b) + (b<c) + (c<a);
}

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%d", A+i), A[i]--;
    REP (i, N) R[A[i]] = i;
    R[N] = N;
    int f = N;
    int ans = 0;
    for (int i=N; i--;) {
	if (ans == 0) {
	    if (R[i] > R[i+1]) {
		ans = 1;
		f = i+1;
	    }
	} else {
	    if (ring(R[f], R[i], R[i+1]) == 1) {
		ans++;
		f = i+1;
	    }
	}
    }
    printf("%d\n", ans);
}

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



Measured memory_bytes: 1792
# coding: utf-8

X, Y, A, B, C = map(int, input().split())

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse=True)
q = sorted(q, reverse=True)
r = sorted(r, reverse=True)

p = [[value, "r"] for value in p]
q = [[value, "g"] for value in q]
r = [[value, "s"] for value in r]

pqr = p + q + r
pqr = sorted(pqr, key=lambda x: x[0], reverse=True)

n_rgs = {"r": 0, "g": 0, "s": 0}

for val, color in pqr:
    n_rgs[color] += 1

    if min(n_rgs["r"], X) + min(n_rgs["g"], Y) + n_rgs["s"] == X+Y:
        break

ans = 0
for val, _ in p[:min(n_rgs["r"], X)]:
    ans += val
for val, _ in q[:min(n_rgs["g"], Y)]:
    ans += val
for val, _ in r[:n_rgs["s"]]:
    ans += val

print(ans)


Measured memory_bytes: 53172
#include <stdio.h>

int main(void)
{
    int a,b,s=0,i;
    scanf("%d%d",&a,&b);
    for(i=a;i<=b;i++)if(i/10000%10==i%10&&i/1000%10==i/10%10)s++;
    printf("%d",s);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)

int cnt;
struct Node{
    bool people;
    vector<Node*> dests;
    Node(bool people = false): people(people){}
    void find(set<Node*>& visited){
        if(visited.count(this)){ return; }
        if(people){ cnt++; }
        visited.insert(this);
        for(Node* d : dests){
            d -> find(visited);
        }
    }
};

int main(){
    int n, m;
    cin >> n >> m;
    vector<Node> ns(n, {true}), ls(m);
    for(int i=0;i<n;i++){
        ns[i].people = true;
    }
    for(int i=0;i<n;i++){
        int k;
        cin >> k;
        for(int j=0;j<k;j++){
            int l;
            cin >> l;
            l--;
            ns[i].dests.push_back(&ls[l]);
            ls[l].dests.push_back(&ns[i]);
        }
    }
    set<Node*> visited;
    ns[0].find(visited);
    cout << (cnt == n ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 15092
// Problem : F - Triangles
// Contest : AtCoder - Tokio Marine & Nichido Fire Insurance Programming Contest 2020
// URL : https://atcoder.jp/contests/tokiomarine2020/tasks/tokiomarine2020_f
// Memory Limit : 1024 MB
// Time Limit : 4000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef complex<double> cd;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
#define bugf(...) fprintf(stderr,__VA_ARGS__);
#define bugs(x) cerr<<"    "<<(x);
#define bugx(x) cerr<<"    "<<(#x)<<" = "<<(x);
#define bugl cerr<<"\n";
#define bugL cerr<<"\n================================================\n";
#define bugt bugx(clock());bugl;
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline bool bmax(IT &a,IT b){if(a<b){a=b;return true;}else return false;}
template<class IT>inline bool bmin(IT &a,IT b){if(a>b){a=b;return true;}else return false;}
inline int gcd(int a,int b){
	int c;
	while(c=b){
		b=a%b;
		a=c;
	}
	return a;
}
ll ans;

inline void sol(int w,int h,int k){
	//bugL bugs("SOL") bugx(w) bugx(h) bugl
	int x,s,y,r,b=((k-1)<<1)+w;
	REP(x,1,w)per(s,min(h-2,b/x),0){
		//bugx(x) bugx(s) bugl
		r=(k<<1)-(2+x*s)+gcd(w,s);
		y=r/w+1;
		if(y*w-gcd(x,y)-gcd(w-x,y+s)>r)--y;
		cmin(y,h-(s+1));
		ans+=s?(y<<1):y;
	}
}
inline void ac(){
	int w,h,k;
	scanf("%d%d%d",&w,&h,&k);
	sol(w,h,k);
	sol(h,w,k);
	printf("%lld",ans<<1);
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	
	ac();
	return 0;
}
#undef pque
#undef rep
#undef per
#undef REP
#undef PER
#undef mp
#undef pb
#undef pf
#undef pob
#undef pof
#undef fi
#undef se
#undef bugs
#undef bugx
#undef bugl

Measured memory_bytes: 3784
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

ll n, t;
ll ketan, ketat;

ll pow(ll x, int i) {
	ll res = 1;
	for (int j = 0; j < i; j++) {
		res *= x;
	}
	return res;
}

ll term(State &begin) {
	begin++;
	begin++;
	int x = *begin - '0';
	begin++;
	if (x * ketan + ketat > 9 || pow(n, x) * t > 1e9) {
		return -1;
	} else {
		return pow(n, x) * t;
	}
}

ll expr(State &begin) {
	ll rec = term(begin);
	if (rec == -1) return -1;
	while (1) {
		if (*begin == '+') {
			begin++;
			ll tmp = term(begin);
			if (tmp == -1 || rec + tmp > 1e9)
				return -1;
			else
				rec += tmp;
		} else {
			return rec;
		}
	}
}

int main() {
	IOS();
	cin >> n >> t;
	ketan = to_string(n).size() - 1;
	ketat = to_string(t).size() - 1;
	string s;
	cin >> s;
	State begin = s.begin();
	ll ans		= expr(begin);
	dump(ans == -1 ? "TLE" : to_string(ans));
	return 0;
}



Measured memory_bytes: 3256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
vector<vector<int>> graph(1000000);
vector<int> res(1000000);
vector<bool> seen(1000000);
int v;
void dfs(int p){
    int size = 0;
    size = graph[p].size();
  //cout << "p" << p << " size" << size << endl;
    seen[p] = true;
    for(int i = 0;i < size;i++){
        int memo = 0;
        memo = graph[p][i];
        if(seen[memo])continue;
        res[memo] += res[p];
        dfs(memo);
    }
}
int main(){
    int q = 0;
    cin >> v >> q;
  //cout<< "%" << endl;
    for(int i = 0;i < v - 1;i++){
        int a,b;
        cin >> a >> b;
        a--,b--;
      //cout  << "&" << endl;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
  /*for(int i = 0;i < v;i++){
    for(int j = 0;j < graph[i].size();j++)cout << graph[i][j] << " ";
    cout << endl;
  }*/
  //cout << "#" << endl;
    for(int i = 0;i < v;i++)seen[i] = false;
    for(int i = 0;i < v;i++)res[i] = 0;
    for(int i = 0;i < q;i++){
      int p,x;
      cin >> p >> x;
      p--;
      res[p] += x;
    }
  /*for(int i = 0;i < v;i++)cout << res[i] << " ";
  cout << endl;*/
    dfs(0);
    for(int i = 0;i < v;i++){
        cout << res[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 45440
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

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

using namespace std;

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

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

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

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

	sort(all(s));
	sort(rall(t));

	cout << (s < t ? "Yes" : "No") << endl;
}

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

int main() {
	int N, K;
	cin >> N >> K;
  	vector<double> p(N);
  	for (int i = 0; i < N; i++) cin >> p.at(i);

  	vector<double> pi(N+1, 0);
  	for (int i = 0; i < N; i++){
      pi.at(i+1) = pi.at(i) + (p.at(i)+1)/2;
    }
  
  	double res = -1;
    for (int i = 0; i <= N-K; ++i) {
      double val = pi.at(K+i) - pi.at(i);
      if (res < val) res = val;
    }
  cout << fixed << setprecision(6);
  cout << res << endl;
}

Measured memory_bytes: 3328
package main

import (
	"fmt"
	"bufio"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		str := []rune(scanner.Text())
		for i:=len(str)-1; i>=0; i-- {
			fmt.Printf(string(str[i]))
		}
		fmt.Println()
	}
}


Measured memory_bytes: 1080
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  
  double x[N];
  string s[N];
  for(int i=0;i<N;i++) {
    cin>>x[i]>>s[i];
  }
  double ans=0;
  
  for(int i=0;i<N;i++) {
    if(s[i]=="BTC"){
      x[i]=x[i]*380000.0;
      ans+=x[i];
    }
    else{
      ans+=x[i];
    }
  }
  cout<<fixed<<setprecision(5)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func putSlice(a []int) {
	for i := range a {
		if i == len(a)-1 {
			puts(a[i])
		} else {
			putf("%d ", a[i])
		}
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	p := make([]int, n)
	for i := range p {
		p[i] = nextInt() - 1
	}
	r := make([]int, n)
	for i := range r {
		r[p[i]] = i
	}

	a := make([]int, n)
	for i := range a {
		a[i] = 30000 * (i + 1)
	}
	b := make([]int, n)
	for i := range b {
		b[i] = 30000*(n-i) + r[i]
	}

	putSlice(a)
	putSlice(b)
}


Measured memory_bytes: 3044
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
#define mod 1000000007
#define int long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A) memset(A,0,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000000
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mpi map<pair<int,int> ,int>
#define mip map<int, pair<int,int> >
#define inf INT_MAX
#define inf1 LONGLONG_MAX
#define sz(v) v.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define deb(x) cout<<#x<<"is "<<x<<endl;
#define lower(s) transform(all(s),s.begin(),::tolower)
#define endl "\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, 
         tree_order_statistics_node_update> pbds;
   
/* brownsands :Arpit */		

void solve()
{  int n,m;
   cin>>n>>m;
   cout<<(m*(m-1))/2 + (n*(n-1))/2;
}
signed main()
{
   boost
        int test=0,t;
		//cin>>t;
		t=1;
		while(test++ <t){
            //cout<<"Case #"<<test<<": ";
            solve();
            //cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
               }		
} 
               
			
 

				
		
		




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(int i=0; i<x;i++)
#define mod 1000000007
#define INF 10000000000
typedef long long ll;
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; }




int main(){
 ios::sync_with_stdio(false);
  
  int H,W;
  cin>>H>>W;
  vector<string>a(H);
  rep(i,H) cin>>a[i];

  ll dp[H+1][W+1];
  rep(i,H+1) rep(j,W+1) dp[i][j] = 0;
  dp[1][1] = 1;
  
  for(int i=1;i<H+1;i++){
  	for(int j=1;j<W+1;j++){
    	if(a[i-1][j-1]=='#'){
        	dp[i][j] = 0;
        }else{
        	dp[i][j] += (dp[i-1][j] + dp[i][j-1])%mod;
        }
    }
  }
  
  cout<<dp[H][W] % mod;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 32770;
const int MAXM = 20;
const int mod = 998244353;
const int G = 3;

namespace FFT
{
	int wn[MAXM], R[MAXN], L, n;

	inline int Qow(int x, int y)
	{
		int ret = 1;
		for (; y; y >>= 1, x = 1LL * x * x % mod)
			if (y & 1)
				ret = 1LL * ret * x % mod;
		return ret;
	}

	inline int Inv(int x)
	{
		return Qow(x, mod - 2);
	}

	inline void Ini(int len)
	{
		for (n = 1, L = 0; n < len; n <<= 1, L ++);
		for (int i = 1; i < n; i ++)
			R[i] = (R[i >> 1] >> 1) | ((i & 1) << L - 1);
		wn[0] = Qow(G, mod - 1 >> L);
		for (int i = 1; i < L; i ++)
			wn[i] = 1LL * wn[i - 1] * wn[i - 1] % mod;
	}

	inline void Ini_Inv()
	{
		wn[0] = Inv(wn[0]);
		for (int i = 1; i < L; i ++)
			wn[i] = 1LL * wn[i - 1] * wn[i - 1] % mod;
	}

	inline void FFT(int *x)
	{
		for (int i = 0; i < n; i ++)
			if (i < R[i])
				swap(x[i], x[R[i]]);
		for (int i = 1, l = L - 1; i < n; i <<= 1, l --)
			for (int j = 0; j < n; j += i << 1)
				for (int k = 0, w = 1, u, v; k < i; k ++, w = 1LL * w * wn[l] % mod)
					u = x[j + k], v = 1LL * x[i + j + k] * w % mod, x[j + k] = (u + v) % mod, x[i + j + k] = (u + mod - v) % mod;
	}

	inline void Cpy(int *x, int n, int *y, int m)
	{
		for (int i = 0; i < n; i ++)
			y[i] = x[i];
		for (int i = n; i < m; i ++)
			y[i] = 0;
	}

	inline void Mul(int *a, int n, int *b, int m, int *ret)
	{
		static int x[MAXN], y[MAXN];
		Ini(n + m - 1);
		Cpy(a, n, x, FFT::n); Cpy(b, m, y, FFT::n);
		FFT(x); FFT(y);
		for (int i = 0; i < FFT::n; i ++)
			x[i] = 1LL * x[i] * y[i] % mod;
		Ini_Inv();
		FFT(x);
		int v = Inv(FFT::n);
		for (int i = 0; i < FFT::n; i ++)
			ret[i] = 1LL * v * x[i] % mod;
	}
}

int n, m, fac[MAXN], inv[MAXN], x[MAXN], r[MAXN];
char s[MAXN], t[MAXN];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	scanf("%s%s", s + 1, t + 1);
	for (int i = 1, l = strlen(s + 1); i <= l; i ++)
		if (s[i] == '1' && t[i] == '1')
			n ++;
		else if (s[i] == '1' && t[i] == '0')
			m ++;
	r[0] = fac[0] = inv[0] = fac[1] = inv[1] = 1;
	for (int i = 2; i <= n + m + 1; i ++)
		fac[i] = 1LL * fac[i - 1] * i % mod, inv[i] = 1LL * (mod - mod / i)  * inv[mod % i] % mod;
	for (int i = 2; i <= n + m + 1; i ++)
		inv[i] = 1LL * inv[i] * inv[i - 1] % mod;
	for (int i = 0; i <= n; i ++)
		x[i] = inv[i + 1];
	for (int t = m; t; t >>= 1, FFT::Mul(x, n + 1, x, n + 1, x))
		if (t & 1)
			FFT::Mul(x, n + 1, r, n + 1, r);
	int ret = 0;
	for (int i = 0; i <= n; i ++)
		ret = (ret + r[i]) % mod;
	return printf("%d\n", 1LL * ret * fac[n] % mod * fac[m] % mod * fac[n + m] % mod), 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
using namespace std;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep0(i,n) for(register int i=0;i<(n);++i)
#define per0(i,n) for(register int i=(n)-1;i>=0;--i)
#define rep(i,st,ed) for(register int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(register int i=(ed);i>=(st);--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &a,const T &b){return a<b?a:b;}
template<typename T> il T qmax(const T &a,const T &b){return a>b?a:b;}
template<typename T> il void getmin(T &a,const T &b){if(a>b) a=b;}
template<typename T> il void getmax(T &a,const T &b){if(a<b) a=b;}
il void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e17+7;
const int N=1e5+7;

int a[N],n;
int nums[N]; 

int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",a+i),nums[i]=a[i];
	sort(nums+1,nums+n+1);
	int ans=0;
	rep(i,1,n){
		a[i]=lower_bound(nums+1,nums+n+1,a[i])-nums;
		if((a[i]&1)^(i&1)) ++ans;
	} 
	printf("%d\n",ans>>1);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>

int main()
{
	int N,i,a,b,c,sum;
	std::cin >> N;
	std::cin >> b;
	c = 1;
	sum = 0;
	for (i = 0; i < N-1; i++) {
		std::cin >> a;
		if (a == b) {
			c++;
		}
		else {
			sum = sum + (c / 2);
			c = 1;
			b = a;
		}
	}
	sum = sum + (c / 2);
	std::cout << sum << "";
	return 0;
}

Measured memory_bytes: 256
import sys
num = []

for i in sys.stdin:
    H, W = i.split()
    if H == W == '0':
        break
    num.append((int(H), int(W)))

for cnt in range(len(num)):
    output = []
    for h in range(num[cnt][0]):
        before = '#'
        for w in range(num[cnt][1]):
            if h == 0:
                if before == '.':
                    before = '#'
                elif before == '#':
                    before = '.'
                output.append(before)

        for z in range(num[cnt][1]):
            if output[z] == '#':
                output[z] = '.'
            elif output[z] == '.':
                output[z] = '#'
                
        for y in range(num[cnt][1]):
            print(output[y],end='')

        print()
    print()

Measured memory_bytes: 9068
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while(x!=NIL){
    y=x;
    if(z->key < x->key)
      x=x->left;
    else
      x=x->right;
  }
 
  z->parent=y;
 
  if(y==NIL)
    root=z;
  else if(z->key < y->key)
    y->left=z;
  else
    y->right=z;
 
 
}
 
void inorder(Node x){
  if(x!=NIL){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
  }
}
 
void preorder(Node x){
  if(x!=NIL){
    printf(" %d",x->key);
    preorder(x->left);
    preorder(x->right);
  }
   
}
 
 
int main(){
  int n, i, x;
  char com[20];

  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } 
    
    }
  
 
  return 0;
}

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

int main() {
  string S, T;
  cin >> S >> T;
  
  int ans = 0;
  for (int i = 0; i < (int)S.size(); i++) {
    if(S[i]!=T[i]) ans++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3916
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
  
using namespace std;
//using namespace boost;
//using namespace multiprecision;  

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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


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

    char a;
    cin >> a;

    if('A' <= a && a <= 'Z'){
        cout << "A\n";
    }else{
        cout << "a\n";
    }

    return (0);
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,l,a=300,sum=0,zero=0;
    cin>>n>>l;
    for(int i=1; i<=n; i++)
    {
        a=min(abs(i+l-1),a);
        sum+=(i+l-1);
    }
    if(sum>=0)
        cout<<sum-a<<endl;
    else
        cout<<sum+a<<endl;
    return 0;
}



Measured memory_bytes: 3600
from sys import setrecursionlimit
#setrecursionlimit(10**5)
class UnionFind:
    def __init__(self, n):
        # 親要素のノード番号を格納
        # par[x]=xの時そのノードは根　
        self.par = [i for i in range(n + 1)]
        # rank
        self.rank = [0] * (n + 1)
        self.size = [1] * (n + 1)

    def find(self, x):
        # 根の番号を返す(所属する集合を確認する)
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def check(self, x, y):
        # x,yが同じ集合に属するかどうか調べる
        return self.find(x) == self.find(y)


    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)
        if x == y:return
        # rankの小さいものを大きいほうにくっつける
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def count_group(self):
        return len({self.find(x) for x in range(n)})

n, q = map(int,input().split())
uf = UnionFind(n)

for i in range(q):
    com, x, y = map(int,input().split())
    if com == 0:
        uf.union(x, y)
    else:
        if uf.check(x, y):print(1)
        else:print(0)



Measured memory_bytes: 6120
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  REP(i,N) cin>>A[i];
  SORT(A);
  REVERSE(A);
  
  ll mx=A[0],mn=INF;
  RREP(i,N-1){
    if(abs(mx/2-A[i])<abs(mx/2-mn)) chmin(mn,A[i]);
  }
  
  cout<<mx<<" "<<mn<<endl;
  return 0;
}

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    long long x,y;
    cin>>x>>y;
    if(x<y){
        swap(a,b);
        swap(x,y);
    }
    cout<<y*min(a+b,2*c)+(x-y)*min(a,2*c)<<endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
	int a[100][2];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i][0] >> a[i][1];
	}
	bool flag = false;
	for (int i = 0; i <= n - 3; i++) {
		if (a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]) {
			flag = true;
			break;
		}
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
  uint64_t N;
  cin >> N;
  
  vector<vector<int64_t>> p(N);
  for (uint64_t n = 0; n < N; ++n) {
    p[n] = vector<int64_t>(N, -1);
  }

  for (uint64_t n = 0; n < N; ++n) {
    uint64_t A;
    cin >> A;

    for (uint64_t a = 0; a < A; ++a) {
      int64_t x, y;
      cin >> x >> y;

      p[n][x - 1] = y;
    }
  }

  uint64_t count_max = 0;
  for (uint64_t mask = 0; mask < (1 << N); ++mask) {
    vector<int64_t> q(N, -1);
    for (uint64_t m = 0; m < N; ++m) {
      if (((mask >> m) & 1) == 1) {
        for (uint64_t k = 0; k < N; ++k) {
          if (q[k] == -2) {
            // failed
          } else if (q[k] == -1) {
            q[k] = p[m][k];
          } else {
            if (p[m][k] == -1) {
              // nothing to do
            } else {
              if (q[k] != p[m][k]) {
                q[k] = -2;
              }
            }
          }
        }
      }
    }

    bool f = true;
    for (uint64_t m = 0; m < N; ++m) {
      if (q[m] == -2) { f = false; break; }
      int64_t x = (mask >> m) & 1;
      if (q[m] == -1) { continue; }
      if (x == 1 && q[m] == 0) { f = false; break; }
      if (x == 0 && q[m] == 1) { f = false; break; }
    }

    if (f) { count_max = max(count_max, bitset<16>(mask).count()); }
  }
  cout << count_max << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N=200005;
struct node { int x,y; } a[N];
LL an;
int z[N],s[N],i,j,k,n,m,x,y,l1,l2,r1,r2,l,r,L,R;
bool P;
char c;

inline char getc()
{
	#define VV 10000000
	static char s[VV],*l=s,*r=s;
	if (l==r)
		l=s,r=s+fread(s,1,VV,stdin);
	return l==r?0:*l++;
}

int read(){ int z=0; do c=getc(); while (c<'0'||c>'9'); while (c>='0'&&c<='9') z*=10,z+=c-'0',c=getc(); return z; }

bool cmp(node a,node b){ return a.x<b.x; }

void solve()
{
	sort(a+1,a+n+1,cmp);
	int D=1e9;
	for (i=1;i<=n;++i)
		an=min(an,(LL)(R-L)*(r1-min(a[i].x,D))),
		D=min(D,a[i].y),
		r1=max(r1,a[i].y);
}

int main()
{
	n=read(),L=1e9;
	for (i=1;i<=n;++i)
	{
		a[i]=(node){read(),read()};
		if (a[i].x>a[i].y) swap(a[i].x,a[i].y);
		L=min(L,a[i].x),R=max(R,a[i].y);
	}
	if (n==1||L==R)
	{
		puts("0");
		return 0;
	}
	l1=l2=1e9;
	for (i=1;i<=n;++i)
		x=a[i].x,y=a[i].y,
		l1=min(l1,x),r1=max(r1,x),
		l2=min(l2,y),r2=max(r2,y);
	an=(LL)(r1-l1)*(r2-l2);
	solve();
	printf("%lld\n",an);
	return 0;
}

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

int main()
{
	int n, x, ans;
	int i, j, k, count;

	while (1) {
		count = 0;
		cin >> n >> x;

		if (n == 0 && x == 0) {
			break;
		}

		for (i = 1; i <= n-2; i++) {
			for (j = i + 1; j <= n-1; j++) {
				for (k = j + 1; k <= n; k++) {
					ans = i + j + k;
					if (ans == x) {
						count++;
					}
				}
			}
		}
		cout << count << endl;
	}
    return 0;
}




Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    for(int i=0;i<5;i++){
        int a;cin>>a;
        if(a==0){
            cout<<i+1<<endl;
        }
    }
}

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

int main() {
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  int kotae=A*X+B*Y;
  int keisan=INT_MAX;
    rep(i,max(X+1,Y+1)){
      if((X-i)<=0)A=0;
      else if((Y-i)<=0)B=0;
      keisan=A*(X-i)+B*(Y-i)+i*2*C;
      kotae=min(kotae,keisan);
    }
  cout <<kotae<<endl;
}

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

int main(){
  int X;

  cin >> X;

  int ans = 1;

  for(int i = 2; i < sqrt(X); ++i){
    int j = 1;
    while(j <= X){
      if(j > ans) ans=j;
      j = j * i;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
M = max(a)+1
if M == 2:
    print("pairwise coprime")
    exit()
count = [0]*(M)

for i in range(2,M):
    if count[i] == 0:
        for j in range(i,M,i):
            if count[j] == 0:
                count[j] = i
check = [0]*(M)
for i in a:
    x = i
    while x > 1:
        check[count[x]] += 1
        y = count[x]
        while x%y == 0:
            x //= y
ans = max(check)
if ans == 1:
    print("pairwise coprime")
elif ans == n:
    print("not coprime")
else:
    print("setwise coprime")

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

public class Main {
	FastScanner in = new FastScanner(System.in);
	PrintWriter out = new PrintWriter(System.out);
	
	public void run() {
		while (true) {
			int n = in.nextInt(), m = in.nextInt(), p = in.nextInt();
			if (n == 0) break;
			
			int[] x = in.nextIntArray(n);
			
			int sum = 0;
			for (int i = 0; i < n; i++) {
				sum += x[i];
			}
			sum *= (100 - p);
			
			int winner = x[m-1];
			System.out.println(winner == 0 ? 0 : sum / winner);
		}
		
		out.close();
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();

			return array;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();

			return array;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();

			return array;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

Measured memory_bytes: 20532
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int MOD = 1000000007;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(0);
    
    int N, K;
    cin >> N >> K;

    cout << (N%K? 1:0) << endl;

    return 0;
}


Measured memory_bytes: 256
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define MOD2 998244353
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);
bool isPalindrome(string str)
{
    int l = 0;
    int h = (str.size()) - 1;

    while (h > l)
    {
        if (str[l++] != str[h--])
        {
            return false;
        }
    }
    return true;
}
void solve(int test) {
    double s ;cin>>s;
    double maxvalue = 0;
    double length = s / 3;

    s -= length;

    // finding breadth
    double breadth = s / 2;

    // finding height
    double height = s - breadth;

    cout<<setprecision(10)<< length * breadth * height<<endl;

}
int32_t main() {
    IOS;
    int test = 1;
//    cin >> test;
    for(int i=1;i<=test;i++){
        solve(i);
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}


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

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n, m;
  cin >> n >> m;
  if (n == 1 && m == 0) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> s(m), c(m);
  for (int i = 0; i < m; ++i) {
    cin >> s[i] >> c[i];
    s[i]--;
  }
  bool ok = true;
  for (int i = 0; i < m; ++i) {
    for (int j = i + 1; j < m; ++j) {
      if (s[i] == s[j] && c[i] != c[j]) {
        ok = false;
      }
    }
    if (1 < n && s[i] == 0 && c[i] == 0) {
      ok = false;
    }
  }
  if (!ok) {
    cout << -1 << endl;
  } else {
    string ans = "";
    for (int i = 0; i < n; ++i) {
      ans += "?";
    }
    for (int i = 0; i < m; ++i) {
      ans[s[i]] = (char)(c[i] + '0');
    }
    for (int i = 0; i < n; ++i) {
      if (ans[i] == '?') {
        if (i == 0) {
          ans[i] = '1';
        } else {
          ans[i] = '0';
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

typedef long long int ll;
typedef long double ld;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD (ll)(1e9 + 7)
#define vi vector<int>
#define vii vector<vector<int> >
#define vl vector<ll>
#define vll vector<vector<ll> >
#define vc(T, nm) vector<T> nm
#define pb push_back
#define popb pop_back
#define si set<int>
#define sl set<ll>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define ins insert
#define ers erase
#define endl "\n"
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define adr(a, b) ((a % MOD) + (b % MOD)) % MOD
#define FORA(x, s, e, inc) for(ll x = s; x != e; x += inc)
#define ROFA(x, s, e, inc) for(ll x = s; x != e; x -= inc)
#define FOR(x, s, e) FORA(x, s, e, 1)
#define ROF(x, s, e) ROFA(x, s, e, 1)
#define loop(x, n) FOR(x, 0, n)
#define rd1(t, a) 					t a; cin >> a;
#define rd2(t, a, b) 				rd1(t, a); rd1(t, b); 
#define rd3(t, a, b, c) 			rd2(t, a, b); rd1(t, c);
#define rd4(t, a, b, c, d) 			rd3(t, a, b, c); rd1(t, d);
#define rd5(t, a, b, c, d, e) 		rd4(t, a, b, c, d); rd1(t, e);
#define rd6(t, a, b, c, d, e, f) 	rd5(t, a, b, c, d, e); rd1(t, f);
#define rdA(t, nm, len)				t nm[len]; loop(i, len) {cin >> nm[i];}
#ifdef DEBUG
	#define deb(v) cout << endl << #v << ": " << v << endl
	#define db1(v) cout << endl << #v << ": " << "[ "; for(auto x: v) {cout << x << " ";}; cout << "]" << endl;
	#define db2(v) cout << endl << #v << ": " << endl; for(auto r: v) {cout << "[ "; for(auto x: r) {cout << x << " ";}; cout << "]" << endl;};
	#define dbl cout << "-------------------------------" << endl
#else
	#define deb(v)
	#define db1(v)
	#define db2(v)
	#define dbl
#endif

void solve() {
	rd2(ll, a, b);
	cout << a * b;
}

int main() {
	
	fastio;

// 	rd1(ll, t);
	ll t = 1;

    while(t--) {
        solve();
    }
    
	return 0;
}

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

int n,a,b;

int main() {
	string t,h;
	cin >> n;

	for(int i=0;i<n;i++){
		cin >> t >> h;

		if( t>h ){
			a+=3;
		}else if( h>t ){
			b+=3;
		}else{
			a+=1;
			b+=1;
		}
	}
	
	cout << a << ' ' << b << "\n";
    return 0;
}

Measured memory_bytes: 1208
n,m,k=map(int,input().split())
MOD=998244353

def prepare(n, MOD):
    # n! の計算
    f = 1
    for m in range(1, n + 1):
        f *= m
        f %= MOD
    fn = f
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return fn, invs

a,b=prepare(n-1,MOD)
ans,s=0,(m*pow(m-1,n-k-1,MOD))%MOD
for x in range(k,-1,-1):
    ans+=(s*a*b[x]*b[n-x-1])%MOD
    ans%=MOD
    s*=(m-1)
    s%=MOD
print(ans)

Measured memory_bytes: 69288
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 1e9 + 7;

int main() {
    int h, w;
    cin >> h >> w;
    int cs[10][10];
    rep(i, 10) {
        rep(j, 10) cin >> cs[i][j];
    }
    vector<vector<int>> as(h, vector<int>(w, 0));
    rep(i, h) rep(j, w) cin >> as[i][j];
    rep(k, 10) {
        rep(i, 10) {
            rep(j, 10) {
                cs[i][j] = min(cs[i][j], cs[i][k] + cs[k][j]);
            }
        }
    }
    int ret = 0;
    rep(i, h) {
        rep(j, w) {
            if (as[i][j] == -1 || as[i][j] == 1) continue;
            ret += cs[as[i][j]][1]; 
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 384