akhauriyash/Code-Regression huggingface dataset:
/*
name:       Egyptian Tourist
PlatForm:   CodeForces/SPOJ...etc
LANG:       C++
DIV:        Training
TIME:       *
RATE:       *
*/

/*
Time Consumed:*
Problem Topics: *
*/
#include <bits/stdc++.h>
#include <iostream>

using namespace std;
//----------------------------------//

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

//-------------------------------------------------------//
#define rep(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define repr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define lp(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define lpr(i,n) for (int i = (n) - 1; ~i; i--)
#define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
//-------------------------------------------------------------------------------------//

#define clr(ar, val) memset(ar, val, sizeof(ar))
//----------------------------------------------//

#define inn freopen("in.in","r",stdin)
#define outt freopen("out.out","w",stdout)
#define PI 3.1415926535897932385
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define pob pop_back
#define bit(n) (1<<(n))
#define Last(i) ( (i) & (-i) )
#define all(v) ((v).begin()), ((v).end())
#define sq(x) ((x) * (x))
#define INF INT_MAX
#define Ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

//-------------------------------------------------------------//
#ifndef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1<<" | ";
    __f(comma+1, args...);
}
#else
#define debug(...)
#endif
#define _ist_ cout << "\nSTART OF INPUT DISPLAYING CHECK\n";
#define _iend_ cout << "\nEND OF INPUT DISPLAYING CHECK\n";
//------------------------------------------------------------//
template<class T, class T2>
T _f_pow(T a, T2 b)
{
    T res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
#define N (int)1e3+5
const int mod = (int)1e9 + 7;
int dp[N][N];
char grid[N][N];
int h, w;

int _count(int i = 0, int j = 0)
{
    if(i == h - 1 && j == w - 1)
        return 1;
    if(i == h || j == w)
        return 0;
    int& ret = dp[i][j];

    if(~ret)
        return (ret%mod);
    ret = 0;
    if(i + 1 < h && j < w && grid[i + 1][j]=='.')
        ret += _count(i + 1, j), ret%=mod;
    if(i < h && j + 1 < w && grid[i][j + 1]=='.')
        ret += _count(i, j + 1), ret %= mod;
    ret%=mod;
    return ret;
}
int main()
{
    Ios;
    //inn;//outt;
    //auto tt = clock();
    cin >> h >> w;
    lp(i, h)
    {
        lp(j, w)
        {
            cin >> grid[i][j];
        }
    }
    clr(dp, -1);
    cout << _count() << "\n";
    //cout << (double(clock() - tt)/CLOCKS_PER_SEC * 1.00) << endl;
    return 0;
}


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

int main(){
  double N;
  cin >>N;
  vector<double> a(N);
  double ave=0;
  for(int i=0;i<N;i++){
    cin >> a.at(i);
    ave += a.at(i);
  }
  ave /= N;
  int b = round(ave);
  int ans=0;
  for(int i=0;i<N;i++){
    ans += (a.at(i)-b)*(a.at(i)-b);
  }
  cout << ans << endl;
}

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

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

const int N = 2e5+23;

int a[N], h[N];

void solve() {
	int n; scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", a+i);
		++h[a[i]];
	}
	long long ans = 0;
	for (int i = 0; i < N; ++i) {
		ans += (long long)h[i]*(h[i]-1)/2;
	}
	for (int i = 0; i < n; ++i) {
		printf("%lld\n", ans-h[a[i]]+1);
	}
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n,k;cin >> n >> k;
    double ans = 0;
    for(int i = 1;i <= n;i++){
        double tmp = 1;
        int cnt =0;
        int now = i;
        while(now < k){
            now *= 2;
            cnt++;
        }
        

        tmp /= pow(2.0,cnt);
        
        ans += tmp;

    }
    printf("%12.12lf",ans/n);
    return 0;
}


Measured memory_bytes: 4136
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
//#define int long long

const long long infl = 1e18; 
const int N = 3e5 + 300, N2 = 2e3, inf = 1e9 + 200;

set <int> S;
vector <int> g;
int n, m, k;
int a[N], d[N];
string ss;

int rast(int x, int y){
	return abs(a[x] - a[y]);
}

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	for (int i = 1; i < n; i++){
		int mn = 1e9;
		for (int j = max(0, i - k); j < i; j++){
			mn = min(mn, d[j] + rast(i, j));
		}
		d[i] = mn;
	}
	cout << d[n - 1];
	return 0;
}












Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int H, N, A;
    cin >> H >> N;

    int n = 0;

    for (int i = 0; i < N; i++) {
        cin >> A;
        n += A;
    }

    cout << ((n >= H) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long n, d = 0;
    cin >> n;
    long long l[n];
    for (long long i = 0; i < n; i++) cin >> l[i];
    if (n <= 2) cout << "0";
    else
    {
        sort(l, l + n);
        for (long long i = 0; i < n - 2; i++)
        {
            for (long long j = i + 1; j < n - 1; j++)
            {
                if (l[j] != l[i])
                {
                    for (long long k = j + 1; k < n; k++)
                    {
                        if (l[i] + l[j] > l[k])
                        {
                            if (l[j] != l[k]) d++;
                        }
                        else break;
                    }
                }
                else continue;
            }
        }
        cout << d;
    }
}

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testcase=1;
    //cin>>testcase;
    for(int p=0;p<testcase;p++){
        string a,b;
        cin>>a>>b;
        a=a+b;
        int x=stoi(a);
        float y=sqrt(x);
        if(ceil(y)==floor(y))
            cout<<"Yes";
        else
            cout<<"No";


    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	string s;
	cin >> s;
	int a = ((int)s.at(5)-'0') * 10 + (int)(s.at(6)- '0');
	if (a < 5) cout << "Heisei" << endl; else cout << "TBD" << endl;
}


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

int main()
{
    int a;
    string s;
    cin>>a;
    cin>>s;
    if(a<3200)
    {
        cout<<"red";
    }
    else
    {
        cout<<s;
    }
       
}

Measured memory_bytes: 512
import java.util.*;
public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int D = sc.nextInt();
    int[][] X = new int[N][D];
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < D; j++) {
        X[i][j] = sc.nextInt();
      }
    }
    sc.close();

    int count = 0;
    double distance = 0.0;

    for (int i = 0; i < N; i++) {
      for (int j = i; j < N; j++){
        if (i != j){
          distance = 0.0;
          for (int k = 0; k < D; k++) {
            distance += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
          }
          if (Math.sqrt(distance) % 1 == 0){
            count++;
          }
        }
      }
    }
    
    System.out.println(count);

  }
  
}

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

int main () {
    int n; cin >> n;
    int ans = 0;
    vector<int> d(n);
    rep(i, n) cin >> d[i];
    for (int i = 0; i < n ; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using namespace std;
const int N=2e2+10;
const int inf = /*0x3f3f3f3f*/1e9+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
string s[N];int dp[N][N];
void solve(){
  int n,m;cin>>n>>m;memset(dp,inf,sizeof dp);
  for(int i=0;i<n;i++)cin>>s[i];
  int dx[]={0,1},dy[]={1,0};dp[0][0]=(s[0][0]=='#');
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
      for(int k=0;k<2;k++){
        if(i+dx[k]<n and j+dy[k]<m and s[i][j]=='.' and s[i+dx[k]][j+dy[k]]=='#')
          dp[i+dx[k]][j+dy[k]]=min(dp[i+dx[k]][j+dy[k]],1+dp[i][j]);
        else if(i+dx[k]<n and j+dy[k]<m)dp[i+dx[k]][j+dy[k]]=min(dp[i+dx[k]][j+dy[k]],dp[i][j]);
      }
  //we find out number of unconnected components of black on the simplest
  //paths from 0,0 to n,m
  //this is because for every connected black component we can uniquely find
  //pairs {r1,r2},{c1,c2} such that the connected component becomes white
  cout<<dp[n-1][m-1];
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
typedef std::vector<long long > vi ;
#define F first
#define S second
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define PB push_back
#define MP make_pair
#define PI 3.14159265358979323846
#define all(a) a.begin(),a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define endl '\n'
#define show(a) for(auto el:a)cout<<el<<" "
const ll INF=LLONG_MAX/2;
const ll N=2e5+1;
#define yesno(f) yes(f);no(f);
#define yes(f) if(f)cout<<"YES\n";
#define no(f) if(!f)cout<<"NO\n";
using  namespace std;
ll pow1(ll n,ll p)
{
	if(p==0)	return 1;
	ll x=pow1(n, p/2);
	x=(x*x);
	if(p%2==0)
		return x;
	else
		return (x*n);
}
int main()
{
    fast;
   ll t=1;
    //std::cin >> t;
   while(t--)
   {
       ll n,w,x=0,sum=0;
       std::cin >> n;
       ll a[n];
       fr(i,0,n)
       std::cin >> a[i];
       fr(i,0,n)
       {
           if(a[i]%2==0)
           {
               if(a[i]%3!=0&&a[i]%5!=0)
               x=1;
           }
           if(x==1)
           break;
       }
       if(x==0)
       cout<<"APPROVED\n";
       else
       cout<<"DENIED\n";

   }
}

Measured memory_bytes: 3548
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

prev = -1
seq = 1
ans = 0
for a in A:
    if a == prev:
        seq += 1
    else:
        prev = a
        ans += seq//2
        seq = 1
ans += seq//2
print(ans)


Measured memory_bytes: 3060
N=int(input())
A=N//1000
N-=A*1000
B=N//100
N-=B*100
C=N//10
N-=C*10
D=N
if A+B+C+D==7:
    print('%d+%d+%d+%d=7' %(A,B,C,D))
elif A-B+C+D==7:
    print('%d-%d+%d+%d=7' %(A,B,C,D))
elif A+B+C-D==7:
    print('%d+%d+%d-%d=7' %(A,B,C,D))
elif A+B-C+D==7:
    print('%d+%d-%d+%d=7' %(A,B,C,D))
elif A-B-C+D==7:
    print('%d-%d-%d+%d=7' %(A,B,C,D))
elif A+B-C-D==7:
    print('%d+%d-%d-%d=7' %(A,B,C,D))
elif A-B+C-D==7:
    print('%d-%d+%d-%d=7' %(A,B,C,D))
elif A-B-C-D==7:
    print('%d-%d-%d-%d=7' %(A,B,C,D))

Measured memory_bytes: 3064
//Author: Lixiang
#include<stdio.h>
#include<iostream>
using namespace std;
struct C{
	long long N;
	void init(){
		cin>>N;
	}
	void work(){
		long long zi,mu,h,n;
		for(h=1;h<=3500;h++)
			for(n=1;n<=3500;n++){
				zi=4*h*n-N*(h+n);
				mu=N*h*n;
				if(zi>0&&mu%zi==0){
					cout<<h<<" "<<n<<" "<<mu/zi;
					return ;
				}
			}
	}
}sol;
int main(){
	sol.init();
	sol.work();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int a, b, c; cin >> a >> b >> c;
    cout << min(min(a+b, a+c), b+c) << endl;
}

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

struct die {
	int val[6];
	void N() {
		int tmp[6];
		for (int i = 0; i < 6; i++) {
			tmp[i] = val[i];
		}
		val[0] = tmp[1];
		val[1] = tmp[5];
		val[5] = tmp[4];
		val[4] = tmp[0];
	}
	void E() {
		int tmp[6];
		for (int i = 0; i < 6; i++) {
			tmp[i] = val[i];
		}
		val[2] = tmp[0];
		val[5] = tmp[2];
		val[3] = tmp[5];
		val[0] = tmp[3];
	}
	void W() {
		int tmp[6];
		for (int i = 0; i < 6; i++) {
			tmp[i] = val[i];
		}
		val[3] = tmp[0];
		val[5] = tmp[3];
		val[2] = tmp[5];
		val[0] = tmp[2];
	}
	void S() {
		int tmp[6];
		for (int i = 0; i < 6; i++) {
			tmp[i] = val[i];
		}
		val[0] = tmp[4];
		val[1] = tmp[0];
		val[5] = tmp[1];
		val[4] = tmp[5];
	}
	int find(int a, int b) const {
		if ((val[3] == a && val[1] == b) || (val[1] == a && val[2] == b) || (val[2] == a && val[4] == b) || (val[4] == a && val[3] == b)) {
			return val[0];
		}
		if ((val[3] == a && val[5] == b) || (val[5] == a && val[2] == b) || (val[2] == a && val[0] == b) || (val[0] == a && val[3] == b)) {
			return val[1];
		}
		if ((val[0] == a && val[1] == b) || (val[1] == a && val[5] == b) || (val[5] == a && val[4] == b) || (val[4] == a && val[0] == b)) {
			return val[2];
		}
		if ((val[0] == a && val[4] == b) || (val[4] == a && val[5] == b) || (val[5] == a && val[1] == b) || (val[1] == a && val[0] == b)) {
			return val[3];
		}
		if ((val[0] == a && val[2] == b) || (val[2] == a && val[5] == b) || (val[5] == a && val[3] == b) || (val[3] == a && val[0] == b)) {
			return val[4];
		}
		if ((val[3] == a && val[4] == b) || (val[4] == a && val[2] == b) || (val[2] == a && val[1] == b) || (val[1] == a && val[3] == b)) {
			return val[5];
		}
	}
};

bool operator==(const die& a, const die& b) {
	vector<int> aa, bb;
	for (int i = 0; i < 6; i++) {
		aa.push_back(a.val[i]);
	}
	for (int i = 0; i < 6; i++) {
		bb.push_back(b.val[i]);
	}
	sort(aa.begin(), aa.end());
	sort(bb.begin(), bb.end());
	if (aa == bb) {
		for (int i = 0; i < 6; i++) {
			for (int j = i + 1; j < 6; j++) {
				if (a.find(aa[i], aa[j]) != b.find(aa[i], aa[j])) {
					return false;
				}
			}
		}
		return true;
	}
	else {
		return false;
	}
}

int main()
{
	die a, b;
	for (int i = 0; i < 6; i++) {
		cin >> a.val[i];
	}
	for (int i = 0; i < 6; i++) {
		cin >> b.val[i];
	}
	cout << (a == b ? "Yes" : "No") << endl;
	return 0;
}

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

using namespace std;
//DP用
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;
}

//a^n mod を計算する関数
long long modpow(long long a,long long n,long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n % 2 == 1) {
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//a^(-1) mod すなわちaの逆元を返す関数
long long modinv(long long a,long long mod) {
    return modpow(a,mod-2,mod);
}

//最大公約数をを返す関数
long long gcd (long long a,long long b) {
    if(a % b == 0) {
        return b;
    }else {
        return (gcd(b,a%b));
    }
}

const long long INF = 1LL << 60;
const long long P = 1000000007;

//nCkを求める関数
long long conbi (long long n,long long k) {
    long long res = 1;
    long long inv;
    for(long long i = n-k+1; i <= n; i++) {
        res *= i;
        res %= P;
    }
    for(long long i = 1; i <= k; i++) {
        inv = modinv(i,P);
        res *= inv;
        res %= P;
    }
    return res;
}

int main() {
    double l;
    cin >> l;
    double size = l*l*l/27;
    printf("%.12lf",size);
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
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;}

//INSERT ABOVE HERE
signed main(){
  Int x,y,z,k;
  cin>>x>>y>>z>>k;
  vector<Int> a(x),b(y),c(z);
  for(Int i=0;i<x;i++) cin>>a[i];
  for(Int i=0;i<y;i++) cin>>b[i];
  for(Int i=0;i<z;i++) cin>>c[i];
  sort(a.rbegin(),a.rend());
  sort(b.rbegin(),b.rend());
  sort(c.rbegin(),c.rend());

  priority_queue<Int, vector<Int>, greater<Int> > pq;
  for(Int i=0;i<x;i++){
    for(Int j=0;j<y;j++){
      for(Int p=0;p<z;p++){
        if((Int)pq.size()<k){
          pq.emplace(a[i]+b[j]+c[p]);
          continue;
        }
        if(pq.top()>=a[i]+b[j]+c[p]) break;
        pq.emplace(a[i]+b[j]+c[p]);
        pq.pop();
      }     
    }
  }
  
  vector<Int> ans;
  while(!pq.empty()) ans.emplace_back(pq.top()),pq.pop();
  reverse(ans.begin(),ans.end());

  for(Int v:ans) cout<<v<<endl;
  return 0;
}


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

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
     ll n;

     cin>>n;
     ll a[n];
     for(ll i=0;i<n;i++)
     {
         cin>>a[i];
     }
     ll ans=0;
     for(ll i=0;i<n-2;i++)
     {
         for(ll j=i+1;j<n-1;j++)
         {
             for(ll k=j+1;k<n;k++)
             {
                 if((a[i]+a[j])>a[k] && (a[i]+a[k])>a[j] && (a[k]+a[j])>a[i] && a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k])
             {
                 ans++;
               
             }
             }
         }
     }
   cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3644
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(new InputStreamReader(System.in))) {
            while (sc.hasNextInt()) {
                int cellCount = sc.nextInt();
                int diceCount = sc.nextInt();

                if (cellCount == 0) {
                    return;
                }

                List<SugorokuCell> cells = readCells(sc, cellCount);
                int[] dices = readDices(sc, diceCount);

                int result = countGoalStep(cells, dices);
                System.out.println(result);
            }
        }
    }

    private static int[] readDices(Scanner sc, int diceCount) {
        int[] dices = new int[diceCount];

        for (int i = 0; i < diceCount; i++) {
            dices[i] = sc.nextInt();
        }

        return dices;
    }

    private static List<SugorokuCell> readCells(Scanner sc, int cellCount) {
        List<SugorokuCell> cells = new ArrayList<>();

        for (int i = 0; i < cellCount; i++) {
            int cellNo = i;
            int offset = sc.nextInt();
            cells.add(new SugorokuCell(cellNo, offset));
        }

        return cells;
    }

    private static int countGoalStep(List<SugorokuCell> cells, int[] dices) {
        int currentCell = 0;
        int goalCell = cells.size() - 1;

        for (int i = 0; i < dices.length; i++) {
            int dice = dices[i];
            currentCell += dice;

            if (goalCell <= currentCell) {
                return i + 1;
            }

            SugorokuCell cell = cells.get(currentCell);
            currentCell += cell.getOffset();

            if (goalCell <= currentCell) {
                return i + 1;
            }

            if (currentCell < 0) {
                currentCell = 0;
            }

        }

        throw new RuntimeException("This line not be execute, "
                + "Because every inputs can be resolve");
    }

    public static class SugorokuCell {
        private final int cellNo;
        private final int offset;

        public SugorokuCell(int cellNo, int offset) {
            this.cellNo = cellNo;
            this.offset = offset;
        }

        public int getCellNo() {
            return cellNo;
        }

        public int getOffset() {
            return offset;
        }
    }
}

Measured memory_bytes: 36772
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int main() {
	int N, A[100010], B[100010]; cin >> N;
	for(int i=0; i<N; ++i){
	    cin >> A[i];
	    B[i]=A[i];
	}
	sort(B, B+N);
	map<int, int> mp;
	for(int i=0; i<N; ++i) mp[B[i]]=i;
	int cnt=0;
	for(int i=0; i<N; ++i){
	    if(i%2!=mp[A[i]]%2) ++cnt;
	}
	cout << (cnt+1)/2 << endl;
	return 0;
}


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

int main(void){
    string S;
    cin >> S;
    if(S == "Sunny"){
        cout << "Cloudy" << endl;
    }
    else if(S == "Cloudy"){
        cout << "Rainy" << endl;
    }
    else if(S == "Rainy"){
        cout << "Sunny" << endl;
    }
    else{
        // Do nothing
    }
}


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

int main(){
    int a, b, c, d;
    cin >> a>> b>> c>> d;
    a=a+b;
    c=c+d;

    if (a > c) {
        cout << "Left" << endl;
    }
    else if (a == c) {
        cout << "Balanced" << endl;
    }
    else {
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
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; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;


int main(){

char c[9];
rep(i,9)cin >> c[i];

cout << c[0] << c[4] << c[8] << endl;


return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 100000000000000009
#define int long long
using P = pair<int,int>;
signed main(){
  int r,g,b,n;
  cin >> r >> g >> b >> n;
  int rcount = n/r;
  int gcount = n/g;
  int bcount = n/b;
  int ans = 0;
  erep(i,rcount) erep(j,gcount) {
    if(r*i+g*j <= n) if((n - (r*i+g*j)) % b == 0) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	const int cf[2] = { 'C','F' };
	int num = 0;
	string s; cin >> s;
	for (int i = 0; i < s.size(); i++){
		if (num == 2) {
			cout << "Yes\n";
			return 0;
		}
		else if (s[i] == cf[num])num++;
	}
        if (num == 2) {
			cout << "Yes\n";
			return 0;
		}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
a = 1;
treat = 0;
n, k = map(int, input().split());

data = [input().split() for l in range(2*k)]


while a <= n:
    b = 0;
    d = 0;
    
    while b < k:
        search = int(data[2*b][0]);
        c = 0;
        
        while c < search:
            x = int(data[2*b+1][c]);
            if x == a :
                d = d + 1;
            c = c + 1
            
        b = b + 1;
        
    if d == 0:
        treat = treat + 1;
        
    a = a + 1;

print(treat);

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

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

const int MAX=1<<18;
const ll INF=0x3f3f3f3f3f3f3f;
ll h,w,s[3],ans=INF;
int main(){
    scanf("%lld%lld",&h,&w);
    if(h%3==0||w%3==0){
        printf("0\n");
        return 0;
    }
    else{
        ans=min(ans,h),ans=min(ans,w);
        for(int i=1;i<h;i++) {
            s[0]=i*w,s[1]=(w/2)*(h-i),s[2]=(w-(w/2))*(h-i);
            sort(s,s+3);
            ans=min(ans,s[2]-s[0]);
        }
        for(int i=1;i<w;i++) {
            s[0]=i*h,s[1]=(h/2)*(w-i),s[2]=(h-(h/2))*(w-i);
            sort(s,s+3);
            ans=min(ans,s[2]-s[0]);
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (ll i = begin; i < (ll)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll N, M, K;
    cin >> N >> M >> K;
    rep(0, i, N + 1)
    {
        rep(0, j, M + 1)
        {
            ll sum;
            sum = M * i + N * j - 2 * max(i, j) * min(i, j);
            if (sum == K)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <cstring>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll N,K;
ll arr[3000];
ll bigR[3000],bigL[3000];
ll ksm(ll a,ll b){
    ll res = 1;
    while(b){
        if(b&1) res = res*a%mod;
        a = a*a%mod;
        b>>=1;
    }
    return res;
}

int main(){
    cin>>N>>K;
    for(int i = 0;i<N;i++){
        scanf("%lld",&arr[i]);
    }
    for(int i = 0;i<N;i++){
        for(int j = 0;j<N;j++){
            if(arr[i]>arr[j]) bigR[i]++;
        }
    }
    for(int i = 0;i<N;i++){
        for(int j = 0;j<i;j++){
            if(arr[j]<arr[i]) bigL[i]++;
        }
    }
    ll res = 0;
    for(int i = 0;i<N;i++){
        res = (res + K*(bigR[i]+K*bigR[i]%mod)%mod*ksm(2,mod-2)%mod)%mod;
        res = (res - K*bigL[i] + mod)%mod;
    }
    cout<<(res+mod)%mod<<endl;
    
    
    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	int ans=0;
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		if(i&1&&x&1) ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 3820
#include<bits/stdc++.h>
using namespace std;
#define ff          first
#define ss          second
#define ll         	long long int
#define pb          push_back
#define ar 			array
#define mp 			make_pair
#define f(i,n)   	for(ll i =0;i<n;i++)
#define inf 		INT_MAX
#define pll 		pair<ll, pair<ll,ll>>
const ll INF = 1e18;
void init(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE 
		freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#endif
}
void solve(){
	ll a,b;
	cin>>a>>b;
	char c;
	cin>>c;
	ll d;
	cin>>d;
	b *= 100;
	b += d;
	ll ans = a*b;
	ans = ans /100;
	cout<<ans<<endl;
	
}
int main(){
	init();
	ll t = 1;
	//cin>>t;
	for(ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
		solve();
	}
}


Measured memory_bytes: 3588
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

end = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

if d1 == end[m1-1]:
    print(1)
else:
    print(0)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int M;
    cin>>M;
    vector<int> mo(M,0);
    REP(i,M)cin>>mo[i];
    int D;
    cin>>D;
    vector<int> ans(D,0);
    REP(i,D){
        int q,x,sum=0;
        cin>>q>>x;
        REP(y,M){
            if(y+1!=q)sum+=mo[y];
            else sum+=x;
        }
        ans[i]=sum;
    }
    REP(i,D)cout<<ans[i]<<endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	if abs(c-a) <= d || (abs(a-b) <= d && abs(c-b) <= d) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 512
import sys
INF = 10**18
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N,W = LI()
dp = [INF for _ in range(N*1000+1)]

dp[0] = 0
for i in range(N):
    w,v = LI()
    for j in range(len(dp)-1,0,-1):
        if j-v < 0: continue
        dp[j] = min(dp[j],dp[j-v]+w)

ans = 0
for i in range(len(dp)-1,0,-1):
    if dp[i] <= W:
        ans = i
        break
print(ans)

Measured memory_bytes: 45040
#include <iostream>
#include <set>
// #include <algorithm>
 
using namespace std;
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	int N;
	cin >> N;
	multiset<int> set;
	for (int i = 0; i < N * 2; i++) {
		int x;
		cin >> x;
		set.insert(x);
	}
	int r = 0, a = 0;
	for (x : set) {
		r += x & ~-(a++ & 1);
	}
	cout << r << endl;
	return 0;
}
 

Measured memory_bytes: 256
from sys import stdin
import numpy as np
from operator import itemgetter 

N = int(stdin.readline())

#[競プロ等におけるpython3の標準入力 \- Qiita](https://qiita.com/zenrshon/items/c4f3849552348b3dbe67)
SP = []
for i in range(N):
    s,p = input().split()
    SP.append([s,int(p),i+1])

# [ソート HOW TO — Python 3\.7\.3 ドキュメント](https://docs.python.org/ja/3/howto/sorting.html)
# [sorted\(a, key=lambda x:\(x\[0\],\-x\[1\]\)\)](https://pashango-p.hatenadiary.org/entry/20090614/1244984058)
SP = sorted(SP, key=lambda x:(x[0],-x[1]))

for x in SP:
     print(x[2])

Measured memory_bytes: 14516
n=int(input())
stones=list(map(int, input().split()))
infini=(10**4)*(10**5)
dp = [infini for _ in range(n)]
dp[0]=0

for pos in range(0, n-1):
   dp[pos+1] = min(dp[pos+1], dp[pos] + abs(stones[pos] - stones[pos+1]))
   if pos <= n-3:
      dp[pos+2] = min(dp[pos+2], dp[pos] + abs(stones[pos] - stones[pos+2]))
print(dp[-1])


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

int main(){
  int count, i;
  cin >> count;
  int array[count];
  for(i = 0; i < count; i++){
    cin >> array[count - i - 1];
  }
  for(i = 0; i < count; i++){
    cout << array[i];
    if(i != count - 1){
      cout << " ";
    }
  }
  cout << endl;
  return 0;
}



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

int main() {
    int x[3000], y[3000];
    for(int i=0; i<3000; i++) {
        cin >> x[i] >> y[i];
        if(x[i]==0&&y[i]==0) {
            return 0;
        }
        cout << min(x[i], y[i]) << ' ' << max(x[i], y[i]) << endl;
    }
    return 0;
}


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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

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



int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    vi a(n+1) , b(n);
    for(int &x : a)cin >> x;
    for(int &x : b)cin >> x;

    ll ans = 0;
    loop(i,n){
        int mn = min(b[i] , a[i]);
        ans += mn;
        b[i] -= mn;
        a[i] -= mn;
        mn = min(b[i] , a[i+1]);
ans += mn;
        b[i] -= mn;
        a[i+1] -= mn;

    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int num,c,sum=0;
		scanf("%d %d",&num,&c);num--;
		int y = 127-c;
		sum = 127 * num;
		if(num%2 == 0){
			sum+=c;
		}else{
			sum+=y;
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
        int[] list = new int[5];
        for (int i = 0; i < 5; i++) {
          list[i] = sc.nextInt();
        }
        int k = sc.nextInt();
        String ans = "Yay!";
        for (int i = 0; i < 5; i++) {
          int value = list[i];
          for (int index = i + 1; index < 5; index++) {
            if (Math.abs(value - list[index]) > k) {
              ans = ":(";
              break;
            }
          }
        }
              
		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 21332
#include <stdio.h>
#include <math.h>

int main(){
	
	long long X; scanf("%lld", &X);
	
	long long k = sqrt(1 + 8 * X);
	long long plus = 1;
	if(k * k == (1 + 8 * X))
		plus = 0;
		
	long long ans = (k - 1) / 2 + plus;
	
	printf("%lld", ans);
	
return 0;	
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;

int main()
{
    int a,b,k;
    int temp;
    scanf("%d%d%d",&a,&b,&k);
    int m = k;
    while(k--)
    {
        if(a%2)
        {
            a--;
        }
        a /= 2;
        b += a;
        temp = a;
        a = b;
        b = temp;
    }
    if(m%2 == 0)
        printf("%d %d\n",a,b);
    else printf("%d %d\n",b,a);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;

void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const ll MAXN = 1e6 + 10;
const ll N = 4000 + 10;
const ll MN = 200 + 10;
const ll mod = 1e6;

ll a[MAXN];

int main()
{
	faster();
	ll sum = 0;
	for (int i = 0; i < 3; i++)
	{
		cin >> a[i];
	}
	sort(a, a + 3);
	ll k;
	cin >> k;
	while(k)
	{
		a[2] *= 2;
		k--;
	}
	for (int i = 0; i < 3; i++)
		sum += a[i];
	cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int[] x=new int[n+1];
		int[] y=new int[n+1];
		int sum=0,num=0;
		for(int i=0;i<m;i++) {
			int a=sc.nextInt();
			String s=sc.next();
			if(y[a]==-1)
				continue;
			if(s.equals("AC")) {
				x[a]=1;
				num+=y[a];
				y[a]=-1;
			}else {
				y[a]++;
			}
		}
		for(int i=0;i<n+1;i++) {
			if(x[i]>0)
				sum++;
		}
		System.out.print(sum+" "+num);
	}
} 

Measured memory_bytes: 65740
#include <algorithm>
#include <cmath>
#include <chrono>
#include <cstdio>
#include <ctime>
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
/*---------------------------------------*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int k; cin >> k;
  if (k % 2 == 0) {
    cout << (k / 2) * (k / 2);
  } else {
    cout << (k / 2) * (k / 2 + 1);
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

const ll MOD = 1e9 + 7;
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}

const int MX = 6000;

int n, k;
ll dp[110][MX];

void add(ll &a, ll b) {
	a += b;
	if (a >= MOD)
		a -= MOD;
}

int main() {
	cin >> n >> k;
	dp[n + 1][0] = 1;
	for (int i = n; i >= 1; --i) {
		for (int j = 0; j < MX; ++j) {
			if (dp[i + 1][j] == 0)
				continue;
			for (int l = 0; l <= k; ++l) {
				if (l > i) {
					add(dp[i][j], dp[i + 1][j]);
				}
				else  {
					add(dp[i][j + (j + l) / i], dp[i + 1][j]);
				}
			}
		}
	}
	ll ans = n * pw(k + 1, n) % MOD * k % MOD * (MOD / 2 + 1) % MOD;
	for (int i = 0; i < MX; ++i)
		ans = (ans - i * dp[1][i] % MOD + MOD) % MOD;
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std; 
using lint  =                           long long int;
using pint  =                           pair<int, int>;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD                             1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool mmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }


/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

void solve(){  
   int N;
   cin >> N;
   string S;
   cin >> S;

   int i = 0;
   int count = 0;
   while(i < N){
       char curr = S[i];
       while(i < N && S[i] == curr){
           ++i;
       }
       ++count;
   }
   cout << count << endl;
}

int main(){   
  
 solve();

 return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int N;
int main() {
  cin >> N;
  printf("ABC%03d\n", N);
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main{

	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner(System.in);
		int n;
		long x;
		n = sc.nextInt();
		x = sc.nextLong();
		long[] a = new long[n];
		for(int i=0; i<n; i++) a[i] = sc.nextLong();
		long[] b = a.clone();
		long ans=Long.MAX_VALUE;
		for(int k=0; k<n; k++) {
			long acc=0;
			long xk = ((long)x)*k;
			for(int i=0; i<n; i++) {
				b[i]=Math.min(b[i], a[(i-k+n)%n]);
				acc+=b[i];
			}
			ans=Math.min(ans, acc+xk);
		}
		System.out.println(ans);
	}

	static class MyScanner
	{
		BufferedReader br;
		StringTokenizer st;
		public MyScanner(InputStream s) 
		{
			br=new BufferedReader(new InputStreamReader(s));
		}
		public String nextLine() throws IOException
		{
			return br.readLine();
		}
		public String next() throws IOException
		{
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
			
		}
		public double nextDouble() throws IOException
		{
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException
		{
			return br.ready();
		}
		public long nextLong() throws IOException
		{
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 25708
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

int main() {
	ll H,W;
	cin >> H >> W;
	
  	ll S1case1,case1=MOD,S1case2,case2=MOD;
	if(H>=3){
		S1case1=(ceil((double)H/3))*W;
		case1=S1case1-(H/3)*W;
	}
	if(W>=3){
		S1case2=(ceil((double)W/3))*H;
		case2=S1case2-(W/3)*H;
	}

	ll st=0,mina=MOD;
  	ll S1case3,S2case3;
	REP(h,H){
		S1case3=(h+1)*W;
		mina=min(abs(S1case3-H*W/3),mina);
		if(mina==abs(S1case3-H*W/3)){
			S2case3=S1case3;
			st=(h+1);
		}
	}
	ll S3case3=(H-st)*(W/2);//小
	ll S4case3=(H-st)*ceil((double)W/2);//大
	ll case3=max(S4case3,S2case3)-min(S3case3,S2case3);
	//cout<<S2case3<<" "<<S3case3<<" "<<S4case3<<endl;
	st=0,mina=MOD;
  	ll S1case4,S2case4;
	REP(w,W){
		S1case4=(w+1)*H;
		mina=min(abs(S1case4-W*H/3),mina);
		if(mina==abs(S1case4-W*H/3)){
			S2case4=S1case4;
			st=(w+1);
		}
	}
	ll S3case4=(W-st)*(H/2);//小
	ll S4case4=(W-st)*ceil((double)H/2);//大
	ll case4=max(S4case4,S2case4)-min(S3case4,S2case4);
	//cout<<case1<<" "<< case2<<" "<<case3<<" "<<case4<<endl;
	ll ans=min(min(case1,case2),min(case3,case4));
	cout << ans << endl;
	return 0;
}

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

int main(){
	int n, d, ans=0; cin >> n >> d;
  	while(n--){
      int x,y; cin >> x >> y;
      if(sqrt(pow(x,2) + pow(y,2)) <= d ) ++ans;
      
    }
  	cout << ans <<"\n";
      return 0;
}


Measured memory_bytes: 3620