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

int main() {
	int N, num;
	cin >> N;
	vector<string> S(N);
	for (int i = 0; i < N; i++)
		cin >> S.at(i);
	sort(S.begin(), S.end());
	vector<pair<int, string>> poll(N);
	poll.at(0).second = S.at(0);
	int count = 1;
	num = 0;
	for (int i = 1; i < N; i++) {
		if (i < N - 1) {
			if (S.at(i) == S.at(i - 1)) count++;
			else {
				poll.at(num).first = count;
				count = 1;
				num++;
				poll.at(num).first = 0;
				poll.at(num).second = S.at(i);
			}
		}
		else {
			if (S.at(i) == S.at(i - 1)) poll.at(num).first = count + 1;
			else {
				poll.at(num).first = count;
				num++;
				poll.at(num).first = 1;
				poll.at(num).second = S.at(i);
			}
		}
	}
	sort(poll.begin(), poll.end());
	for (int i = 0; i < N; i++)
		if (poll.at(i).first == poll.at(N - 1).first) cout << poll.at(i).second << endl;
}

Measured memory_bytes: 17408
#include <stdio.h>

typedef long long ll;

ll a[200005];

int main(void)
{
	ll n, k, i;

	scanf("%lld %lld", &n, &k);
	for (i = 1; i <= n; i++)
		scanf("%lld", &a[i]);

	for (i = k + 1; i <= n; i++)
		if (a[i] > a[i - k])
			puts("Yes");
		else
			puts("No");
	return 0;
}

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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int n, m, x;
    cin >> n >> m >> x;

    int a;
    int l = 0, r = 0;
    rep(i, m) {
        cin >> a;
        if (a < x) {
            l++;
        } else {
            r++;
        }
    }

    // 処理
    // 出力
    cout << (l < r ? l : r) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void main(){
	char string[5];
	scanf("%s",&string);
	int judge=0;
	if(string[0] == string[1]){
		if(string[2] == string[3]){
			if(string[0] != string[2]){
				judge = 1;
			}
		}
	}
	else if(string[0] == string[2]){
		if(string[1] == string[3]){
			if(string[0] != string[1]){
				judge = 1;
			}
		}
	}
	else if(string[0] == string[3]){
		if(string[1] == string[2]){
			if(string[0] != string[1]){
				judge = 1;
			}
		}
	}
	
	if(judge == 1) printf("Yes");
	else printf("No");
}

Measured memory_bytes: 128
import io.StdIn._
import scala.math.pow

object Main extends App {
  val arr = readLine.split(" ")
  val n   = arr(0).toLong
  val k   = arr(1).toLong

  require(0 <= n && n <= pow(10, 18))
  require(1 <= k && n <= pow(10, 18))

  val a = n % k
  val b = k - a

  if (a > b) println(b) else print(a)
}


Measured memory_bytes: 54644
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
    --y;
  }

  return sum;
}

/*考えを書くスペース


*/

//main.cpp----------------------------
#define MAX 100000

string S;
ll n;
stack<char> s;

int main() {
  cin >> S;
  n = S.length();

  int cnt = 0;
  s.push(S[0]);
  for(int i=1; i<n; ++i) {
    if(S[i]==s.top()) {
      if(S[i]=='0') S[i]='1';
      else S[i]='0';
      ++cnt;
    }
    s.pop();
    s.push(S[i]);
  }

  cout << cnt << endl;

  return 0;
}


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

using namespace std;

#define MOD 1000000007
#define N 100005
#define M 102
#define ll long long 
#define ld long double
#define pb push_back
#define ff first
#define ss second

ll dp[N], v[M], w[M];

int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n, i, t, ans = 0, W;
    cin>>n>>W;
    ll sum = 0;
    for(t=1; t<=n; t++){
        cin>>w[t]>>v[t];
        sum = sum + v[t];
    }
    for(i=1; i<=sum; i++)
        dp[i] = 2e9;
    for(t=1; t<=n; t++){
        for(i=sum; i>=v[t]; i--){
            dp[i] = min(dp[i], dp[i - v[t]] + w[t]);
            if(dp[i] <= W)
                ans = max(ans,i);
        }
    }
    cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	ll S; cin >> S;
	cout << "0 0 1000000000 1 ";
    const ll MAX = 1000000000;
	ll y = (S + MAX - 1LL) / MAX;
	ll x = MAX*y - S;
	cout << x << " " << y << endl;
}


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

typedef long long ll;

int main() {
    ll N;
    string S;
    cin >> N >> S;
    vector<string> ans = {"SS", "SW", "WS", "WW"};
    rep(i, 4) {
        rep(j, N) {
            if (ans[i][j + 1] == 'S') {
                if (S[j] == 'o') {
                    if (ans[i][j] == 'S') ans[i].push_back('S');
                    else ans[i].push_back('W');
                } else {
                    if (ans[i][j] == 'S') ans[i].push_back('W');
                    else ans[i].push_back('S');
                }
            } else {
                if (S[j] == 'o') {
                    if (ans[i][j] == 'S') ans[i].push_back('W');
                    else ans[i].push_back('S');
                } else {
                    if (ans[i][j] == 'S') ans[i].push_back('S');
                    else ans[i].push_back('W');
                }
            }
        }
        if (ans[i].substr(0, 2) == ans[i].substr(N, 2)) {
            cout << ans[i].substr(1, N) << "\n";
            return 0;
        }
    }
    cout << "-1\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c[3][3];
  cin >> c[0][0] >> c[0][1] >> c[0][2];
  cin >> c[1][0] >> c[1][1] >> c[1][2];
  cin >> c[2][0] >> c[2][1] >> c[2][2];
  
  cout << c[0][0] << c[1][1] << c[2][2] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    long long int H; // the life point of the monster 
    long long int attack = 0;
    long long int temp = 1;
    long long int i;
    
    scanf("%lld", &H);
    if (H > 1)
    {
        attack = 1;
        for (i = 0; H != 1; i++)
        {
            // printf("H:%lld = %lld\n", i, H);
            H = H / 2;
            temp = temp * 2;
            attack = attack + (temp);
            // printf("attack:%lld = %lld\n", i, attack);
        }
    }
    else if (H == 1)
    {
        printf("1");
        return (0);
    }
    printf("%lld", attack);
    return (0);
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	if(n==2){
		cout << -1 << "\n";
		return 0;
	}
	if(n%3==0){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(i%3==2){
					if(j%3==0){
						cout << ".";
					}else{
						cout << "a";
					}
				}else{
					if(j%3==0){
						cout << "a";
					}else{
						cout << ".";
					}
				}
			}
			cout << "\n";
		}
		return 0;
	}
	vector<vector<char>> p4=
	{
		{'a','a','c','d'},
		{'b','b','c','d'},
		{'c','d','a','a'},
		{'c','d','b','b'}
	};
	
	vector<vector<char>> p5=
	{
		{'a','a','d','e','e'},
		{'b','b','d','.','f'},
		{'c','c','g','g','f'},
		{'.','.','a','b','c'},
		{'.','.','a','b','c'}
	};
	vector<vector<char>> p7=
	{
		{'a','a','.','a','a','.','a'},
		{'.','b','b','.','.','b','a'},
		{'a','.','a','a','.','b','.'},
		{'a','.','.','.','a','.','a'},
		{'.','b','.','.','a','.','a'},
		{'a','b','.','.','b','b','.'},
		{'a','.','a','a','.','a','a'}
	};
	vector<vector<char>> res(n,vector<char>(n,'.'));
	vector<vector<int>> dec(n+10);
	dec[4].push_back(4);
	dec[5].push_back(5);
	dec[7].push_back(7);
	for(int i=8;i<=n;i++){
		if(dec[i-4].size()>0){
			dec[i]=dec[i-4];
			dec[i].push_back(4);
		}else if(dec[i-5].size()>0){
			dec[i]=dec[i-5];
			dec[i].push_back(5);
		}else if(dec[i-7].size()>0){
			dec[i]=dec[i-7];
			dec[i].push_back(7);
		}
	}
	int ind=0;
	for(int d:dec[n]){
		if(d==4){
			for(int i=0;i<d;i++){
				for(int j=0;j<d;j++){
					res[i+ind][j+ind]=p4[i][j];
				}
			}
		}
		if(d==5){
			for(int i=0;i<d;i++){
				for(int j=0;j<d;j++){
					res[i+ind][j+ind]=p5[i][j];
				}
			}
		}
		if(d==7){
			for(int i=0;i<d;i++){
				for(int j=0;j<d;j++){
					res[i+ind][j+ind]=p7[i][j];
				}
			}
		}
		ind+=d;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cout << res[i][j];
		}
		cout << "\n";
	}
	return 0;
}

Measured memory_bytes: 3328
from collections import Counter

N = int(input())

A = list(map(int, input().split()))

Q = int(input())

BC = []
for _ in range(Q):
    b, c = map(int, input().split())
    BC.append([b, c])

C = Counter(A)
S = sum([k*v for k, v in C.items()])
for bc in BC:
    b = bc[0]
    c = bc[1]
    if b in C:
        bf = C[b]
        S += (c-b) * bf
        if c in C:
            C[c] += C[b]
            C[b] = 0
        else:
            C[c] = C[b]
            C[b] = 0
    print(S)


Measured memory_bytes: 33888
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main()
{
  int h, w, k;
  cin >> h >> w >> k;
  cin.ignore();
  string s[h];
  REP(i, h) {
    getline(cin, s[i]);
  }
  // REP(i, h) cout << s[i] << endl;
  int ans = h + w;
  for(int bit = 0; bit < (1 << h - 1); bit++) {
    int divs = 0;
    vvi a;
    vi r0(w);
    REP(i, w) r0[i] = (s[0][i] == '1') ? 1 : 0;
    a.pb(r0);
    REP(i, h - 1) {
      if (bit & (1 << i)) {
        vi rx(w);
        REP(j, w) rx[j] = (s[i + 1][j] == '1') ? 1 : 0;
        a.pb(rx);
        divs++;
      } else {
        REP(j, w) a[divs][j] += (s[i + 1][j] == '1') ? 1 : 0;
      }
    }
    int dh = divs + 1;
    // cout << endl << bitset<8>(bit) << endl;
    // cout << dh << endl;
    // REP(i, dh){
    //   REP(j, w){
    //     cout << a[i][j];
    //   }
    //   cout << endl;
    // }
    bool imp = false;
    REP(i, dh) {
      REP(j, w) {
        if (a[i][j] > k) {
          imp = true;
          break;
        }
      }
      if (imp) break;
    }
    if (imp) continue;
    vi col(dh);
    REP(i, dh) col[i] = a[i][0];
    FOR(i, 1, w) {
      vi temp(dh);
      bool over = false;
      REP(j, dh) {
        temp[j] = col[j] + a[j][i];
        if (temp[j] > k) {
          over = true;
          break;
        }
      }
      if (over) {
        REP(j, dh) col[j] = a[j][i];
        divs++;
      } else {
        col = temp;
      }
    }
    ans = min(ans, divs);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int N,K;
double num[200010],sum[200010],ans;

int main()
{
	scanf("%d%d",&N,&K);
	for(int i=1;i<=N;i++)
	{
		double a;
		scanf("%lf",&a);
		num[i]=(a+1.0)/2.0;
	}
	for(int i=1;i<=K;i++)
	    sum[K]=sum[K]+num[i];
	ans=sum[K];
	for(int i=K+1;i<=N;i++)
	{
		sum[i]=sum[i-1]+num[i]-num[i-K];
		ans=max(ans,sum[i]);
	}
	printf("%.12lf\n",ans);
	return 0;
} 

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define long long long
#define ull unsigned long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define pb push_back
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define V vector
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar

using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }
const int N= (int) 1e5+10;
int n;
V<II> a[N];
long len[N];
int q,k;
void input()
{
	cin>>n;
	up(i,1,n-1)
	{
		int u,v,c; cin>>u>>v>>c;
		a[u].pb(II(v,c)); a[v].pb(II(u,c));
	}

}
void dfs(int u,int p,long w)
{
	len[u]= w;
    for (auto v: a[u])
		if (v.X!=p)
		{
		 dfs(v.X,u,w+ v.Y);
		}
}
void solve()
{
    cin>>q>>k;
    dfs(k,-1,0);
    up(i,1,q)
    {
    	int x,y; cin>>x>>y;
    	cout<<len[x]+ len[y]<<endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// don't use when interactive
    #define TASK "tmp"
   // freopen(TASK".inp","r",stdin);
   // freopen(TASK".out","w",stdout);

    input();
    solve();

    return 0;
}


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

int n,a,b,c,d,cnt;
string s;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>a>>b>>c>>d;
    cin>>s;
    s='#'+s+"#####";
    if(c>d){
        cnt=0;
        bool f=0;
        for(int i=b-1;i<=d+1;i++){
            if(s[i]=='.'){
                cnt++;
            }else{
                if(cnt>=3){
                    f=1;
                    break;
                }else{
                    cnt=0;
                }
            }
        }
        if(cnt>=3){
            f=1;
        }
        if(!f){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cnt=0;
    for(int i=b;i<d;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cnt=0;
    for(int i=a;i<c;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;

    return 0;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 200005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
typedef vector<int> vi;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

int arr[maxii];
int arr2[1000006];
//bool check[1000006];
//int maxi;

int main()
{
   int n;
   sc(n);
   //maxi=0;
   for(int i=0;i<n;i++)
   {
       sc(arr[i])
       //maxi=max(maxi,arr[i]);
       arr2[arr[i]]++;
   }
   int res=0;
   if(arr2[1]==1)
   {
       printf("1");
       return 0;
   }
   else if(arr2[1]>1)
   {
       printf("0");
       return 0;
   }
   for(int i=0;i<n;i++)
   {
       int c=0;
       if(arr2[arr[i]]>1)
        {
               continue ;
        }
       for(int j=2;j*j<=arr[i];j++)
       {
           if(arr[i]%j==0)
           {
               int x=arr[i]/j;
               //cout<<x<<" "<<j<<endl;
               if(arr2[x]!=0 || arr2[j]!=0)
               {
                   c=1;
                   break;
               }
           }
       }
       //cout<<endl;
       if(c==0)
       {
           res++;
       }
   }
   pf(res);

}





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

using namespace std;


int main() {


	long long  n, k;
	cin >> n >> k;

	long long a[n + 1];
	for (long  i = 1; i <= n; i++ ) cin >> a[i];

	long long ans[n + 1];
	ans[0] = 0;
	ans[1] = 0;
	for (long i = 2; i <= n; i++) {
		ans[i] = INT_MAX;
		for (long j = i - 1; j >= 1 and j >= (i - k); j--) {
			ans[i] = min(ans[i], ans[j] + abs(a[i] - a[j]));
		}
	}

	cout << ans[n] << endl;
	return 0;
}

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

int sum_digit(int a){
	int sum = 0;
	while(0 < a){
		sum += a%10;
		a /= 10;
	}
	return sum;
}

int main(){
	int n,a,b;
	cin >> n >> a >> b;

	int ans = 0;
	for(int i = 0; i <= n; i++){
		int kari = sum_digit(i);
		if(a <= kari && kari <= b)
			ans += i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;


int powerm(ll a,ll b,ll m=mod){
    a %= m;
    int res = 1%m;
    while(b > 0){
        if(b & 1)res = (res * a) % m;
        b >>= 1;
        a = (a * a) % m;
    }
    return res;
}


void solve(){
    int n, m;
    cin>>n>>m;
    cout<<(n*m);
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 3612
#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt
#include <sstream>	//stringstream,getline

using namespace std;

int main() {

	int x;
	cin >> x;

	cout << x * x * x << endl;

	return 0;

}


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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int n; cin >> n;
  int ans; cin >> ans;
  for (int i = 1; i < n; i++) {
    int t; cin >> t;
    ans = __gcd(ans, t);
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>

using namespace std;
#define SAY_YES cout<<"YES"<<endl;
#define SAY_Yes cout<<"Yes"<<endl;
#define SAY_NO cout<<"NO"<<endl;
#define SAY_No cout<<"No"<<endl;
#define IFYES(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} 
#define IFYes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} 
#define IFyes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"yes"<<endl;}else{cout<<"no"<<endl;} 
#define DEBUG_OUTPUT_ARRAY(XXX,ONE) for(int i=0;i<(ONE);i++){cout<<"DEBUG: i = "<<i<<" -> "<<XXX[i]<<endl;}
#define DEBUG_OUTPUT_ARRAY2(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<"<<< i = "<<i<<" >>>"<<endl;for(int j=0;j<(TWO);j++){cout<<"DEBUG: j = "<<j<<" -> "<<XXX[i][j]<<endl; } }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<i<<"  ";for(int j=0;j<(TWO);j++){cout<<XXX[i][j]<<" "; } cout<<endl;}

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


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int N,M,sum=0,res=0;

string str;

int main() {
	cout << fixed << setprecision(18);
    
    cin>>N>>M;
    if(N>=10){cout<<M;}
    else{cout<<M+100*(10-N);}
} 


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= 9; ++i) {
    if (n % i == 0 && n / i >= 1 && n / i <= 9) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>

#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,n) for(int i=0;i<(n); i++)

using namespace std;
const int MAX = 100005;
const int INF=1e9+7;
typedef long long ll;


ll dp[105][MAX] = {0};
int main(){
	cin.tie(0);
    ios::sync_with_stdio(0); //この2行はより速度を向上させる
	// 追加２, 以降 cin の入力元が 'input.txt' になる
	//提出時に消す！！
	//std::ifstream in("sample.txt");
	//std::cin.rdbuf(in.rdbuf());

	int N,W;
	cin >> N >> W;

	vector<ll> w(N),v(N);
	rep(i,N) cin >> w[i] >> v[i];

	rep(i,N){
		for(int j=0;j<=W;j++){
			dp[i+1][j]=dp[i][j];
			if(j-w[i] >= 0){
				dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]]+v[i]);
			}
		}
	}
	cout << dp[N][W] << endl;

	return 0;
}


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

using namespace std;

typedef long long ll;

int main(){

	ll n;
	while(cin>>n&&n!=0){
		ll S=0;
		for(ll i = 1; i*i < n; i++){
			if(n%i==0){
				S+=i;
				if(i!=1)
					S+=n/i;
			}
		}
		if(n==S)
			cout<<"perfect number"<<endl;
		else if(n>S){
			cout<<"deficient number"<<endl;
		}
		else if(n<S)
			cout<<"abundant number"<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int a, ans = 0;
    string s;
    cin >> a >> s;
    cout << (a >= 3200? s : "red") << endl;
    return 0;
}


Measured memory_bytes: 256
<?php
$seconds = trim(fgets(STDIN));
$time = s2h($seconds);
echo $time;
 
function s2h($seconds) {
	
	$hours = floor($seconds / 3600);
	$minutes = floor(($seconds / 60) % 60);
	$seconds = $seconds % 60;
	
	$hms = sprintf("%01d:%01d:%01d", $hours, $minutes, $seconds);
	
	return $hms;
	
}
?>

Measured memory_bytes: 15260
import java.util.*

val sc = Scanner(System.`in`)
val N = sc.nextInt()
val M = sc.nextInt()
val X = sc.nextInt()
val Y = sc.nextInt()

fun main(args: Array<String>) {
    val xMax = Array(N) { sc.nextInt() }.max() ?: 0
    val yMin = Array(M) { sc.nextInt() }.min() ?: 0

    if (xMax < Y && X < yMin && xMax < yMin) {
        println("No War")
    } else {
        println("War")
    }
}


Measured memory_bytes: 35916
// abc131d.cpp : Megalomania
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N; cin>>N;
	vector<pair<int,int>> jb;
	int i, a, b;
	for(i=0;i<N;i++){
		cin>>a>>b;
		jb.push_back(make_pair(b,a));
	}
	sort(jb.begin(), jb.end());
	a = 0;
	for(i=0;i<N;i++)
		if((a += jb[i].second) > jb[i].first) break;
	cout<<(i<N? "No\n": "Yes\n");
}

Measured memory_bytes: 2420
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,k;
    cin>>n>>k;
    vector<pair<int,int>>v(n);
    for(int i=0;i<n;i++){
        pair<int, int>p;
        cin>>p.first;
        cin>>p.second;
        v[i]=p;
    }
    vector<vector<long long >>dp(n+1, vector<long long>(k+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=k;j++){
            if(j<v[i-1].first)
                dp[i][j] = dp[i-1][j]; //cell on same place but previous row 
            else
                dp[i][j] = max(v[i-1].second+dp[i-1][(j-v[i-1].first)], dp[i-1][j]); //By taking this one or not
            }
    }
    cout<<dp[n][k];
}


Measured memory_bytes: 80256
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		s := nextString(sc)
		if s == "-" {
			break
		}
		m := nextInt(sc)
		for i := int64(0); i < m; i++ {
			h := nextInt(sc)
			s = s[h:] + s[:h]
		}
		fmt.Println(s)
	}
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) int64 {
	i, err := strconv.ParseInt(nextString(sc), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}



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


int main() {
    ll n; ll k;
    cin >> n >> k;
    vector<ll>a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    ll ng = -ll(1e18)-1; ll ok = ll(1e18)+1;
    while(abs(ok - ng) > 1) {
        ll mid = (ok+ng)/2;
        ll sum = 0;
        // mid以下の個数を数える
        rep(i,n) {
            if(a[i]>0) {
                ll ok2 = -1; ll ng2 = n;
                while(abs(ng2-ok2)>1) {
                    ll mid2 = (ok2+ng2)/2;
                    if(a[i]*a[mid2] <= mid) ok2 = mid2;
                    else ng2 = mid2;
                }
                sum += ng2;
                if(a[i]*a[i]<=mid) sum--; 
            }
            else if(a[i] < 0) {
                ll ok2 = n;ll ng2 = -1;
                while(abs(ok2-ng2>1)) {
                    ll mid2 = (ok2+ng2)/2;
                    if(a[i]*a[mid2]<=mid) ok2 = mid2;
                    else ng2 = mid2;
                }
                sum += (n-ng2-1);
                if(a[i]*a[i]<=mid) sum--;
            } else {
                if(mid>=0) sum += n-1;
            }
        }
        sum /= 2;
        if(sum>=k) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;    
}

Measured memory_bytes: 4836
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	inputs := make([]uint64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&inputs[i])
	}

	for _, v := range inputs {
		if v == 0 {
			fmt.Println(0)
			return
		}
	}

	var ans uint64 = 1
	for _, v := range inputs {
		if ans > 1e18/v {
			fmt.Println(-1)
			return
		}
		ans *= v
	}
	fmt.Println(ans)
}

func stringsToInts(s []string) []uint64 {
	arr := make([]uint64, len(s))
	for i, v := range s {
		arr[i], _ = strconv.ParseUint(v, 10, 64)
	}
	return arr
}


Measured memory_bytes: 6316
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;
set<int> st;
int n,m,x;
int ans=1e9;
int main(int argc,char const* argv[])
{
  cin >> n >> m >> x;
  vi a(m+5);
  for(int i=0;i<m;i++)
    {
      cin >> a[i];
    }
  int tmp=0;
  for(int i=0;i<x;i++)
    {
      for(int j=0;j<m;j++)
	{
	  if(a[j]==i) tmp++;
	}
    }
  ans=min(ans,tmp);
  tmp=0;
  for(int i=x;i<n;i++)
    {
      for(int j=0;j<m;j++)
	{
	  if(a[j]==i) tmp++;
	}
    }
  ans=min(ans,tmp);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

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

constexpr char SHARP = '#';
constexpr char SPACE = ' ';

void draw(int width, int x, int y, vector<string>& a) {
    if (width == 1) {
        a[x][y] = SHARP;
    } else if (width == 2) {
        a[x][y] = a[x+1][y] = a[x][y+1] = SHARP;
    } else if (width == 3) {
        a[x][y] = a[x][y+1] = a[x][y+2] = SHARP;
        a[x+1][y] = a[x+1][y+2] = SHARP;
        a[x+2][y] = a[x+2][y+2] = SHARP;
    } else if (width == 4) {
        a[x][y] = a[x][y+1] = a[x][y+2] = a[x][y+3] = SHARP;
        a[x+1][y] = a[x+1][y+3] = SHARP;
        a[x+2][y] = a[x+2][y+3] = SHARP;
        a[x+3][y] = a[x+3][y+2] = a[x+3][y+3] = SHARP;
    } else {
        for (int j = 0; j < width; ++j) {
            a[x][y+j] = SHARP;
        }
        for (int j = 1; j < width; ++j) {
            a[x+j][y] = SHARP;
            a[x+j][y+width-1] = SHARP;
        }
        for (int j = 2; j < width; ++j) {
            a[x+width-1][y+j] = SHARP;
        }
        a[x+width-2][y+2] = SHARP;
        draw(width-4, x+2, y+2, a);
    }
}

int main() {
    int N;
    cin >> N;
    for (;N--;) {
        int W;
        cin >> W;
        vector<string> a(W, string(W, ' '));

        draw(W, 0, 0, a);
        for (int j = 0; j < W; ++j) {
            cout << a[j] << endl;
        }
        if (N > 0) {
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3080
from collections import deque

n, m = map(int, input().split())

x = deque(range(1, n + 1))
aaa = []
bbb = []
flag = True

if n % 2 == 1:
    for i in range(m):
        a = x.popleft()
        aaa.append(a)
        b = x.pop()
        bbb.append(b)

else:
    for i in range(m):
        # ｎが偶数の場合は途中で1個捨てる
        a = x.popleft()
        aaa.append(a)
        b = x.pop()
        bbb.append(b)
        if x[-1] - x[0] <= n // 2 and flag:
            a = x.popleft()
            flag = False

for aa, bb in zip(aaa, bbb):
    print(aa, bb)

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

#define 	pie				3.1415926536
#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(int i = a ; i < b ; i++)
#define 	mod1 			1000003
#define 	hi   			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define 	F 				first
#define 	S 				second
#define 	PB 				push_back
#define 	MP				make_pair
#define 	B 				begin()
#define 	E 				end()
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define 	vi 				vector<int>
#define     pi              pair<int, int>
#define 	vs 				vector<string>
#define 	print1(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define     print2(a)       for(auto i : a)cout<<i;cout<<"\n"
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;

//g++ -std=c++14
//fixed<<setprecision(9);
//max_element(mp.begin(), mp.end(), compare)
//greater<int>()
//__builtin_popcount();


bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second<b.second; }

void solve()
{
  ll n, k;cin>>n>>k;
  ll min = 1e18+1;
  if(n>=k)
  {
      if(n%k)
      {
          if(n%k < (k -(n%k)))
            cout<<n%k<<nl;
        else
        {
            cout<<k-(n%k)<<nl;
        }
        
      }
      else
      {
          cout<<0<<nl;
      }
      
      
  }
  else
  {
      if(n<k-n)
        cout<<n<<nl;
    else
    {
        cout<<k-n<<nl;
    }
    
  }
  
}

int main()
{
    int  t = 1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

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

using namespace std;

typedef long long Int;

const int MOD = 1000000007;

char str[64][32];
Int dp[64][64][32][32];

Int func(int r1, int r2, int c, int alpha)
{
	if (alpha >= 27 || c > 20) return (0);
	if (dp[r1][r2][c][alpha] >= 0) return (dp[r1][r2][c][alpha]);
	if (r1 == r2 && c == 20) return (1);

	Int ans = func(r1, r2, c, alpha + 1);

	for (int i = r1; i <= r2; i++){
		if (str[i][c] == (alpha == 0 ? '$' : alpha - 1 + 'a') || (alpha != 0 && str[i][c] == '?'))
			ans = (ans + func(r1, i, c + 1, 0) * (i == r2 ? 1 : func(i + 1, r2, c, alpha + 1)) % MOD) % MOD;
		else break;
	}

	return (dp[r1][r2][c][alpha] = ans);
}

int main()
{
	int n;
	scanf("%d", &n);

	memset(str, '$', sizeof(str));

	for (int i = 0; i < n; i++){
		scanf("%s", str[i]);
		str[i][strlen(str[i])] = '$';
		str[i][20] = 0;
	}

	memset(dp, -1, sizeof(dp));
	printf("%lld\n", func(0, n - 1, 0, 0));

	return (0);
}

Measured memory_bytes: 34032
N,M = gets.split.map(&:to_i)
keys = Array.new(M)
i = 0
while i < M
  a,_ = gets.split.map(&:to_i)
  n = 0
  gets.split.each do |c|
    n |= 1 << c.to_i-1
  end
  keys[i] = [a,n]
  i += 1
end

dp = Array.new(5000, 1e9)
dp[0] = 0

keys.each do |price,now|
  bits = 0
  while bits < (1<<N)
    n = dp[bits] + price
    if n < dp[bits|now]
      dp[bits|now] = n
    end
    bits += 1
  end
end

if dp[(1<<N)-1] == 1e9
  p -1
else
  p dp[(1<<N)-1]
end


Measured memory_bytes: 2172
function Main(input) {
    input = input.split("\n");
    tmp = input[1].split(" ");
    var c = 0;
    for(i=0;i<tmp.length;i++){
      c += parseInt(tmp[i])
    }
    for(j=0;j<input[2];j++){
       tmp2 = input[3+j].split(" ");
       var d = c - tmp[parseInt(tmp2[0])-1] + parseInt(tmp2[1]);
       console.log('%s', d);
    }
}

function debug(){
	var input = document.getElementById("input").value;
	Main(input);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 17912
fun main(args: Array<String>) {
    val N = nextInt()
    val B = listOfInt().toMutableList()
    B.add(Int.MAX_VALUE)
    val A = IntArray(N)
    A[0] = B[0]
    for (n in 1 until N) {
        A[n] = Math.min(B[n - 1], B[n])
    }
    var ans = A.sum()
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


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

using namespace std;

int main(){
    int N,M;
    cin>>N>>M;
    vector<long long> X(M);

    for(int i = 0; i < M; i++){
        cin>>X[i];
    }

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

    vector<long long> diffs;

    for(int i = 1; i < M; i++){
        diffs.push_back(X[i]- X[i-1]);
    }

    long long ans = X.back() - X[0];

    sort(diffs.begin(),diffs.end(),greater<long long>());

    for(int i = 0; i < min((int)diffs.size(),N-1); i++){
        ans -= diffs[i];
    }

    cout<<ans<<endl;

    return 0;

    
}

Measured memory_bytes: 2168
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
  #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl "\n"
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
   	int n,m,x,y;
   	cin>>n>>m>>x>>y;
   	vector<int> s1(n),s2(m);
   	for(auto &it:s1)cin>>it;
   	for(auto &it:s2)cin>>it;
   	for(int z=x+1;z<=y;z++){
		bool ok=true;
	 	for(auto it:s1)if(it>=z)ok=false;
		for(auto it:s2)if(it<z)ok=false;
		if(ok){
			cout<<"No War"<<endl;
			exit(0);
			}
	}
	cout<<"War"<<endl;
}
int32_t main(){
   IOS;
   solve();
   //debug();
  #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
  #endif	
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long S = sc.nextLong();
		long x1 = (long)Math.ceil(Math.sqrt((double)S));
		long y1 = 0;
		long x2 = 1;
		long y2 = x1;
		long x3 = 0;
		long y3 = 0;
		long tmp = x1*y2;
		y1 = tmp-S;
		//S = Math.abs((x1*y2)-(x2*y1));
		if(y1<0){
			y2 -= y1;
			y3 = -y1;
      y1 = 0;
		}
    System.out.println(x1+" "+y1+" "+x2+" "+y2+" "+x3+" "+y3);
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
int main() {
    ll a,b,ans=0;
    cin>>a>>b;
    if(a>b){
        cout<<a + max(a-1,b); 
        return 0;
    }
    cout<<b + max(b-1,a); 
    return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int A, B; cin >> A >> B;
  int ans = -1;
  for(int i = 1; i <= 10000; ++i) {
    int a = (double)i * 0.08;
    int b = (double)i * 0.1;
    if(a == A && b == B) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}


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

int main(){
    int a,b;
    cin >> a;
    cin >> b;

    if(a < b){
        cout << "a < b" << endl;
    } else if( a == b){
        cout << "a == b" <<endl;
    } else if(a > b){
        cout << "a > b" << endl;
    }
}


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}
/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, W;
  cin >> N >> W;
  llvec w(N), v(N);
  rep(i, N)cin >> w[i] >> v[i];

  vector<llvec> v2(4);
  rep(i, N){
    v2[w[i]-w[0]].push_back(v[i]);
  }
  rep(i, 4)sort(rALL(v2[i]));

  vector<llvec> S(4);
  rep(i, 4){
    S[i]=llvec(v2[i].size()+1, 0);
    rep(j, v2[i].size()){
      S[i][j+1] = S[i][j] + v2[i][j];
    }
  }
  ll ans = 0;
  rep(i, v2[0].size()+1){
    rep(j, v2[1].size()+1){
      rep(k, v2[2].size()+1){
        rep(l, v2[3].size()+1){
          if(w[0]*(i+j+k+l)+j+2*k+3*l>W)break;
          ans = max(ans, S[0][i] + S[1][j] + S[2][k] + S[3][l]);
        }
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

sum = a.inject(:+)

last_sum = 0
ans = 10 ** 18
(n-1).times do |i|
  x = last_sum + a[i]
  last_sum = x
  y = sum - x
  s = (x - y).abs
  ans = s if s < ans
end
p ans


Measured memory_bytes: 16516
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author vdewansa
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        KStones solver = new KStones();
        solver.solve(1, in, out);
        out.close();
    }

    static class KStones {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[K + 1];
            for (int i = 1; i <= N; i++) {
                a[i] = in.nextInt();
            }
            int[] s = new int[K + 1];
            for (int k = 0; k <= K; k++) {
                s[k] = -1;
                for (int x = 1; x <= N && a[x] <= k; x++) {
                    s[k] = Math.max(s[k], -s[k - a[x]]);
                }
            }
            if (s[K] > 0) {
                out.println("First");
            } else {
                out.println("Second");
            }
        }

    }
}



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

int main() {
    long long A,B,C,K;
    cin >> A >> B >> C >> K;
    int ans=0;
    if (A<=K) {
        ans+=A;
    }
    else ans=K;
    K-=A;
    if (B<=K) {
        K-=B;
    }
    else K=0;
    if (K>0) {
        ans += -1*K;
    }
    cout << ans;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main()
{
  unsigned long long int h,ans,i=0,j;
  cin>>h;
  if(h==1)
  {
    ans=1;
  }
  while(h!=1)
  {
    i++;
    h/=2;
  }
  for(j=1;j<=i;j++)
  {
    ans+=pow(2,j);
  }
  cout<<ans<<endl;
  return 0;
}
  

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

int main(){
    int x, y, a, b, c, t;
    cin >> a >> b >> c >> x >> y;
    t = min(min(2*c*x+b*max(0,y-x), a*max(0,x-y)+2*c*y), a*x+b*y);
    cout << t;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define fi first
#define se second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head
const int N = 1e6+10;
char s[N];
int main() {
    io;
    cin>>(s+1);
    int len=strlen(s+1);
    if(s[1]=='0'||s[len]=='1') return puts("-1"),0;
    rep(i,1,len-1) if(s[i]!=s[len-i]) return puts("-1"),0;
    int rt=1;
    rep(i,2,len)
    {
        cout<<rt<<' '<<i<<endl;
        if(s[i-1]=='1')
            rt=i;
    }

}


Measured memory_bytes: 3740
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#define ll long long
using namespace std;



int main(){
  string S,T,ANS;
  cin>>S>>T;
  ANS=T+S;
  cout<<ANS<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 501
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
ll const INF = 1LL<<55;
ll n,m;
vector<P> G[N];
ll v0,a,b,C;
ll v[5010];

int nv(ll v){return (v*a+b)%C;}

ll dijkstra(ll start,ll goal,ll c){
  ll D[500][100];
  for(ll i=0;i<500;i++)
    for(ll j=0;j<100;j++) D[i][j] = INF;

  priority_queue<PP,vector<PP>,greater<PP> > Q;
  Q.push(PP(0,P(start,c)));
  D[start][c] = 0;
  ll res = INF;
  while(!Q.empty()){
    PP t = Q.top();Q.pop();
    ll cost = t.first; 
    ll pos = t.second.first;
    ll v = t.second.second;
    if(D[pos][v]<cost) continue;
    if(pos==goal&&goal == 0)return cost; 
    if(pos==goal&&goal == n-1){
      res=min(res,cost+dijkstra(n-1,0,v));
      continue;
    }

    for(ll i=0;i<(ll)G[pos].size();i++){
      ll npos = G[pos][i].first;
      ll ncost= cost+v*G[pos][i].second;
      ll nV = nv(v); 
     if(D[npos][nV]<=ncost)continue;
      Q.push(PP(ncost,P(npos,nV)));
      D[npos][nV] = ncost;
    }
  }
  return res;
}

int main(){
  cin>>n>>m;
  for(ll i=0,x,y,t;i<m;i++){
    cin>>x>>y>>t;
    x--,y--;
    G[x].push_back(P(y,t));
    G[y].push_back(P(x,t));
  }

  int v0;
  cin>>v0>>a>>b>>C;
  cout<<dijkstra(0,n-1,v0)<<endl;
  return 0;
}

Measured memory_bytes: 12104