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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
		cin.tie(0);							     \
		cout.tie(0);
#define sz(arr) (ll)arr.size()

using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 9;
const double PI = 4.0 * atan(1.0);

ll powmod(ll a, ll b, const ll MOD) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }

//vector<pair<ll,ll>> factors(ll n) {
//	vector<pair<ll,ll>> f;
//	for (ll x = 2; x * x <= n; ++x) {
//		ll cnt = 0;
//		while (n % x == 0) {
//			++cnt;
//			n /= x;
//		}
//		if (cnt > 0)
//			f.push_back({ x, cnt });
//	}
//	if (n > 1) f.push_back({ n,1 });
//	return f;
//}

//ll f[200005];
//ll kCn(ll k, ll n) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }

ll dp[2009][2009];

int main() {
	//#ifndef ONLINE_JUDGE
	//	(void)freopen("input.txt", "r", stdin);
	//	(void)freopen("output.txt", "w", stdout);
	//#endif // !ONLINE_JUDGE
	fastio;
	int n;
	cin >> n;
	vector<pair<ll, int>> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i].first;
		a[i].second = i;
	}
	vector<vector<ll>> dp(2010, vector<ll>(2010, -INF));
	sort(a.begin(), a.end(), greater<pair<ll, int>>());
	dp[0][0] = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j + i < n; ++j) {
			int k = i + j;
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + 1LL * a[k].first * abs(a[k].second - i));
			dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + 1LL * a[k].first * abs(a[k].second - (n - 1 - j)));
		}
	}
	ll res = 0;
	for (int i = 0; i <= n; ++i)
		res = max(res, dp[i][n-i]);
	cout << res;	
	return 0;
}


Measured memory_bytes: 34876
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define pb push_back

 vector<int> gcd_ex(unsigned a, unsigned b) {
  int m = min(a,b);
  int i = 1;
  vector<int> n;
  while (i <= m) {
    if (a%i == 0 && b%i==0){
      n.push_back(i);
    }
    i++;
  }
  return n;
}

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  vector<int> num = gcd_ex(a, b);
  int i = num.size() - k;
  cout << num[i] << endl;
  // for (auto j : num){
  //   cout << j << endl;
  // }

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };
 
signed main() {
	int N;
	cin >> N;

	vector<int> a(N);
	rep(i, N) cin >> a[i];

	sort(all(a));

	int sum = 0;
	rep(i, N) sum += a[i];

	int ret = 1;
	for (int i = N - 2; i >= 0; i--) {
		sum -= a[i + 1];
		if (2 * sum >= a[i + 1]) ret++;
		else break;
	}

	cout << ret << endl;
}


Measured memory_bytes: 1024
N, W = map(int, input().split())
items = [list(map(int, input().split())) for _ in range(N)]
 
dp = [[0 for _ in range(W+10)] for _ in range(N+10)]
 
for i, (item_weight, item_value) in enumerate(items):
    for total_weight in range(W+1):
        if (total_weight-item_weight) >= 0:
            dp[i+1][total_weight] = dp[i][total_weight-item_weight] + item_value
        dp[i+1][total_weight] = max(dp[i+1][total_weight], dp[i][total_weight])
        
print(dp[N][W])

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

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K,X;cin >> K >> X;
    cout << X - (K - 1);
    for(int i = X-(K-2);i < X+K;i++) cout << " " << i;
    cout << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	ld a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		//ax+by+c
		//dx+ey+f
		ld x, y;
		if (d == 0) {
			swap(a, d);
			swap(b, e);
			swap(c, f);
		}
		else if (e == 0) {
			swap(a, d);
			swap(b, e);
			swap(c, f);
		}
		if (a == 0) {
			y = c / b;
			x = (f - e * y) / d;
		}
		else if (b == 0) {
			x = c / a;
			y = (f - d * x) / e;
		}
		else {
			b /= a;
			c /= a;
			e /= d;
			f /= d;
			y = (f - c) / (e - b);
			x = (c - b * y);
		}
		x *= 1000;
		x = round(x);
		x /= 1000;
		y *= 1000;
		y = round(y);
		y /= 1000;
		printf("%.3LF %.3LF\n", x, y);
	}
}


Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1001001001;

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

int main(){
  int n;
  cin >> n;
  int dp[n][3];
  for(int i=0; i<n; ++i){
    int a;
    cin >> a;
    if(i==0){
      dp[0][0] = a;
      dp[0][1] = 0;
      dp[0][2] = 0;
      continue;
    }
    dp[i][0] = gcd(a,dp[i-1][0]);
    dp[i][1] = max(gcd(a,dp[i-1][2]),gcd(a,dp[i-1][1]));
    dp[i][2] = dp[i-1][0];
  }
  cout << max(dp[n-1][1], dp[n-1][2]) << endl;
}

Measured memory_bytes: 4740
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int,P> PP;
struct edge { int to, cor; };
vector<string>V;
string S = "357";
bool cnt(string s) {
	int t = 0, f = 0, e = 0;
	rep(i, s.size()) {
		if (s[i] == '3')t++;
		else if (s[i] == '5')f++;
		else e++;
	}
	return t&&e&&f;
}

void saiki(string s) {
	if (s.size() == 9) {
		V.push_back(s);
		return;
	}

	rep(i, 3) {
		s.push_back(S[i]);
		saiki(s);
		s.pop_back();
	}
	if(s.size()>=1)V.push_back(s);
	return;
}
signed main() {
	int n; cin >> n;
	saiki("");
	int ans = 0;
	rep(i, V.size()) {
		int X = stoll(V[i]);
		if (X <= n&&cnt(V[i]))ans++;
	}
	cout << ans << endl;

}

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

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
using namespace std;

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

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
// Head

const double eps = 1e-9;

int a, b;

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

    cin >> a >> b;

    for (int i = 1; i <= 500000; ++i) {
        if (int(i * 0.08 + eps) == a && int(i * 0.1 + eps) == b) {
            cout << i << '\n';
            return 0;
        }
    }

    cout << -1 << '\n';

    return 0;
}

Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())

print(min(
    X * A + Y * B,
    X * C * 2 + max(Y - X, 0) * B,
    max(X - Y, 0) * A + Y * C * 2,
    max(X, Y) * C * 2,
))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
//#define debug1 cout<<"?"<<endl;
//#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=3e5+9;
const double pi=acos(-1);
const int mod=998244353;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
int main()
{
	int a[4]={0},i,n,m,ju=0;
	bool b[4]={0};
	scanf("%d%d",&n,&m);
	while(m--)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if(b[x]&&a[x]!=y)ju=1;
		b[x]=1;a[x]=y;
	}
	if(b[1]&&!a[1]&&n>=2)ju=1;
	if(!b[1]&&n>=2)a[1]=1;else if(!b[1])a[1]=0;
	if(ju)puts("-1");
	else 
	{
		for(i=1;i<=n;i++)printf("%d",a[i]);puts("");
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
typedef long long ll;
using namespace std;

map< ll, int > prime_factor(ll n) {
  map< ll, int > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

// 検証例

int main() {
  ll N;
  cin >> N;
  int ret = 1; // Nを含む
  for(ll i = 2; i * i <= N; i++) {
    if (N % i == 0) {
      ll tmp = N;
      while(tmp%i==0) tmp/=i;
      if (tmp%i==1) ret++;
    }
  }
  int ret2 = 1;
  for(auto p : prime_factor(N-1)) {
    ret2*=(p.second+1);
  }
  ret2--; // 1を除く
  cout << ret+ret2 << endl;
}

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

using ll = long long;
#define REP(i,n) for(int i = 0;i < n;i++)

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()

#define debug(arr) cout << #arr << " = " << arr << '\n'
#define debug2(a,b) cout << "[" << #a << "," << #b << "] = " << "[" << a << "," << b << "]" << '\n'
template<class T> ostream &operator << (ostream& out, const vector<T>& arr) {
	cout << "{";
	for (int i = 0; i < arr.size(); i++)cout << (!i ? "" : ", ") << arr[i];
	cout << "}";
	return out;
}
template<class T> ostream &operator << (ostream& out, const vector<vector<T> >& arr) {
	cout << "{\n";
	for (auto& vec : arr)cout << "  " << vec << ",\n";
	cout << "}";
	return out;
}
template<class T> istream &operator >> (istream& in, vector<T>& arr) {
	for (auto& i : arr)cin >> i; return in;
}

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

  int n;cin >> n;
 	vector<ll> a(n);
 	REP(i,n)cin >> a[i];

 	sort(all(a));

 	ll ans = 0;
 	REP(i,n)REP(j,i)REP(k,j){
 		ans += (a[i] < (a[j] + a[k])) && (a[i] != a[j] && a[j] != a[k]);
 	}
 	cout << ans << '\n';
}


Measured memory_bytes: 3656
use strict;
use warnings;

sub main {
    chomp(my $Y = <STDIN>);
    chomp(my $Z = <STDIN>);
    my ($N,$M,$B) = split(/ /,$Y);
    my @X = split(/ /,$Z);
    print solve($N,$M,$B,\@X);
}
main() unless caller;

sub solve {
    my ($N,$M,$B,$X) = @_;
    my $x = int($B/$M)+1;
    my $ans=0;
    for my $i(0..$N-2) {
        my $kyori = $X->[$i+1] - $X->[$i];
        $ans += $kyori >= $x ? $B : $kyori*$M;
    }
    return $ans;
}

Measured memory_bytes: 17316
#include <iostream>

int a, b;

int main() {
    std::cin >> a >> b;
    if (a == b) {
        std::cout << "Yay!" << std::endl;
        return 0;
    }
    if (a <= 8 && b <= 8) {
        std::cout << "Yay!" << std::endl;
        return 0;
    }
    else {
        std::cout << ":(" << std::endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <algorithm>
#include <cstring>

int main(int argc, char *argv[])
{
    int n;
    std::vector<int> d;

    std::cin >> n;

    d.resize(n);
    for (int i = 0; i < n; i++) {
        std::cin >> d[i]; 
    }

    std::sort(d.begin(), d.end());

    int ans = d[n / 2] - d[n / 2 - 1];

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 640
import sys

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++


def count_al(al, vv):
	#'''
	#vvv以上を集めた場合、何要素選択されるか。
	#'''
	rui=0
	for v in al:
		r = get_ok_index(v, al, vv)
		rui += r
	return rui

def get_ok_index(v,al,ok_value):
	#'''
	#ok_value以上の要素数を返す。
	#'''
	if v+al[0] < ok_value:
		return 0
	if v + al[-1] >= ok_value:
		return len(al)
	ok=0
	ng=len(al)
	while ok + 1 < ng:
		#pa((ok,ng))
		m=(ok+ng)//2
		if v+al[m] >= ok_value:
			ok = m
		else:
			ng = m
		#pa((ok,ng))
	return ok+1
	

def main():
	n, m = IN()
	al = list(IN())
	al.sort(reverse=True)
	if m == n*n:
		ret= sum(al) * n * 2
	
	ruisekiwa=al[:]
	for i,v in enumerate(al[1:],1):
		ruisekiwa[i]=ruisekiwa[i-1]+v
	#pa(ruisekiwa)
		
	ok=al[0]*10
	ng=0
	
	while ok  > ng + 1:
		vv = (ok + ng)//2
		cc = count_al(al, vv)
		#pa(('ok,ng,vv,cc',ok,ng,vv,cc))
		if cc <= m:
			ok = vv
		else:
			ng = vv
	#pa(('ok',ok))
	
	ret=0
	for v in al:
		ok_id = get_ok_index(v, al, ok)-1
		#pa(ok_id)
		if ok_id==-1:
			continue
		ret += ruisekiwa[ok_id]+v*(ok_id+1)
	
	ret += (ok - 1)*(m-count_al(al,ok))
	print(ret)
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 54680
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		
		int n = int.Parse(Console.ReadLine());
		var a = Console.ReadLine().Split().Select(y => int.Parse(y)).ToArray();
		int counter = 0;
		for(int i=0;i!=n;i++){
			if(a[i]%2==0){
				if(a[i]%3!=0){
					if(a[i]%5!=0){
						counter++;
					}
				}
			}
		}
		if(counter==0){
			Console.WriteLine("APPROVED");
		}else{
			Console.WriteLine("DENIED");
		}
		
		
	}
}

Measured memory_bytes: 13396
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

template<typename T>
void p(T elem) {cout << elem << endl;}
template<typename T>
void ps(vector<T>& arr) { for(T e: arr) p(e); }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

#define BASE 13

int main(void) {
    string str;
    cin >> str;
    int len = str.length();
    vector<vector<int64_t>> dp(len+1, vector<int64_t>(BASE));
    dp[0][0] = 1;
    for(int i = 1; i <= len; i++) {
        char ch = str[i-1];
        for(int j = 0; j < 10; j++) {
            if(ch == '?' || ch == j+'0') {
                for(int k = 0; k < BASE; k++) {
                    int nnew = (k*10+j)%BASE;
                    dp[i][nnew] = (dp[i-1][k] + dp[i][nnew])%DIVISOR;
                }
            }
        }
    }
    cout << dp[len][5] << endl;
    return 0;
}

Measured memory_bytes: 16724
#include <iostream>
using namespace std;
#define mod 1000000007
int main() {
	// your code goes here
	int m,n;
	cin>>m>>n;
	char arr[1000][1000];
	for(int i=0;i<m;i++){
	    for(int j=0;j<n;j++){
	        cin>>arr[i][j];
	    }
	}
	
	long dp[1000][1000];
	int x=1;
	for(int i=0;i<n;i++){
	    if(arr[0][i]=='#'){
	        x=0;
	    }
	    dp[0][i]=x;
	}
	x=1;
	for(int i=0;i<m;i++){
	    if(arr[i][0]=='#'){
	        x=0;
	    }
	    dp[i][0]=x;
	}
	for(int i=1;i<m;i++){
	    for(int j=1;j<n;j++){
	        if(arr[i][j]!='#'){
	            long x=dp[i-1][j],y=dp[i][j-1];
	        dp[i][j]=(x%mod+y%mod)%mod;
	      // cout<<"i="<<i<<" "<<"j="<<j<<" "<<dp[i][j]<<endl;
	        }
	        else dp[i][j]=0;
	    }
	}
	cout<<dp[m-1][n-1]<<'\n';
	return 0;
}


Measured memory_bytes: 9088
n,ma,mb=map(int,input().split())
zen=[[10**10]*401 for i in range(401)]
kou=[[10**10]*401 for j in range(401)]
A=[ list(map(int,input().split())) for i in range(n//2)];a=len(A)
B=[ list(map(int,input().split())) for i in range(n-n//2)];b=len(B)
for bit in range(1<<a):
    now=[0,0,0]
    for i in range(a):
        if (bit>>i)&1:
            now[0]+=A[i][0]
            now[1]+=A[i][1]
            now[2]+=A[i][2]
    zen[now[0]][now[1]]=min(zen[now[0]][now[1]],now[2])
for bit in range(1<<b):
    now=[0,0,0]
    for i in range(b):
        if (bit>>i)&1:
            now[0]+=B[i][0]
            now[1]+=B[i][1]
            now[2]+=B[i][2]
    kou[now[0]][now[1]]=min(kou[now[0]][now[1]],now[2])


ans=10**10
for base in range(1,401):
    na=base*ma ; nb=base*mb 
    if max(na,nb)>400: break
    for i in range(na+1):
        for j in range(nb+1):
            ans=min(ans,zen[i][j]+ kou[na-i][nb-j])


print(ans if ans<10**6 else -1)

Measured memory_bytes: 70848
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <sstream>
#include <cassert>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <ctime>

using namespace std;

#define en '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 7;
const ll INFLL = 1e18;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int MAX_SIZE = 5e5;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

bool IS_ONE_TEST = 1;
ld START_TIME, TIME;

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

void solve() {
    int n;
    cin >> n;
    vector<string> kek = {"AC", "WA", "TLE", "RE"};
    map<string, int> mp;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        ++mp[s];
    }
    for (auto& i: kek) {
        cout << i << " x " << mp[i] << en;
    }
}

int main() {
    START_TIME = clock();
    fast_in_out();
    int TESTS = 1;
    if (!IS_ONE_TEST) cin >> TESTS;
    while (TESTS--) { solve(); }
#ifdef __APPLE__
    TIME = (clock() - START_TIME) / CLOCKS_PER_SEC;
    cerr << en << TIME * 1000 << " ms." << en;
#endif
    return 0;
}

/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */


Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  ll n,a[200010],s=0,ans=1e18,x;
  cin>>n;
  fr(i,n){
    cin>>a[i];
    s+=a[i];
  }
  x=0;
  fr(i,n-1){
    x+=a[i];
    ans=min(ans,abs(s-2*x));
  }
  cout<<ans<<endl;
}

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

int main(void) {
	int N; cin >> N;
	char s[N]; int i; bool flag = false;
	for (i = 0; i < N; i++) {
		cin >> s[i];
		if (s[i] == 'Y') { flag = true; }
	}

	if (flag) {
		cout << "Four" << endl;
	}
	else { cout << "Three" << endl; }

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			final int n = Integer.parseInt(reader.readLine());
			final int[] list = new int[n];
			for (int i = 0; i < n; i++) {
				list[i] = Integer.parseInt(reader.readLine());
			}
			reader.close();
			
			int count = 0;
			for (int num : list) {
				if (isPrime(num)) count++;
			}
			
			System.out.println(String.valueOf(count));
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	public static boolean isPrime(final int num) {
		boolean isPrime;
		
		if (num < 2) {
			isPrime = false;
			
		} else if (num == 2) {
			isPrime = true;
			
		} else if (num % 2 == 0) { 
			isPrime = false;
			
		} else {
			isPrime = true;
			
			final int end = (int)Math.pow(num, 0.5);
			for (int i = 3; i <= end; i += 2) {
				if (num % i == 0) {
					isPrime = false;
					break;
				}
			}
		}
		return isPrime;
	}
}

Measured memory_bytes: 22852
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        var nkq = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] score = new int[nkq[0]];
        for (int i = 0; i < nkq[2]; i++)
        {
            score[int.Parse(Console.ReadLine()) - 1]++;
        }
        for (int i = 0; i < nkq[0]; i++)
        {
            Console.WriteLine(nkq[1] <= nkq[2] - score[i] ? "No" : "Yes");
        }
    }
}


Measured memory_bytes: 17884
#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;
  
void f(int n) {
  for(int i = 1; i < 10; i++){
  	for(int j = 1; j < 10; j++){
    	if(i * j == n){
          cout << "Yes" << endl;
          return;
   		}	
    }
  }
  cout << "No" << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  f(n);
  return 0;
}

Measured memory_bytes: 3608
// ProblemURL : https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_b
// ---------------------------------------------
package main

import "fmt"

func main() {
	var n int
	var a, b, c string
	fmt.Scan(&n, &a, &b, &c)
	cost := 0
	for i := 0; i < n; i++ {
		if a[i] == b[i] && b[i] == c[i] {
		} else if a[i] == b[i] || b[i] == c[i] || c[i] == a[i] {
			cost += 1
		} else {
			cost += 2
		}
	}
	fmt.Println(cost)
}


Measured memory_bytes: 512
def _run(x):
    if 400 <= x <= 599:
        print(8)
    elif 600 <= x <= 799:
        print(7)
    elif 800 <= x <= 999:
        print(6)
    elif 1000 <= x <= 1199:
        print(5)
    elif 1200 <= x <= 1399:
        print(4)
    elif 1400 <= x <= 1599:
        print(3)
    elif 1600 <= x <= 1799:
        print(2)
    elif 1800 <= x <= 1999:
        print(1)


def _main():
    X = int(input())
    _run(X)


if __name__ == "__main__":
    _main()


Measured memory_bytes: 9184
use std::io::*;

fn read_spc<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    libra();
}

fn libra() {
    let abcd: Vec<i64> = read_spc();
    let ab = abcd[0] + abcd[1];
    let cd = abcd[2] + abcd[3];
    if ab > cd {
        println!("Left");
    } else if ab == cd {
        println!("Balanced");
    } else {
        println!("Right");
    }
}

Measured memory_bytes: 4352
#include <stdio.h>

void eratos(int* is_Prime, int max){
	is_Prime[0] = is_Prime[1] = 0;
	int i,j;
	for(i=2; i<max; i++){
		is_Prime[i] = 1;
	}
	for(i=4; i<max; i+=2)
		is_Prime[i] = 0;
	for(i=3; i*i<max; i+=2){
		if(is_Prime[i])
			for(j=2*i; j<max; j+=i)
				is_Prime[j] = 0;
	}
}

int main(){
	const int max = 300000;
	int is_Prime[max];
	int i,n,ans;
	
	eratos(is_Prime, max);
	
	while(1){
		scanf("%d", &n);
		if(!n)
			break;
		ans = 0;
		for(i=n+1; i<=2*n; i++){
			if(is_Prime[i])
				ans++;
		}
		printf("%d\n", ans);
	}
	
	return 0;
}

Measured memory_bytes: 0
n = int(input())
d = [[] for i in range(n)]
for i in range(n-1):
    u,v,w = map(int,input().split())
    d[u-1].append([v-1,w])
    d[v-1].append([u-1,w])

ans = [[] for i in range(n)]
ans[0].append(0)
q = [0]

while q:
    x = q.pop()
    for u,w in d[x]:
        if not ans[u]:
            buf = ans[x][0]
            if w%2==1:
                buf = (buf+1)%2
            ans[u].append(buf)
            q.append(u)

for i in ans:
    print(*i)


Measured memory_bytes: 55304
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

template <typename T>
void printArr(const T * arr, int s, int fn) {
    for (int i = s; i <= fn; ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <typename T>
long long minArr(const T * arr, int s, int fn) {
    ll res = 1e16 + 1;
    for (int i = s; i <= fn; ++ i) {
        res = min(res, arr[i]);
    }
    return res;
}

template <typename T>
void printVec(const T * arr) {
    for (int i = 0; i < sz(arr); ++ i) cout << arr[i] << " ";
    cout << '\n';
}

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

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

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

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

ll ans = 1;

int cnt[N];

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

    for (int i = 0; i < sz(s); ++ i) {
        ans += i;
        ans -= cnt[s[i] - 'a']++;
    }

    cout << ans;
	
    //eprintf("%.18lf seconds\n", (double)clock() / CLOCKS_PER_SEC);

    return 0;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1000010
// (k-1,i-1)*( (r-1,i-2) + 2*(r-1,i-1) + (r-1,i) )
// (r,i-1)+ (r,i) = (r+1,i)
// f(i)   = (n-k+1,i)*(k-1,i-1)
// f(i-1) = (n-k+1,i-1)*(k-1,i-2)
// f(i)/f(i-1) = (n-k+1-i+1)/i *(k-1-i+2)/(i-1)
// 
ll f(ll a,ll b){
	ll ans=1;a%=md;
	while(b){
		if(b&1)ans=(ans*a)%md;
		a=(a*a)%md,b/=2;
	}
	return ans;
}
int main(){
	IOS;
	ll n,k;cin>>n>>k;
	ll ans=(n-k+1);
	cout<<ans<<"\n";
	rep(i,2,k+1){
		ll p=(i*(i-1))%md;
		ans=(ans*((n-k-i+2)*(k-i+1))%md*(f(p,md-2))%md)%md;
		cout<<(ans+md)%md<<"\n";
	}
	
	
	return 0;
}



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

int main() {
  	int N, ans;
    cin >> N;
    ans = 0;
    for (int i=0; i<N; i++){
    	int a, b;
    	cin >> a >> b;
    	ans += b-a+1;
    }
	cout << ans <<endl;
}




Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main() {
	char c;
	int countA = 0, countB = 0;
	for (int i = 0; i < 3; ++i) {
		scanf("%c", &c);
		if (c == 'A') {
			++countA;
		}
		if (c == 'B') {
			++countB;
		}
	}
	if (countA == 0 || countB == 0) {
		printf("No");
	}
	else {
		printf("Yes");
	}
		
	return 0;
}


Measured memory_bytes: 128
#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 20

int main() {
	char sInput[MAX_STRING+1]="";
	char* psInput;

	int nTargetNumber=0;
	int nTotalBillCount=0;
	int nTenBillCount=-1;
	int nFiveBillCount=-1;
	int nOneBillCount=-1;
	int nTenBillTemp=0;
	int nFiveBillTemp=0;
	int nOneBillTemp=0;

	int nFailed=0;
	int nSuccess=0;
	int nFirstLoop=1;
	int nTenDigitReset=1;
	int nFiveDigitReset=0;
	int nNextTen=0;
	int nNextFive=0;
	int nFivePlusOne=0;

	gets(sInput);
	psInput=strtok(sInput," ");
	nTotalBillCount=atoi(psInput);
	psInput=strtok(NULL," ");
	nTargetNumber=atoi(psInput);

	if (nTotalBillCount * 10000 < nTargetNumber) {
		// 全て万札でも目標金額に届かない
		nFailed=1;
/*	} else if (nTotalBillCount * 10000 == nTargetNumber) {
		// 全て万札だとすると条件を満たす
		nSuccess=1;
	    nTenBillCount=nTotalBillCount;
	    nFiveBillCount=0;
	    nOneBillCount=0;
	} else if (nTotalBillCount * 5000 == nTargetNumber) {
		// 全て五千円だとすると条件を満たす
		nSuccess=1;
	    nTenBillCount=0;
	    nFiveBillCount=nTotalBillCount;
	    nOneBillCount=0;
	} else if (nTotalBillCount * 1000 == nTargetNumber) {
		// 全て千円だとすると条件を満たす
		nSuccess=1;
	    nTenBillCount=0;
	    nFiveBillCount=0;
	    nOneBillCount=nTotalBillCount; */
	} else if (nTotalBillCount * 1000 > nTargetNumber) {
		// 全て千円にしても目標金額をオーバーしてしまう
		nFailed=1;
	} 
	nNextTen=nTotalBillCount;
	while(nFailed==0 && nSuccess==0){
		if (nTenDigitReset==1){
			nTenBillTemp=nNextTen;
			nFiveBillTemp=0;
			nOneBillTemp=nTotalBillCount-nTenBillTemp;
			nNextTen--;
			nTenDigitReset=0;
		} else {
			nOneBillTemp--;
			nFiveBillTemp++;
		}

		if (nOneBillTemp*1000+nFiveBillTemp*5000+nTenBillTemp*10000==nTargetNumber){
			nSuccess=1;
			nTenBillCount=nTenBillTemp;
			nFiveBillCount=nFiveBillTemp;
			nOneBillCount=nOneBillTemp;
			break;
		}

		if(nOneBillTemp==0){
			if (nTenBillTemp==0){
				//全探査終了
				nFailed=1;
			} else {
				nTenDigitReset=1;
			}
		}
//		printf("%d %d %d\n",nTenBillTemp,nFiveBillTemp,nOneBillTemp);
	}

	printf("%d %d %d\n",nTenBillCount,nFiveBillCount,nOneBillCount);

    return 0;
}


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

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

  int A;
  cin >> A;
  int min = 0;
  while (A % 2 == 0) {
    A = A / 2;
    min++;
  }

  for (int i = 1; i < N; i++) {
    int B;
    cin >> B;

    int b_min = 0;
    while (B % 2 == 0) {
      B = B / 2;
      b_min++;
    }
    if (b_min < min) {
      min = b_min;
    }
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
///-----Bismillahir Rahmanir Rahim-----///

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

///---FAST I/O---///
#define Boost() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///---DATA TYPE---///
typedef long long ll;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

///---LOOP---///
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)

///---I/O---///
#define sf scanf
#define pf printf

///---OTHERS---///
#define pb push_back
#define all(c)		c.begin(),c.end()
#define MK make_pair
#define F first
#define S second
#define endl '\n'


///---INITIALIZATION---//
#define mem(a,b) memset(a, b, sizeof(a) )

///---CALCULATE---///
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

///---BIT OPERATION---///
inline bool checkBit(ll n, int i)
{
    return n&(1LL<<i);
}
inline ll setBit(ll n, int i)
{
    return n|(1LL<<i);;
}
inline ll resetBit(ll n, int i)
{
    return n&(~(1LL<<i));
}

///------String/Char Related Functions-----///
string makeintString(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
string makellString(ll x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
char cpp(char c)
{
    return static_cast<char>(c + 1);
}

///------------Sorting STL----------///
struct func
{
	//this is a sample overloading function for sorting stl
	bool operator()(pii const &a, pii const &b)
	{
		if(a.F==b.F)
			return (a.S<b.S);
		return (a.F<b.F);
	}
};

///---CONSTANT---///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

int main()
{
    Boost();

    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      if(n%1000==0) cout<<0<<endl;
      else cout<<1000-(n%1000)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3624
/**
 * @Author:      H S-J
 * @DateTime:    2017-11-11 20:23:00
 * @Description: 
 */
#include <bits/stdc++.h>
using namespace std;
#define MST(a, b) memset(a, b, sizeof(a));
#define CLR(a) MST(a, 0);
#define DBG(x) cout << '#' << " = " << (x) << endl;
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define lson(x) (x) << 1
#define rson(x) (x) << 1|1
#define pb push_back
#define rep(x, y, z) for (int x = y; x < z; ++x)
#define ech(x, y, z) for (auto x = z.begin(), y = z.end(); x != y; ++x)
#define lowbit(x) (x & (-x))
#define opr operator
#define _st first
#define _nd second
#define prior_q1(x) priority_queue<x>
#define prior_q2(x) priority_queue<x, vector<x>, greater<x> >
typedef long long LL;
typedef stringstream strstm;
struct FastIO {
    static const int S = 1310720;
    int wpos;
    char wbuf[S];
    FastIO() : wpos(0) {}
    inline int xchar() {
        static char buf[S];
        static int len = 0, pos = 0;
        if (pos == len)
            pos = 0, len = fread(buf, 1, S, stdin);
        if (pos == len) return -1;
        return buf[pos ++];
    }
    inline int xuint() {
        int c = xchar(), x = 0;
        while (c <= 32) c = xchar();
        for (; '0' <= c && c <= '9'; c = xchar()) x = x * 10 + c - '0';
        return x;
    }
    inline int xint() {
        int s = 1, c = xchar(), x = 0;
        while (c <= 32) c = xchar();
        if (c == '-') s = -1, c = xchar();
        for (; '0' <= c && c <= '9'; c = xchar()) x = x * 10 + c - '0';
        return x * s;
    }
    inline LL xlongint() {
        LL s = 1, c = xchar(), x = 0;
        while (c <= 32) c = xchar();
        if (c == '-') s = -1, c = xchar();
        for (; '0' <= c && c <= '9'; c = xchar()) x = x * 10 + c - '0';
        return x * s;
    }
    inline void xstring(char *s) {
        int c = xchar();
        while (c <= 32) c = xchar();
        for (; c> 32; c = xchar()) * s++ = c;
        *s = 0;
    }
    inline void wchar(int x) {
        if (wpos == S) fwrite(wbuf, 1, S, stdout), wpos = 0;
        wbuf[wpos ++] = x;
    }
    inline void wint(LL x) {
        if (x < 0) wchar('-'), x = -x;
        char s[24];
        int n = 0;
        while (x || !n) s[n ++] = '0' + x % 10, x /= 10;
        while (n--) wchar(s[n]);
    }
    inline void wstring(const char *s) {
        while (*s) wchar(*s++);
    }
    ~FastIO() {
        if (wpos) fwrite(wbuf, 1, wpos, stdout), wpos = 0;
    }
} io;
int main(int argc, char const *argv[]) {
	ios::sync_with_stdio(0);cin.tie(0);
    int n, m;
    cin >> n >> m;
    cout << (1900*m + 100*(n-m))*(1<<m) << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
# input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
import fractions
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15

def getyaku(n):
    res = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            res.append(i)
            res.append(n // i)

    return(sorted(list(set(res))))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def main():
    n,m = getlist()
    arr = getyaku(m)
    for num in arr:
        if num >= n:
            print(m//num)
            return
    print(1)
    # print(arr)
    return

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

Measured memory_bytes: 64364
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, T b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, T b){
    if (b < a){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
   
// g++ -std=c++11 prac.cpp
ll Max=-1e9,Min=1e9+1;

int main(){
    int a,b,d,x,y=0,z,m,k,w,l_sum=0,r_sum=0,ans=0;
    string t;
    bool count=true,ok=true;
    cin >> a >> b;
    if(a+b==15){
        cout << '+' << endl;    
    }
    else if (a*b==15){
        cout << '*' << endl;
    }
    else{
         cout << 'x' << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int num[1001] = {0};
	int i , n , m , mc , nc , ans;
	while(1){
		scanf("%d %d" , &n , &m);
		if(n==0&&m==0) break;
		for(i=1;i<1001;i++){
			if(i<=n) num[i] = 1;
			else num[i] = 0;
		}
		i = 1;
		mc = 0;
		nc = 0;
		while(1){
			if(num[i]==1){
				mc++;
				if(mc % m == 0){
					num[i] = 0;
					nc++;
					if(nc == n){
						ans = i;
						break;
					}
				}
				i++;
				if(i > n) i = 1;
			}else{
				i++;
				if(i > n) i = 1;
			}
		}
		printf("%d\n" , ans);
	}
return 0;
}

Measured memory_bytes: 0
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n , a[N] , b[N] ;

int main ( ){
scanf("%d",&n);
for ( int i = 1;  i <= n; i++ ) scanf("%d",a+i);
for ( int i = 1;  i <= n; i++ ) scanf("%d",b+i);
ll A = 0 , B = 0 ;
for  ( int i = 1;  i <= n; i++ ){
    if ( a[i] > b[i] ){
        B += a[i]-b[i] ;
    }
    if ( a[i] < b[i] ){
            if ( ((b[i]&1) && !(a[i]&1) ) || (!(b[i]&1) && (a[i]&1) ) ) B++;
        A += ((b[i]-a[i])+1)/2;
    }
}
if ( A >= B ) printf("Yes");
else printf("No");
return 0 ;
}


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

int main(void)
{
    char s[200], p[100], t[100];
    scanf("%s %s", s, p);
    strcpy(t, s);
    int l = strlen(p);
    t[l] = '\0';
    strcat(s, t);
    
    if(strstr(s, p)) printf("Yes\n");
    else printf("No\n");
    
    
    return 0;
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Graph vector<vector<long long>>
#define all(v) v.begin(),v.end()
#define PI acos(-1)
#define inf 5000000321
#define mod107 1000000007;

class UnionFind {
   // まとめる 判定 サイズを知る
  public:
   // Aから見た親の番号を格納する。rootだったら-1*その集合のサイズ。
   vector<int> Parent;
 
   // 初期化
   UnionFind(int N) {
     Parent = vector<int>(N, -1);
   }
 
   // Aのrootを調べる
   int root(int A) {
     if (Parent[A] < 0) return A;  // マイナスならそれはroot
     return Parent[A] = root(Parent[A]);
   }
 
   // rootの値をプラスに戻して返す(サイズ)
   int size(int A) {
     return -Parent[root(A)];
   }
 
   // くっつける関数
   bool connect(int A, int B) {
     // AとBのroot同士をくっつける
     A = root(A);  // ここのAは、"rootの場所"の意味
     B = root(B);
     if (A == B) return false;  // 既にくっついている
     if (size(A) < size(B))
       swap(A, B);            // 大きい方にくっつけるために中身交換
     Parent[A] += Parent[B];  // 中身更新
     Parent[B] = A;
     return true;
   }
 };
int main(){
    int N,M;
    cin >> N >> M;
    UnionFind tree(N);
    for(int i =0;i < M;i++){
        int a,b;
        cin >> a >> b;
        a--,b--;
        tree.connect(a,b);
    }
    int cnt = 0;
    for(int i =0;i < N;i++){
        if(tree.connect(0,i) == true){
            tree.connect(0,i);
            cnt++;
        }
    }
    cout << cnt << endl;
}

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

struct Node {
    int at;
    double cost; 
    int prev;
    Node(int at, double cost, int prev) : at(at), cost(cost), prev(prev) {}
    bool operator>(const Node &s) const {
        if (cost != s.cost) return cost > s.cost;
        if (prev != s.prev) return prev > s.prev; //最短経路を辞書順最小にする(省略可)
        return at > s.at;
    }
};

struct Edge {
  int to;
  double cost;  
  Edge(int to, double cost) : to(to), cost(cost) {}  
};

typedef vector<vector<Edge> > AdjList; //隣接リスト

const double INF = 1e20;
const int NONE = -1;

AdjList graph;

//sは始点、mincは最短経路のコスト、Prevは最短経路をたどる際の前の頂点
void dijkstra(int s, vector<double> &minc, vector<int> &Prev){ 
    priority_queue<Node, vector<Node>, greater<Node> > pq;
    pq.push(Node(s, 0, NONE));
    while(!pq.empty()) {
        Node x = pq.top();
        pq.pop();
        if (minc[x.at] != INF) continue;
        minc[x.at] = x.cost;
        Prev[x.at] = x.prev;
        for(int i = 0; i < (int)graph[x.at].size(); i++) {
        	Edge e = graph[x.at][i];
            if (minc[e.to] == INF) {
            	pq.push(Node(e.to, x.cost + e.cost, x.at));
            }
        }
    }
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	double xs, ys, xt, yt;
	int n;
	cin >> xs >> ys >> xt >> yt >> n;
	vector<double> x(n), y(n), r(n);
	graph = AdjList(n + 2);
	double cost;
	cost = sqrt((xs - xt) * (xs - xt) + (ys - yt) * (ys - yt));
	graph[n].emplace_back(n + 1, cost);
	graph[n + 1].emplace_back(n, cost);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> r[i];
		cost = max(0.0, sqrt((xs - x[i]) * (xs - x[i]) + (ys - y[i]) * (ys - y[i])) - r[i]);
		graph[i].emplace_back(n, cost);
		graph[n].emplace_back(i, cost);
		cost = max(0.0, sqrt((xt - x[i]) * (xt - x[i]) + (yt - y[i]) * (yt - y[i])) - r[i]);
		graph[i].emplace_back(n + 1, cost);
		graph[n + 1].emplace_back(i, cost);
	}

	for (int i = 1; i < n; i++) {
		for (int j = 0; j < i; j++) {
			cost = max(0.0, sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])) - r[i] - r[j]);
			graph[i].emplace_back(j, cost);
			graph[j].emplace_back(i, cost);
		}
	}

	vector<double> minc(n + 2, INF);
	vector<int> Prev(n + 2, NONE);

	dijkstra(n, minc, Prev);
	cout << fixed << setprecision(15) << minc[n + 1] << endl;
	return 0;
}


Measured memory_bytes: 30712
import java.util.Scanner;

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

    int count = 0;
    for (int i = 0; i < s.length(); i++) {
      if (s.charAt(i) != s.charAt(s.length()-1-i)) {
        count++;
      }
      if (s.length() -i - i < 3) {
        break;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 21844