akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
class Program
{
	//static long[,] dp;
	//static	Dictionary<string, long> dp;
	//static int[] weight, value;
    //static List<string> str = new List<string>();
	static void Main(string[] args)
	{
		// 入力フェーズ
		int N = Int32.Parse(Console.ReadLine());
		string[] input = Console.ReadLine().Split(' '); // H...
		//int A = Int32.Parse(input[0]);
		//int B = Int32.Parse(input[1]);
		//int C = Int32.Parse(input[2]);
		/*weight = new int[N];
		value = new int[N]; // 重さと価値の入力値
		for(int i=0; i<N; i++){
			string[] items = Console.ReadLine().Split(' ');
			weight[i] = Int32.Parse(items[0]);
			value[i] = Int32.Parse(items[1]);
		}*/
//Console.WriteLine(weight[0] + "");
bool ret = true;
		// 右端から見ていって、左隣のマスを一つ低くするorしないで進めていく
		for(int i=N - 1; i>0; i--)
		{
			// iの桁数が奇数かどうかを調べる
			int height = Int32.Parse(input[i]);
			//左隣のマスの高さ
			int leftH = Int32.Parse(input[i-1]);
			//Console.WriteLine(height + " left:" + leftH);
			if(height < leftH - 1)
			{
				ret = false;
				break;
			}
			else if(height == leftH - 1)
			{
				// 左の高さを１低くする
				leftH -= 1;
				input[i-1] = leftH.ToString();
			}
		}

		if(ret)
		{
			Console.WriteLine("Yes");
		}
		else
		{
			Console.WriteLine("No");
		}

    }
}


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

#define rep(i, n)     for(int i = 0;      i < int(n); ++i)
#define rep3(i, a, b) for(int i = int(a); i < int(b); ++i)
#define all(x)        (x).begin(),(x).end()
#define sz(x)         int(x.size())
#define mp            make_pair
#define pb            push_back


typedef long long ll;

using namespace std;

int gcd(int x, int y){
  int tmp;
  while(y != 0){
    tmp = y;
    y = x % y;
    x = tmp;
  }
  return x;
}

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

  vector<int> X(N+1);
  X[0] = x;

  rep(i, N){
    cin >> X[i+1];
  }

  sort(all(X));

  vector<int> diff;
  rep(i, N){
    diff.pb(X[i+1] - X[i]);
  }

  sort(all(diff));

  int common = diff[0];
  rep3(i, 1, N){
    common = gcd(common, diff[i]);
  }

  cout << common << endl;

  return 0;
}



Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  int x;
  cin >> x;
  if(x==0) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define alpha_size 26

const int N = 30 + 1;
int n, m;
int f[N];

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);    
     
    cin >> n >> m;
    for (int i = 1; i <= n; i++){
      int k;
      cin >> k;
      for (int j = 0; j < k; j++){
        int x;
        cin >> x;
        f[x]++;
      }
    }
    int ret = 0;
    for (int i = 1; i <= m; i++){
      if (f[i] == n){
        ret++;
      }
    }
    cout << ret << endl;
}

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

int main(){
    int r;cin>>r;
    cout<<3*r*r<<endl;
    return 0;
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
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;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}



int main(){
    int n;
    cin >> n;
    int a[n];
    int ans = 0;
    rep(i,n) cin >> a[i];
    for(int i=0;i<n;i++){
        while(a[i]%2==0){
            ans++;
            a[i]/=2;
        }
    }
    cout << ans << endl;
}

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

int findSum(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int total = 0;
  for (int i = 1; i <= N; ++i) {
    int sum = findSum(i);
    if (sum >= A && sum <= B) { 
      total += i;
    }
  }
  cout << total << endl;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  map<long long, long long> mp;
  long long sum = 0;
  long long ans = 0;
  mp[0] = 0;
  for(int i = 1; i <= N; i++) {
    long long d;
    cin >> d;
    sum += d;
    if(mp.count(sum)) ans = max(ans, i-mp[sum]);
    else mp[sum] = i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15544
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;
int main() {
	int N;	cin >> N;
	vector<int> d(N);
	int ans = 1;
	for (int i = 0; i < N; ++i) {
		cin >> d[i];
	}
	sort(d.rbegin(), d.rend());
	for (int i = 0; i < N - 1; ++i) {
		if (d[i] > d[i + 1]) {
			++ans;
		}
	}
	cout << ans << endl;
	cin >> N;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cctype>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    REP(i, N) cin >> S[i];
    
    vector<vector<int>> cnt(N, vector<int>(26, 0));
    REP(i, N) {
        for (char c : S[i]) ++cnt[i][c - 'a'];
    }
    string ans;
    REP(i, 26) {
        int k = 100;
        REP(j, N) k = min(k, cnt[j][i]);
        REP(j, k) ans.push_back('a' + i);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) (a).begin(), (a).end()
#define pw(x) (1ll<<(x))
#define lb(x) ((x) & -(x))
#define endl "\n"
#define FI(x) freopen(#x".in","r",stdin)
#define FO(x) freopen(#x".out","w",stdout)
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
//typedef uniform_int_distribution<ll> RR;
const int P = 1e9 + 7;
//ll rnd(ll l, ll r) { mt19937 gen(rand()); RR dis(l, r); return dis(gen); }
int add(int a, int b) {if((a += b) >= P) a -= P; return a < 0 ? a + P : a;}
int mul(int a, int b) {return 1ll * a * b % P;}
int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----

const int N = 1e5 + 7;
int cnt[N], may[N], n, m, ans, u, v; 

int main() {
	//FI(a);
	ios::sync_with_stdio(0);
	cin.tie(0);
	//cout << setiosflags(ios::fixed);
	//cout << setprecision(2);
	cin >> n >> m;
	rep(i, 1, n+1) cnt[i] = 1;
	may[1] = 1;
	rep(i, 1, m+1) {
		cin >> u >> v;
		cnt[u]--;
		cnt[v]++;
		if (may[u]) may[v] = 1;
		if (cnt[u] == 0) may[u] = 0;
	}
	rep(i, 1, n+1) ans += may[i];
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1024
n = int(input())
ta = list(map(int,input().split()))
h = list(map(int,input().split()))
temp = []
for i in h:
  temp = temp + [ta[0] - i * 0.006]
sa = ta[1]-temp[0]
if (sa < 0):
  sa *= -1
loop = 1
ans = 1
for i in temp:
  j = ta[1]-i
  if (j<0):
    j *= -1
  if (j < sa):
    ans = loop
    sa = j
  loop += 1
  
print(ans)

Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    int n;
    cin>>n;
    map < int , int > M;
    while (n --)
    {
        int v;
        cin>>v;
        ++M[v];
    }
    int ans = 0;
    for (auto it : M)
        if (it.se >= it.fi)
            ans += it.se - it.fi;
        else
            ans += it.se;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4736
import java.util.Scanner;

fun main (args : Array<String>) {
  val input = Scanner(System.`in`)
  
  while (input.hasNext()) {
    val K = input.nextInt()
    val X = input.nextInt()
    
    if (K * 500 >= X) {
      println("Yes")
    } else {
      println("No")
    }
  }
}

Measured memory_bytes: 36364
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>

#define MOD 1000000007
#define ll long long

using namespace std;

ll N,M;// N人 , Mスポーツ
ll A[301][301]={0};   //A[人][スポーツ]
vector<ll> choice(1,0);
ll people[301]={0};//実施するそれぞれのスポーツに集まる人数
vector<ll> result; //それぞれの場合の最大参加人数


void ope(){
  ll ninki,ninzu=0;
  
  //実施するスポーツよりそれぞれのスポーツに参加する人数を計算
  for(ll i = 0;i<301;i++) people[i] =0;//参加人数更新

  for(ll i =1;i<= N;i++){
    for (ll j = 1;j<= 301;j++){
      vector<ll>::iterator cIter = find(choice.begin(),choice.end(),A[i][j]);
      if(cIter != choice.end() ){
	people[A[i][j]]++;
	break;
      }
   
    }
  }
  
  //一番人気なスポーツの参加人数をresultに保存
  for(ll i =0;i<301;i++){
    if(people[i]>ninzu){
      ninzu = people[i];
      ninki = i;//一番人気なスポーツ
    }
  }
  result.push_back(ninzu);
  
  //一番人気なスポーツを消去し、M--
  //この時choice.size() = M+1は絶対
  for(ll i =0;i<choice.size();i++){
    if(choice[i]==ninki){
      swap(choice[i], choice[M]);
      choice.pop_back();
      break;
    }
  }
  M--;
}

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

  cin >> N >> M;
  for(ll i =1;i<=N;i++){
    for(ll j =1; j<=M ;j++){
      cin >> A[i][j];
    }
  }

  for(ll i =1;i<=M;i++){
    choice.push_back(i);
  }

  do{
    ope();
  }while(M>1);

  sort(result.begin(),result.end());

  cout << result[0] <<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2") 
#pragma GCC optimization ("unroll-loops")

using namespace std;
using ll = long long;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ff first
#define ss second
#define Ceil(x, y) ((x+y-1)/y)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x);
const int mod = (int) 1000000007;


void solve()
{
	int n;
	cin>>n;
	vector<int> x(n), y(n);
	for(int i=0; i<n; i++)
		cin>>x[i]>>y[i];
	int min1=INT_MAX, max1=INT_MIN, min2=INT_MAX, max2=INT_MIN;
	for(int i=0; i<n; i++)
	{
		min1 = min(min1, x[i]+y[i]);
		max1 = max(max1, x[i]+y[i]);
		min2 = min(min2, x[i]-y[i]);
		max2 = max(max2, x[i]-y[i]);
	}
	cout<<max({max1-min1, abs(max2-min2)})<<endl;

}

int main(int argc, char *argv[])
{
	clock_t clk_start = clock();
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
 
	int cases = 1;
	// cin>>cases;
	for(int i=1; i<=cases; i++)
	{
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	cerr<<"Execution Time: "<<fixed<<double(clock() - clk_start)/double(CLOCKS_PER_SEC)<<setprecision(6)<<" sec\n"; 
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

template<long long mod>
class modint{
private:
  long long num;
  long long extgcd(long long a, long long b, long long&x, long long&y)const {
    long long d = a;
    if(b != 0){d = extgcd(b, a%b, y, x);  y -= (a/b) * x;}
    else{x = 1; y = 0;}
    return d;
  }
  long long modinverse()const{
    long long x, y;
    extgcd(num, mod, x, y);
    return (mod + x%mod)%mod;
  }
public:
  modint():num(0){}
  modint(const long long x):num((x < 0?(x+mod):x)%mod ){}
  friend modint operator+(const modint&a, const modint&b)
  {    return modint(a.num + b.num);  }
  friend modint operator-(const modint&a, const modint&b)
  {    return modint(a.num - b.num);  }
  friend modint operator*(const modint&a, const modint&b)
  {    return modint(a.num * b.num);  }
  friend modint operator/(const modint&a, const modint&b)
  {    return modint(a*b.modinverse());  }
  modint& operator+=(const modint&b)
  {    return (*this) = (*this) + b;  }
  modint& operator-=(const modint&b)
  {    return (*this) = (*this) - b;  }
  modint& operator*=(const modint&b)
  {    return (*this) = (*this) * b;  }
  modint& operator/=(const modint&b)
  {    return (*this) = (*this) / b;  }
  modint& operator++()
  {    (*this)+=1; return (*this);  }
  modint& operator--()
  {    (*this)-=1; return (*this);  }
  modint operator++(int){
    modint tmp(*this);
    ++(*this);
    return tmp;
  }
  modint operator--(int){
    modint tmp(*this);
    --(*this);
    return tmp;
  }    
  modint pow(unsigned long long i){
    if(i == 0) return 1;
    if(i & 1){
      return (*this) * (this->pow(i-1));
    }
    modint<mod>hpow = (this->pow(i>>1));
    return hpow * hpow;
  }
  friend ostream& operator<<(ostream&os, const modint&a){
    os << a.num;
    return os;
  }
  friend istream& operator>>(istream&is, modint&a){
    long long x; is >> x;
    a = x;
    return is;
  }
};

constexpr int mod = 1000000007;

using mint = modint<mod>;

int main(){
  int n; cin >> n;
  cout << (mint(10).pow(n)-mint(9).pow(n))*2-(mint(10).pow(n)-mint(8).pow(n)) << endl;
  return 0;
}


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

int val[2][2000] = {};
int dp_max[2][2001][2001] = {};
int dp_min[2][2001][2001] = {};

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

    for (int i = 0; i < s.size(); i++) {
        char c = s[i];
        if (c == 'U') val[0][i] = 1;
        else if (c == 'D') val[0][i] = -1;
        else if (c == 'L') val[1][i] = 1;
        else val[1][i] = -1;
    }

    int len = s.size();
    for (int i = 0; i < len; i++) {
        int sign = 1;
        for (int k = 0; k <= K; k++, sign *= -1) {
            for (int type = 0; type < 2; type++) {
                int v = val[type][i] * sign;
                if (i > 0) {
                    dp_max[type][i][k] = dp_max[type][i-1][k];
                    dp_min[type][i][k] = dp_min[type][i-1][k];
                    if (k > 0) {
                        dp_max[type][i][k] = max(dp_max[type][i][k], dp_max[type][i-1][k-1]);
                        dp_min[type][i][k] = min(dp_min[type][i][k], dp_min[type][i-1][k-1]);
                    }
                }
                dp_max[type][i][k] += v;
                dp_min[type][i][k] += v;
            }
        }
    }

    if(false) {
    cout << "dp_max" << endl;
    for (int type = 0; type < 2; type++) {
        cout << (type == 0 ? "UD" : "RL") << endl;
        for (int i = 0; i < len; i++) {
            cout << val[type][i] << ": ";
            for (int k = 0; k <= K; k++) {
                cout << dp_max[type][i][k] << " ";
            }
            cout << endl;
        }
        cout << endl;
    }
    cout << "dp_min" << endl;
    for (int type = 0; type < 2; type++) {
        cout << (type == 0 ? "UD" : "RL") << endl;
        for (int i = 0; i < len; i++) {
            cout << val[type][i] << ": ";
            for (int k = 0; k <= K; k++) {
                cout << dp_max[type][i][k] << " ";
            }
            cout << endl;
        }
        cout << endl;
    }
    }

    int ans = 0;
    for (int k_limit = 0; k_limit <= K; k_limit++) {
        int lr = 0, ud = 0;
        for (int i = 0; i <= k_limit; i++) {
            ud = max(ud, abs(dp_max[0][len-1][i]));
            ud = max(ud, abs(dp_min[0][len-1][i]));
        }
        for (int i = 0; i <= K-k_limit; i++) {
            lr = max(lr, abs(dp_max[1][len-1][i]));
            lr = max(lr, abs(dp_min[1][len-1][i]));
        }
        ans = max(ans, lr + ud);
    }
    cout << ans << endl;
}


Measured memory_bytes: 65728
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	char s[103],t[103];
	char stack[207];
	scanf("%s",s);
	scanf("%s",t);

	for (int i = 0; i < 207; ++i)	stack[i] = s[i % strlen(s)];
	if(strstr(stack,t) != NULL)	puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	unsigned int n;
	scanf("%u", &n);

	int grid[15][15];
	for (unsigned int i = 0; i < n; i++) {
		for (unsigned int j = 0; j < n; j++)
			grid[i][j] = -1;

		unsigned int cnt;
		scanf("%u", &cnt);

		for (unsigned int j = 0; j < cnt; j++) {
			int x, y;
			scanf("%d%d", &x, &y);
			grid[i][x-1] = y;
		}
	}

	int max = 0;
	for (unsigned int try = 1; try < (1u<<n); try++) {
		int sat = 1;

		for (unsigned int i = 0; i < n; i++) {
			if ((try & (1u<<i)) != (1u<<i))
				continue;

			for (unsigned int j = 0; j < n; j++) {
				if (grid[i][j] != -1 &&
						(try&(1u<<j)) != (grid[i][j]<<j))
					sat = 0;
			}
		}

		if (sat && __builtin_popcount(try) > max)
			max = __builtin_popcount(try);
	}

	printf("%d\n", max);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int main(){
    int k;
    cin >> k;
    rep(i, k){
        cout << "ACL";
    }
    cout << endl;

    return 0;
}


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

inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
// const int INF = 0x3f3f3f3f;
//###################################################################
const int N=109;
int val[N],w[N];
int n,W;
ll mem[100][100009];
ll solve(int ind,int rem){
    if(rem<=0) return 0;
    if(ind==n)return 0;
    if(mem[ind][rem]!=-1)return mem[ind][rem];
    if(rem>=w[ind]){
        return mem[ind][rem]=max(1ll*val[ind]+solve(ind+1,rem-w[ind]),solve(ind+1,rem));
    }else{
        return mem[ind][rem]= solve(ind+1,rem);
    }
}
int main(){
    n=D(),W=D();
    for(int i=0;i<n;i++){
        w[i]=D(),val[i]=D();
    }
    memset(mem,-1,sizeof(mem));
    cout<<solve(0,W);

}

Measured memory_bytes: 81808
// D - Wizard in Maze
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)

// ダイクストラ　O(ElogV)
using PR = pair<int, int>;
#define INF 1'000'000'000
vector<vector<PR>> G; // [from]<to, cost> 隣接リスト
int V; // 頂点数(max:10^3*10^3=10^6)

vi dijkstra(int s){
	vi dist(V, INF);
	dist[s] = 0;
	priority_queue<PR, vector<PR>, greater<PR>> pq; // <dist, u>
	pq.push({0, s});
	while(pq.size()){
		int d, u; tie(d, u) = pq.top(); pq.pop();
		if(dist[u] < d) continue;
		for(auto e:G[u]){
			int v = e.first, next_d = e.second + dist[u];
			if(dist[v] <= next_d) continue;
			dist[v] = next_d;
			pq.push({dist[v], v});
		}
	}
	return dist;
}

PR dhw[] = { // <h, w>
        { 1, 0},
{ 0,-1},        { 0, 1},
        {-1, 0},
{ 2,-2},{ 2,-1},{ 2, 0},{ 2, 1},{ 2, 2},
{ 1,-2},{ 1,-1},        { 1, 1},{ 1, 2},
{ 0,-2},                        { 0, 2},
{-1,-2},{-1,-1},        {-1, 1},{-1, 2},
{-2,-2},{-2,-1},{-2, 0},{-2, 1},{-2, 2}
};

int main(){
	int H, W, sh, sw, eh, ew; cin>>H>>W>>sh>>sw>>eh>>ew;
	string S[H]; rp(i, 0, H) cin>>S[i];

	V = H * W;
	G.resize(V); // 隣接リスト初期化
	rp(u, 0, V){
		int h = u / W, w = u % W;
		rp(i, 0, 4){
			int nx_h = h + dhw[i].first, nx_w = w + dhw[i].second;
			if(nx_h < 0 || H <= nx_h || nx_w < 0 || W <= nx_w) continue;
			if(S[nx_h][nx_w] == '#') continue;
			G[u].emplace_back(nx_h*W + nx_w, 0);
		}
		rp(i, 4, 24){
			int nx_h = h + dhw[i].first, nx_w = w + dhw[i].second;
			if(nx_h < 0 || H <= nx_h || nx_w < 0 || W <= nx_w) continue;
			if(S[nx_h][nx_w] == '#') continue;
			G[u].emplace_back(nx_h*W + nx_w, 1);
		}
	}

	int ans = dijkstra((sh-1)*W + (sw-1))[(eh-1)*W + (ew-1)];
	cout<< (ans==INF? -1:ans) <<endl;
}


Measured memory_bytes: 172260
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

vector<int> G[100'010];
int color[100'010];//0:未踏 1:白 -1:黒

bool dfs(int v, int c){
  bool res = true;
  color[v] = c;
  for(int nv:G[v]){
    if(color[nv] == 0){
      bool temp = dfs(nv, -c);
      if(!temp){
        return false;
      }
      //res = !res || dfs(nv, -c);
    }else{
      if(color[nv] == color[v]){
        return false;
      }else{
        continue;
      }
    }
  }
  return res;
}
  
int main(){
  
  int n,m;
  cin>>n>>m;
  int a[m],b[m];
  REP(i,m){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  bool flag = dfs(0, 1);
  long long w = 0;
  long long ans;
  if(flag){
    REP(i,n){
      if(color[i] == 1){
        w++;
      }
    }
    ans = w*((long long)n-w) - (long long)m;
  }else{
    ans = (long long)n*((long long)n-1)/2 - (long long)m;
  }
  cout<<ans<<endl;   
  return 0; 
}


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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int res = 0;
  for (int a = 0; a <= A; a++) {
    for (int b = 0; b <= B; b++) {
      for (int c = 0; c <= C; c++) {
        int total = 500*a + 100*b + 50*c;
        if (total == X)
          res++;
      }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double t; int dp[9000][9000],fun[5000],n,cost[5000];
int knapsack(int i,int w)
{
    if(i>n)
        return 0;
    if(dp[i][w]!=-1)
        return dp[i][w];
    int p=0,q=0;
    if(w+cost[i]<=t)
        p=fun[i]+knapsack(i+1,w+cost[i]);
    else
        p=fun[i];
    q=knapsack(i+1,w);
    dp[i][w]=max(p,q);
    return dp[i][w];
}
int main()
{
    int i,j,x;
    cin>>n>>t;
    t-=0.5;
    memset(dp,-1,sizeof(dp));
    for(i=1;i<=n;i++)
        cin>>cost[i]>>fun[i];
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            if(cost[i]>cost[j])
            {
                x=cost[i];
                cost[i]=cost[j];
                cost[j]=x;
                x=fun[i];
                fun[i]=fun[j];
                fun[j]=x;
            }
        }
    }
    cout<<knapsack(1,0)<<endl;
    return 0;
}

Measured memory_bytes: 316800
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include <iomanip>
#include<sstream>
#include<string.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0), cin.tie(0);
	int n, r;
	while (cin >> n >> r)
	{
		if (n < 10)
			r = r + 100 * (10 - n);
		cout << r << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

int main()
{
	double x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	printf("%.9lf\n", sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2)));
	return 0;
}


Measured memory_bytes: 3292
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
 
int32_t main() 
{
    IO;
    int n;
    cin>>n;
    bool f = false;
    while(n > 0)
    {
        int x = n%10;
        if(x == 7)
        {
            f = true;
            break;
        }
        n /= 10;
    }
    if(f)
    cout<<"Yes";
    else
    cout<<"No";
	return 0;
}


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

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REP(i,n) FOR(i,0,n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"

typedef long lint;
typedef pair<lint, lint> P;

struct UnionFind {
  vector<lint> par;

  UnionFind(lint N) : par(N) {
    REP(i, N) par[i] = i;
  }

  lint root(lint x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(lint x, lint y) {
    lint rx = root(x);
    lint ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
  }

  bool same(lint x, lint y) {
    lint rx = root(x);
    lint ry = root(y);
    return rx == ry;
  }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    lint N; cin >> N;
    lint M; cin >> M;

    vector<lint> P;
    REP(_, N) {
      lint p; cin >> p;
      P.push_back(p-1);
    }

    UnionFind uni(N);

    REP(_, M) {
      lint x,y; cin >> x; cin >> y;

      uni.unite(P[x-1], P[y-1]);
    }

    lint res = 0;

    REP(i, N) {
      if(uni.same(i, P[i])) {
        res++;
      }
    }
    cout << res << "\n";

    return 0;
}


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

int main() {
  typedef long long ll;
  ll N, M;
  cin >> N >> M;
  vector<vector<ll>> AB(N, vector<ll>(2));
  REP(i, N) {
    REP(j, 2) {
      cin >> AB.at(i).at(j);
    }
  }
  
  sort(AB.begin(), AB.end(), [](auto& x, auto& y){return x.at(0) < y.at(0);});
  
  ll count = 0;
  ll ans = 0;
  ll k = 0;
  while (count < M) {
    count += AB.at(k).at(1);
    k++;
  }
  
  REP(i, k) {
    ans += AB.at(i).at(0) * AB.at(i).at(1);
  }
  
  ans -= AB.at(k - 1).at(0) * (count - M);
  
  cout << ans << endl;
}


Measured memory_bytes: 5760
use std::io::{self, BufRead};

const MOD: u64 = 1_000_000_007;

fn main() {
    let mut ones: Vec<u64> = vec![0; 60];

    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let n = lines.next().unwrap().unwrap().parse::<u64>().unwrap();
    let s = lines.next().unwrap().unwrap();
    for a in s.split_whitespace() {
        let a = a.parse::<u64>().unwrap();
        for (i, one_count) in ones.iter_mut().enumerate() {
            if a & 1 << i != 0 {
                *one_count += 1;
            }
        }
    }

    let mut ans = 0;
    for (i, one_count) in ones.iter().enumerate() {
        ans += (one_count * (n - one_count) % MOD) * ((1 << i) % MOD) % MOD;
        ans %= MOD;
    }

    println!("{}", ans);
}


Measured memory_bytes: 13560
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    
    int n;
    cin>>n;
    
    double ans=0;
    double ansb=0;
    
    rep(i,n){
        string s;
        double u;
        cin>>u;
        cin>>s;
        if(s=="JPY"){
            ans+=u;
        }else{
            ansb+=u;
        }
    }
    
   
    ansb+=ansb*380000;
    ans+=ansb;
    cout<<ans<<endl;
    
    
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
//Int mod = 998244353;
Int INF = 1e18;
double EPS = 0.00000001;

int main() {
    Int n;
    string s;
    cin >> n >> s;
    Int res = 0;
    for (Int i = 1; i < n; i++) {
        Int cnt = 0;
        Int begin = n;
        for (Int j = 0; j <= n - i; j++) {
            if (s[j] == s[i + j] && j < begin) {
                if (cnt == 0) {
                    begin = i + j;
                }
                cnt++;
                res = max(res, cnt);
               // cout << s[i + j] << " " << s[j] << " " << begin << endl;
            }
            else {
                cnt = 0;
            }
        }
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 384
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    x=I()
    if x==1:
        print(1,0)
    else:
        f=0
        for i in range(1,400):
            for j in range(i-1,-400,-1):
                if (i**5)-(j**5)==x:
                    print(i,j)
                    f=1
                    break
            if f==1:
                break
        else:
            print(x,0)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9604
#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
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
using namespace std;

void probB() {
	int N; cin >> N;
	vi  results(4);
	string s;
	for (int i = 0; i < N; i++) {
		cin >> s;
		if (s == "AC") results[0]++;
		else if (s == "WA") results[1]++;
		else if (s == "TLE") results[2]++;
		else results[3]++;

	}

	cout << "AC" << " x " << results[0] << endl;
	cout << "WA" << " x " << results[1] << endl;
	cout << "TLE" << " x " << results[2] << endl;
	cout << "RE" << " x " << results[3] << endl;
	return;
}
int main() {
	probB();
}

Measured memory_bytes: 3632
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int gcd( int m, int n )
{
	int a=max(m,n),b=min(m,n);
	if(m==0) return n;if(n==0) return m;
	if(a%b==0) return b;
	return gcd(b,a-b*(a/b));
}
int main()
{
	int n,x,a,out=0;
	cin>>n>>x;
	rep(i,n){
		cin>>a;out=gcd(out,abs(a-x));
	}
	cout<<out<<endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;

int main(){
    int N, K;
    ll S;
    cin >> N >> K >> S;

    vector<ll> ans;
    rep(i,N){
        if (i < K){
            ans.push_back(S);
        }
        else{
            if (S < 1e9){
                ans.push_back(S+1);
            }
            else{
                ans.push_back(1);
            }
        }
    }
    
    rep(i,ans.size()){
        printf("%lld%c", ans[i], i==N-1?'\n':' ');
    }
}

Measured memory_bytes: 4328
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll x, y; cin >> x >> y;
    //数列の条件 x*2^z <= y
    // z <= log2(y/x)
    //cout << (ll)log2(y/x) + 1 << ednl;
  	ll cnt = 0;
  	for(ll i = 0;;i++){
      	ll a = x * pow(2,i);
      	if( a > y ) break;
      	cnt++;
    }
  	cout << cnt << ednl;


}


Measured memory_bytes: 384
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define MAXN 200005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> P;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> pq;
int n,m,a[MAXN];
bool check(int x)
{
    int sum=2*n+2*x+1;
    for(int i=2*x+1;i<=sum-i;i++)
        if(a[i]+a[sum-i]<m) return false;
    return true;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=2*n;i++) scanf("%d",&a[i]);
    sort(a+1,a+2*n+1);
    int l=-1,r=n;
    while(r-l>1)
    {
        int mid=(l+r)/2;
        if(check(mid)) r=mid; else l=mid;
    }
    int ans=0;
    int sum1=2*r+1,sum2=2*n+2*r+1;
    for(int i=1;i<=sum1-i;i++) ans=max(ans,(a[i]+a[sum1-i])%m);
    for(int i=2*r+1;i<=sum2-i;i++) ans=max(ans,(a[i]+a[sum2-i])%m);
    printf("%d\n",ans);
    return 0;
}



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

typedef long long ll;

int N;
string S;

ll mod = 1000000007;

int cnt[100];

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

    for(int i = 0; i < N; i++)
    {
        cnt[S[i] - 'a']++;
    }

    ll ans = 1;
    for(int i = 0; i < 26; i++)
    {
        ans *= cnt[i] + 1;
        ans %= mod;
    }

    cout << ans - 1 << endl;
}


Measured memory_bytes: 512
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;

char S[10];

int main() {
	scanf("%s", S);
	char ys[4], ms[2], ds[2];
	int y, m, d;
	
	for (int i = 0; i < 4; i++) ys[i] = S[i];
	for (int i = 0; i < 2; i++) {
		ms[i] = S[i + 5];
		ds[i] = S[i + 8];
	}
	y = atoi(ys); m = atoi(ms); d = atoi(ds);

	if (y <= 2019) {
		if (m <= 4) {
			printf("Heisei\n");
		}
		else {
			printf("TBD\n");
		}
	}
	else {
		printf("TBD\n");
	}

	return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

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

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll A; string str;
	cin >> A >> str;
	ll B = 0;
	forn(i,0,str.size()){
		if(str[i] == '.')continue;
		B *= ll(10);
		B += (str[i]-'0');
	}
	string res = to_string(A*B);
	if(res.size() <= 2){
		cout << 0 << '\n';
		return 0;
	}
	forn(i,0,res.size()-2){
		cout << res[i];
	}
	cout << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 3720
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def buy(lis, coin):
    k = coin//min(lis)
    return k, coin - min(lis)*k


def sell(lis, kabu):
    return max(lis)*kabu


n, *a = map(int, read().split())

buying = True
kabu = 0
coin = 1000
lis = []
for i in range(n):
    if buying:
        if i == n-1:
            break
        lis.append(a[i])
        if a[i] < a[i+1]:
            k, coin = buy(lis, coin)
            kabu += k
            lis = []
            buying = False

    else:
        lis.append(a[i])
        if i == n-1 or a[i] > a[i+1]:
            coin += sell(lis, kabu)
            kabu = 0
            lis = []
            buying = True

print(coin)


Measured memory_bytes: 8908
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;


int main()
{
    int sosu , n , cnt = 0 , cnt2 = 0;
    
    cin >> n;
    for( int i = 0; i < n; i++ ){
	cin >> sosu;
	if( sosu == 2 || sosu == 3  || sosu == 5 || sosu == 7 ){
	    cnt++;
	    // cout << cnt << endl;
	}
	
	else if( sosu % 2 != 0 ){
	    for( int j = 3; j <= sqrt(sosu); j += 2 ){
		if( sosu % j == 0) cnt2++;
	    }
	    if( cnt2 == 0 ) cnt++;
	    cnt2 = 0;
	} 
    }
    
	
    cout << cnt << endl;
    
    
    return 0;
}

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



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

	
	for(int i=0; i<5; i++){
		int a;
		cin>>a;
		if(a != i+1){
			cout<<i+1;
			break;
		}		
		
		
	}
	
    
    
		
	
		
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    long test=1;
// 	cin>>test;	
	while(test--)
	{
	long a,b=0,c=0,k,i,n,temp,mini,maxi,ans;
	string s;
		cin>>n;
		long arr[n];
		for(i=0;i<n;i++)
		{
		    cin>>arr[i];
		    b+=arr[i];
		}
		sort(arr,arr+n);
		mini=arr[0];
		maxi=arr[n-1];
		ans=9999999;
		for(int j=mini;j<=maxi;j++)
		{
		    c=0;
		    for(i=0;i<n;i++)
	    	{
		    
		        c+=pow((j-arr[i]),2);
		    }
		    
		    ans=min(c,ans);
		  //  cout<<"here"<<j<<" ";
		}
		
	cout<<ans;
		
		
    }
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=1;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}

int main(){
  int a[151][151];
  lp(i,151){
    lp(j,151){
      if(i>=j) a[i][j]=-1;
      else a[i][j]=i*i+j*j;
    }
  }
  while(1){
    int h,w;
    cin>>h>>w;
    if(h==0&&w==0) break;
    int x=h*h+w*w,min=1000000,minh,minw;
    lp(i,150){
      lp(j,150){
	if(a[i][j]==-1) 1;
	else if(a[i][j]-x>0 || x-a[i][j]==0 && i>h){
	  if(min>a[i][j]){
	    min=a[i][j];
	    minh=i;
	    minw=j;
	  }
	}
      }
    }
    cout<<minh<<" "<<minw<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 3184
# -*- coding: utf-8 -*-
import math

list_gp = list(raw_input())

num_g = 0
num_p = 0
points = 0

for i in xrange(len(list_gp)):

	# グーパー同じだったらグーを出すしかない
	if ( num_g - num_p ) <= 0 :
		num_g += 1

		if list_gp[i] == "p":
			points -= 1

		continue

	# グーが多い = パーも出せる
	if list_gp[i] == "p":
		# パーでアイコにする
		num_p += 1
	elif list_gp[i] == "g":
		# パーで勝つ
		num_p += 1
		points += 1


print points

Measured memory_bytes: 3460
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let mut x = get!(i64);
    for i in 1..1000000000 {
        x -= i;
        if x <= 0 {
            println!("{}", i);
            return;
        }
    }
}

Measured memory_bytes: 4352
#include<stdio.h>
main()
{
  char a;
  scanf("%c",&a);
    if (a=='A') {
      printf("T");
    } else {
        if (a=='T') {
        	printf("A");
        } else {
          	if (a=='C'){
         		printf("G");
          	}else{
           	 printf("C"); 
            }
        }
    }
}

Measured memory_bytes: 128
import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		alias Point = Tuple !(int, q{x}, int, q{y}, int, q{z});

		auto points = new Point [n];
		foreach (int i, ref point; points)
		{
			readf (" %s %s", &point.x, &point.y);
			point.z = i;
		}

		alias Edge = Tuple !(int, q{u}, int, q{v}, int, q{w});
		Edge [] edges;

		points.schwartzSort !(point => point.x);
		foreach (i; 1..n)
		{
			edges ~= Edge (points[i - 1].z, points[i - 0].z,
			    points[i - 0].x - points[i - 1].x);
		}

		points.schwartzSort !(point => point.y);
		foreach (i; 1..n)
		{
			edges ~= Edge (points[i - 1].z, points[i - 0].z,
			    points[i - 0].y - points[i - 1].y);
		}

		auto p = n.iota.array;

		int root (int v)
		{
			if (p[v] != v)
			{
				p[v] = root (p[v]);
			}
			return p[v];
		}

		bool unite (int u, int v)
		{
			u = root (u);
			v = root (v);
			if (u == v)
			{
				return false;
			}
			p[u] = v;
			return true;
		}

		edges.schwartzSort !(edge => edge.w);
		int res = 0;
		foreach (ref edge; edges)
		{
			if (unite (edge.u, edge.v))
			{
				res += edge.w;
			}
		}
		writeln (res);
	}
}


Measured memory_bytes: 5492
#include<iostream>
#include<algorithm>

using namespace std;
typedef long long Int;


Int H, W, h, w;
Int sum;
Int ans[540][540];
int main(){
  cin >> H >> W >> h >> w;
  if(H % h == 0 && W % w == 0){
    cout << "No" << endl;
    return 0;
  }
  Int a = 999999999 / (h*w-1);
  Int b = a * (h * w - 1) + 1;
  for(Int i = 0;i < H;i++){
    for(Int j = 0;j < W;j++){
      if(i % h == h-1 && j % w == w-1)ans[i][j] = -b;
      else ans[i][j] = a;
      sum += ans[i][j];
    }
  }
  if(sum <= 0){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  for(Int i = 0;i < H;i++){
    for(Int j = 0;j < W;j++){
      cout << ans[i][j] << " ";
    }cout << endl;
  }
  return 0;
}

Measured memory_bytes: 4992
#include<cstdio>
#include<cstring>
#include<algorithm>
#define int long long
using std::min;
int n,A,B,p[5010],dp[5010][5010],ans;
signed main(){
	scanf("%lld%lld%lld",&n,&A,&B);
	for(int i=1;i<=n;i++)scanf("%lld",&p[i]);
	memset(dp,0x3f,sizeof(dp));
	dp[0][0]=0;ans=0x3f3f3f3f3f3f3f3f;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=n;j++)
			if(p[i]>j)dp[i][j]=min(dp[i][j],dp[i-1][j]+A),
				dp[i][p[i]]=min(dp[i][p[i]],dp[i-1][j]);
			else dp[i][j]=min(dp[i][j],dp[i-1][j]+B);
	for(int i=0;i<=n;i++)
		ans=min(ans,dp[n][i]);
	printf("%lld\n",ans);
}

Measured memory_bytes: 196352
//#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

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

    int A, B;

    cin >> A >> B;

    int max = A + B;

    if(max < A - B) max = A - B;
    if(max < A * B) max = A * B;

    cout << max << endl;
    
}

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

using namespace std;
typedef pair<int, int> P;

int n, u, k, v, t = 0, G[110][110], used[110];
P p[110];

void dfs(int u) {
    used[u] = 1;
    p[u].first = ++t;
    for (int i = 1; i <= n; i++) {
        if (!G[u][i] || used[i]) continue;
        used[i] = 1;
        dfs(i);
    }
    p[u].second = ++t;
}

int main(void) {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            cin >> v;
            G[u][v] = 1;
        }
    }

    for (int i = 1; i <= n; i++) {
        if (used[i]) continue;
        dfs(i);
    }

    for (int i = 1; i <= n; i++)
        cout << i << " " << p[i].first << " " << p[i].second << endl;

    return 0;
}


Measured memory_bytes: 3120