akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
// #include <fstream>
#define typeof(x) __typeof__(x)
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(c) (c).begin(),(c).end()
#define SIZE(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (int)(UB(c,x)-LB(c,x))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

using namespace std;

typedef pair<int,int> P;
struct edge {
  int to, cost;
};

const int INF = 1e18;
const int MOD = 998244353;

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " ";
  }
  return s;
}

int frac[(int)1e7+1];
void init_frac(int N) {
  frac[0] = 1;
  for (int i = 1; i <= N; i++) {
    frac[i] = mod(frac[i-1] * i);
  }
}

// int powM(int x, int n){
//   if(n == 0){
//     return 1;
//   }
//   if(n % 2 == 0){
//     return powM(mod(x * x), n / 2);
//   }
//   return mod(powM(x, n-1) * x);
// }
int powM(int x, int n) {
  int res = 1;
  while (n > 0) {
    if ((n & 1) == 1) {
      res = mod(res * x);
    }
    x = mod(x * x);
    n >>= 1;
  }
  return res;
}

int inverse(int x) {
  return powM(x, MOD-2);
}

int comb(int n, int r) {
  if (n < 0 || n-r < 0 || r < 0) {
    return 0;
  }
  return mod(frac[n] * inverse(mod(frac[n-r]*frac[r])));
}


signed main()
{
  // string filename; cin >> filename;
  // ifstream in(filename);
  // cin.rdbuf(in.rdbuf());

  int K, N; cin >> K >> N;
  init_frac(1e7);

  rep(i, 2, 2*K+1) {
    if (i % 2 == 1) {
      int idx = min(i, 2*K+2-i);
      int n = (idx-1)/2;
      int s = 0;
      rep(j, 0, n+1) {
        s = mod(s + mod(comb(n, j) * mod(powM(2, j) * comb(N-j + K-idx+j, K-idx+j))));
      }
      printf("%lld\n", s);
    } else {
      int idx = min(i, 2*K+2-i);
      int n = idx/2 - 1;
      int s = 0;
      rep(j, 0, n+1) {
        s = mod(s + mod(comb(n, j) * mod(powM(2, j) * mod(comb(N-j + K-idx+j, K-idx+j) + comb(N-j-1 + K-idx+j, K-idx+j)))));
      }
      printf("%lld\n", s);
    }
  }
  return 0;
}


Measured memory_bytes: 78464
#include<bits/stdc++.h>
#define mp make_pair
#define x first
#define y second
#define pll pair<LL,LL>
#define pii pair<int,int>
#define LL long long
#define pb push_back
#define pi acos(-1)
#define pdd pair<double,double>
#define MEM(x) memset(x,0,sizeof(x))
#define EPS 1e-7
using namespace std;
int main(){
    char c[200005];
    scanf("%s",c);
    for(int i = 0;c[i]!=0;i++){
        if(c[i]=='?')printf("D");
        else printf("%c",c[i]);
    }
    printf("\n");
}
/*
2 11 14
9 3


000111222
001112220
*/

Measured memory_bytes: 3844
import scala.annotation.tailrec
import scala.io.StdIn

object Main extends App {
  val S = StdIn.readLine()

  @tailrec
  def rec(currentIdx: Int = 0): Boolean = {
    if (currentIdx == 3) {
      true
    } else {
      if (S.charAt(currentIdx) == S.charAt(currentIdx + 1)) {
        false
      } else {
        rec(currentIdx + 1)
      }
    }
  }

  if (rec()) {
    println("Good")
  } else {
    println("Bad")
  }
}

Measured memory_bytes: 25424
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void Yes()
{
	OUT("Yes");
}
void No()
{
	OUT("No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

// 素数判定 O(sqrt(N)) (N=10^7 で O(10^3))
bool IsPrime(ll num)
{
    if (num < 2) return false;
    if (num == 2) return true;
    if (num % 2 == 0) return false;

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

    return true;
}

// 各桁の和を計算 O(logN) (N=10^7 で O(7))
ll DigSum(ll n)
{
	ll sum = 0;
	while(n != 0){
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll n;

	ll m = 99999999;

	FOR(i, 1, n)
	{
		m = min(m, DigSum(i) + DigSum(n - i));
	}

	return OUT(m);
}


Measured memory_bytes: 256
#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>
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 stop char nyaa;cin>>nyaa;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

using P = pair<int, int>;

void solve() {
	int n; cin >> n;
	vector<ll> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	ll ma = 0;
	vector<ll> b;
	rep(i, n) {
		int le = i;
		while (i + 1 < n&&a[i] == a[i + 1])i++;
		int cnt = i - le + 1;
		if (cnt >= 4) {
			ma = max(ma, a[i] * a[i]);
		}
		if (cnt >= 2) {
			b.push_back(a[i]);
		}
	}
	if (b.size() >= 2) {
		sort(b.begin(), b.end(), greater<ll>());
		ma = max(ma, b[0] * b[1]);
	}
	cout << ma << endl;
}


int main() {
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 1660
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
vector<string> a;
string x;
int N,t;
int main()
{
	cin>>N>>t;
	for(int i=0;i<N;i++)
	{
		string x;
		cin>>x;
		a.push_back(x);
	}
	sort(a.begin(),a.end());
	for(int i=0;i<N;i++)
		cout<<a[i];
	puts("");
	return 0;
}

Measured memory_bytes: 256
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 2e4 + 10;
ll a[maxn], b[maxn], p[maxn];
int n;
void solve() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        a[i] = 30000 * i;
        cin >> p[i];
        b[p[i] ] = i + 30000 * (n - p[i]);
    }
    for (int i = 1; i <= n; i++) {
        if(i != 1) cout << " ";
        cout << a[i];
    }
    cout << endl;
    for (int i = 1; i <= n; i++) {
        if(i != 1) cout << " ";
        cout << b[i];
    }
    cout << endl;

}
int main() {
   // freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    solve();
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
 
int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
 
    int cnt1 = 0;
    int cnt2 = 0;
 
    // 0101..., 1010...との距離を比較
    for (int i = 0; i < s.length(); i++)
    {
        if (i % 2 == 0)
        {
            if (s[i] == '0')
            {
                cnt1++;
            }
            else if (s[i] == '1')
            {
                cnt2++;
            }
        }
        else
        {
            if (s[i] == '0')
            {
                cnt2++;
            }
            else if (s[i] == '1')
            {
                cnt1++;
            }
        }
    }
 
    if (cnt2 < cnt1)
    {
        cnt1 = cnt2;
    }
 
    cout << cnt1 << '\n';
 
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

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

void solve() {
  int h, w;
  cin >> h >> w;
  vstr s(h);
  cin >> s;
  using P = tuple<int, int, int>;
  queue<P> q;
  vector<vi32> dp(h, vi32(w, 1e9));
  rep(i, h) rep(j, w) {
    if (s[i][j] == '#') {
      q.emplace(i, j, 0);
    }
  }
  while (q.size()) {
    int x, y, c;
    tie(x, y, c) = q.front();
    q.pop();
    if (dp[x][y] != 1e9) {
      continue;
    }
    dp[x][y] = c;
    rep(i, 4) {
      int wx = x + dx[i];
      int wy = y + dy[i];
      if (wx < 0 || wx >= h || wy < 0 || wy >= w) continue;
      if (dp[wx][wy] != 1e9) continue;
      q.emplace(wx, wy, c + 1);
    }
  }
  int ans = 0;
  rep(i, h) rep(j, w) {
    amax(ans, dp[i][j]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 29492
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math


n = int(input())
a = [int(i) for i in input().split()]

b = [0 for i in range(n+1)]
half = n//2
for i in range(n):
    if (i+1)%2==0:
        b[half+(i//2)+1] = a[i]
    else:
        b[half-(i//2)] = a[i]

b.remove(0)
if n%2==0:
    b.reverse()

for i in range(n):
    print(b[i],end=" ")
print("")


Measured memory_bytes: 28548
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
const int md=1000000007;
int n,m,a[101010],dp[101010];
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a[i];
		dp[a[i]]=-1;
	}
	dp[0]=1;
	if(dp[1]!=-1)
	{
		dp[1]=1;
	}
	if(dp[2]!=-1)
	{
		if(dp[1]==-1)
		{
			dp[2]=1;
		}
		else
		{
			dp[2]=2;
		}
	}
	for(int i=3;i<=n;i++)
	{
		if(dp[i]==-1)
		{
			continue;
		}
		dp[i]+=max(dp[i-1],0)+max(dp[i-2],0);
		dp[i]%=md;
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main() {
  int n;
  int b, f, r, v;
  int i, j, k;

  int tenants[4][3][10] = {{{}}};

  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    scanf("%d %d %d %d", &b, &f, &r, &v);
    tenants[b-1][f-1][r-1] += v;
  }

  for(i = 0; i < 4; ++i) {
    for(j = 0; j < 3; ++j) {
      for(k = 0; k < 10; ++k) {
	printf(" %d", tenants[i][j][k]);
      }
      printf("\n");
    }
    if(i != 3) printf("####################\n");
  }

  return 0;
}




Measured memory_bytes: 2108
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    int A, B, K;
    cin >> A >> B >> K;
    
    int bigger_number = max(A, B);
    int ans_count = 0;
    vector<int> devide_numbers(101);
    for ( int i = bigger_number; i > 0; i-- ) {
        if ( A % i == 0 && B % i == 0 ) {
            ans_count++;
            if (ans_count == K) {
                cout << i << endl;
                break;
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

vector<int> a;
int n, max1, max2, min1, min2, cost;

int main()
{
  cin>>n;
  a.push_back(0);
  REP(i,n) {
    int tmp;
    cin>>tmp;
    a.push_back(tmp);
  }
  a.push_back(0);

  REP(i,n+1) {
    cost += abs(a[i+1] - a[i]);
  }

  REP(i,n) {
    int pd = abs(a[i+1] - a[i]) + abs(a[i+2] - a[i+1]);
    int cd = abs(a[i+2] - a[i]);
    if (pd == cd) {
      cout<<cost<<endl;
    } else {
      cout<<cost - pd + cd<<endl;
    }
  }

  return 0;
}


Measured memory_bytes: 1784
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect

setrecursionlimit(10**7)

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

Ns = reads()
ans = 1 in Ns and 9 in Ns and 7 in Ns and 4 in Ns
print("YES" if ans else "NO")

Measured memory_bytes: 38384
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

#define MOD 1000000007

int main(void){
	int n, m; cin >> n >> m;
	vector<lli> x(n), y(m);
	rep(i, n) cin >> x[i];
	rep(i, m) cin >> y[i];
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	n--; m--;

	lli sx = 0, sy = 0;
	reg(i, 1, n){
		lli d = (x[i] - x[i-1])%MOD;
		lli k = min(i, n-i+1);
		sx = (sx + (d*((k*n - k*(k-1))%MOD))%MOD)%MOD;
	}
	
	reg(i, 1, m){
		lli d = (y[i] - y[i-1])%MOD;
		lli k = min(i, m-i+1);
		sy = (sy + (d*((k*m - k*(k-1))%MOD))%MOD)%MOD;
	}
	
	cout << (sx*sy)%MOD << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

ll n;
vll a;

ll solve(ll l, ll r, ll lx, ll rx) {
  if (l+1 == r) return 0;
  ll res = HIGHINF;
  for (ll k=l+1; k<r; k++) res = min(res, solve(l, k, lx, lx+rx)+solve(k, r, lx+rx, rx)+a[k]*(lx+rx));
  return res;
}

int main() {
  cin >> n;
  a.resize(n);
  REP(i, n) cin >> a[i];
  cout << solve(0, n-1, 1, 1) + a[0] + a[n-1] << endl;
  return 0;
}


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

//  四方向へのベクトル
const int dx[8] = {-1,0,1,0,1,1,-1,-1};
const int dy[8] = {0,-1,0,1,1,-1,1,-1};

int H,W;
//探索用
bool seen[501][5001];
int MAX = 0;
//using Graph = vector<vector<int>>;
bool roop;
int dfs(const vector<vector<int>> &G,int nh,int nw){
    seen[nh][nw] = true;
    
    for(int i=0;i<8;i++){
        int next_h = nh + dy[i];//8方向へ移動
        int next_w = nw + dx[i];

        if(next_h<0 || next_h >=H ||next_w<0||next_w >= W) continue;
        if(seen[next_h][next_w]) continue;
        if(G[next_h][next_w] == 0) continue;

        dfs(G,next_h,next_w);
    }

}
int main(){
    while(true){
        int cnt=0;
        cin >> W >> H;
        if(H+W == 0) break;

        vector<vector<int>> G(H);
        for(int i=0;i<H;i++){
            for(int k=0;k<W;k++){
                int a;
                cin >> a;
                G[i].push_back(a);
            }
        }
        memset(seen,0,sizeof(seen));

        for(int i=0;i<H;i++){
            for(int k=0;k<W;k++){
                if(G[i][k] == 1&& !seen[i][k]){
                    dfs(G,i,k);
                    cnt++;
                }
            }
        }

        cout <<cnt <<endl;
    }
    return 0;
    
}




Measured memory_bytes: 5696
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int a, b, t;
  cin >> a >> b >> t;
  cout << t / a * b << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        System.out.println((1900 * m + 100 * (n - m)) * (int)Math.pow(2, m));
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    ll n,m;
    cin >> n >> m;

    multiset<ll> arr;
    for (ll i=0;i<=n-1;i++)
    {
        ll a;
        cin >> a;
        arr.insert(a);
    }

    for (ll i=0;i<=m-1;i++)
    {
        ll a=*prev(arr.end());
        arr.erase(prev(arr.end()));
        arr.insert(a/2);
    }

    ll ans=0;
    for (auto it=arr.begin();it!=arr.end();it++)
    {
        ans=ans+*it;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8312
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int> vi;

signed main()
{
    int n, m, k;
    cin >> n >> m >> k;
    vi a(n + 1), b(m + 1);
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        a[i] = a[i - 1] + x;
    }
    for (int i = 1; i <= m; i++)
    {
        int x;
        cin >> x;
        b[i] = b[i - 1] + x;
    }
    auto it = upper_bound(a.begin(), a.end(), k);
    int ans = 0;
    if (it != a.begin())
        ans = max(ans, (int)(prev(it) - a.begin()));
    it = upper_bound(b.begin(), b.end(), k);
    if (it != b.begin())
        ans = max(ans, (int)(prev(it) - b.begin()));
    for (int i = 1; i <= n; i++)
    {
        it = upper_bound(b.begin(), b.end(), k - a[i]);
        if (it != b.begin())
            ans = max(ans, i + (int)(prev(it) - b.begin()));
    }
    cout << ans << endl;
}

Measured memory_bytes: 6372
//---Vaidik Patel"---//-------------------Proud to be Indian--------------------------------//
#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set,multi multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define pii pair<int,int>
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order()
#define deb1(x) cout<<#x<<" : "<<x<<"\n";
#define deb2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<"\n";
#define deb3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<"\n";
#define deb4(x,y,z,w) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<"\t"<<#w<<" : "<<w<<endl;
#define deb5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define deb6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rFOR(i,a,b) for(int i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vector<int>>
#define M 1000000007
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int powermodm(int x,int n,int m)
{int ans=1;   while(n){if(n&1){ans=(ans*x)%m;}x=(x*x)%m;n=n/2;}return ans;}

void solve()
{
    ld x,y;
    cin>>x>>y;
    int ans=x*y;
    cout<<ans<<"\n";
}
signed main()
{
    
    FIO
    int t;
    t=1;
    //cin>>t;
    FOR(i,0,t)
    {
        //cout<<"Case #"<<i+1<<": ";
        solve();
    }
}


Measured memory_bytes: 3808
#include<cstdio>
#include<queue>
#include<algorithm>
#include<cstring>
using namespace std;
#define MAXN 100005

int n,m;
int dis[MAXN], sign[MAXN];
bool vis[MAXN];
struct node{
    int to, w;
    node(int to,int w){
        this->to = to; this->w = w;
    }
};
vector<node> edge[MAXN];

void init(void){
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;++i){
        int x,y;
        scanf("%d%d",&x,&y);
        edge[x].push_back(node(y,1));
        edge[y].push_back(node(x,1));
    }
}

void spfa(int u){
    memset(dis,0x3f,(n+1)*sizeof(int));
    memset(vis,false,(n+1)*sizeof(bool));
    dis[u] = 0; vis[u] = true;
    queue<int> Q;
    Q.push(u);
    while(Q.size()){
        int x = Q.front(); Q.pop();
        vis[x] = false;
        int len = edge[x].size();
        for(int i=0;i<len;++i){
            int y = edge[x][i].to, z = edge[x][i].w;
            if(dis[y] > dis[x]+z){
                dis[y] = dis[x]+z;
                if(!vis[y]) Q.push(y), vis[y] = true;
                sign[y] = x;
            }
        }
    }
}

int main(void)
{
    init();
    spfa(1);
    for(int i=2;i<=n;++i)
        if(dis[i]==0x3f3f3f3f){
            puts("No");
            return 0;
        }
    puts("Yes");
    for(int i=2;i<=n;++i) printf("%d\n",sign[i]);
    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		// ------------------------------------------------
		long x = Long.parseLong(sc.next());

		int ret = 0;
		long kane = 100;
		while (kane < x) {
			kane += kane / 100;
			ret++;
		}

		out.println(ret);

		// ------------------------------------------------
		sc.close();
		out.flush();
	}
}

Measured memory_bytes: 27060
import sys
import math
import collections
import bisect
import copy

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    last = [-1 for _ in range(2 * 10 ** 5 + 1)]
    d = []
    dp = [INF for _ in range(n + 1)]
    dp[0] = 1

    prev = -1
    for i in range(n):
        di = ni()
        di -= 1
        if i > 0:
            if prev == di:
                d.append(-1)
                prev = di
                continue
        d.append(di)
        prev = di

    for i, di in enumerate(d):
        dp[i + 1] = dp[i]
        if di == -1:
            last[di] = i
            continue
        if last[di] != -1:
            if i - last[di] != -1:
                dp[i + 1] += dp[last[di] + 1]
                dp[i + 1] %= MOD
        last[di] = i

    print(dp[n])


if __name__ == '__main__':
    main()


Measured memory_bytes: 26928
x,y=map(int,input().split())

if (2*x-y)%3!=0 or (2*x-y)<0:
  print(0)
  exit()
if (2*y-x)%3!=0 or (2*y-x)<0:
  print(0)
  exit()
p=int((2*x-y)/3)
q=int((2*y-x)/3)
M=p+q+2
Mod=10**9+7

fac=[0]*M
finv=[0]*M
inv=[0]*M

def COMinit():
  fac[0]=fac[1]=1
  finv[0]=finv[1]=1
  inv[1]=1
  for i in range(2,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%Mod
def COM(n,k):
  if n<k:
    return 0
  if n<0 or k<0:
    return 0
  return (fac[n]*(finv[k]*finv[n-k]%Mod)%Mod)%Mod

COMinit()
print(COM(p+q,p))


Measured memory_bytes: 54384
//#include"bits/stdc++.h"
 
#include "iostream"
#include "algorithm"
#include "set"
#include "unordered_map"
#include "numeric"
#include "limits"
#include "queue"
#include "stack"
#include "math.h"
#include "cstring"
#include "map"

// NOTE TO SELF // try to simplyfy the problem

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

#define ll long long int

//const int mod=1000000007;

using namespace std;

int main()
{
    ll k;
    cin>>k;
    
    ll seven=7;
    
    for(int i=1;i<=1000000;i++)
    {
        if(seven%k==0)
        {
            cout<<i<<endl;
            return 0;
            
        }
        
        seven%=k;
        
        seven= seven*10+7;
        
        
    }
    
    
    cout<<"-1"<<endl;
}


Measured memory_bytes: 3632
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = a[0]
m = n - 2
for i in range(1, n):
    if m > 1:
        ans += a[i] * 2
        m -= 2
    elif m == 1:
        ans += a[i]
        m -= 1
    else:
        break

    if m == 0:
        break

print(ans)


Measured memory_bytes: 31760
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

void Main()
{
	int N, K;
	std::cin >> N >> K;
	std::cout << N - K + 1 << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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);
    int A,B,T; cin >> A >> B >> T;
    cout << B*(T/A) << endl;
}

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

using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1,0};
const int dy[]={0,1,0,-1,1,1,-1,-1,0};
const int INF = 1e9+101;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<Pii,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
template<class T>
ostream& operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()){
		out << v[i] <<", ";
	}
	return out << "}" << endl;
}
int memo[50];
int solve(int l) {
    if(memo[l] != -1) return memo[l];
    if(l <= 1) return 1;
    return memo[l] = solve(l-1)+solve(l-2);
}
int main() {
    memset(memo,-1,sizeof(memo));
    int N;
    cin >> N;
    cout << solve(N) << endl;
    return 0;  
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

LL n,n2=1,m,a[200010],dat[800010],datx[800010],delta[800010],deltax[800010],ans=1e18;

void pushdown(LL k)
{
	dat[k*2+1]+=delta[k];
	delta[k*2+1]+=delta[k];
	dat[k*2+2]+=delta[k];
	delta[k*2+2]+=delta[k];
	delta[k]=0;
	datx[k*2+1]+=deltax[k];
	deltax[k*2+1]+=deltax[k];
	datx[k*2+2]+=deltax[k];
	deltax[k*2+2]+=deltax[k];
	deltax[k]=0;
}

void upd(LL k,LL lb,LL ub,LL tlb,LL tub,LL val,LL valx)
{
	if(ub<tlb||tub<lb) return;
	if(tlb<=lb&&ub<=tub)
	{
		dat[k]+=val;
		delta[k]+=val;
		datx[k]+=valx;
		deltax[k]+=valx;
		return;
	}
	pushdown(k);
	upd(k*2+1,lb,(lb+ub)/2,tlb,tub,val,valx);
	upd(k*2+2,(lb+ub)/2+1,ub,tlb,tub,val,valx);
	dat[k]=dat[k*2+1]+dat[k*2+2];
	datx[k]=datx[k*2+1]+datx[k*2+2];
}

void getans(LL k,LL lb,LL ub)
{
	if(lb==ub)
	{
		if(1<=lb&&lb<=m) ans=min(ans,dat[k]+datx[k]*lb);
		return;
	}
	pushdown(k);
	getans(k*2+1,lb,(lb+ub)/2);
	getans(k*2+2,(lb+ub)/2+1,ub);
}

int main()
{
	cin>>n>>m;
	while(n2<m+1) n2*=2;
	rep(i,n) scanf("%lld",&a[i]);
	rep(i,n-1)
	{
		if(a[i]<a[i+1])
		{
			upd(0,0,n2-1,a[i]+1,a[i+1],a[i+1]+1,-1);
			upd(0,0,n2-1,1,a[i],a[i+1]-a[i],0);
			upd(0,0,n2-1,a[i+1]+1,m,a[i+1]-a[i],0);
		}
		else
		{
			upd(0,0,n2-1,a[i]+1,m,m+a[i+1]+1,-1);
			upd(0,0,n2-1,1,a[i+1],a[i+1]+1,-1);
			upd(0,0,n2-1,a[i+1]+1,a[i],m-a[i]+a[i+1],0);
		}
	}
	getans(0,0,n2-1);
	cout<<ans<<endl;
	return 0;
}

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

typedef long long ll;
typedef long double ld;

#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

int main(){

    ll N, K;

    cin >> N >> K;

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

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String str_scan = scan.nextLine();
    // スペース区切りで分ける
    var str = str_scan.split(" ");
    // int型へ変換
    var N = Integer.parseInt(str[0]);
    var X = Integer.parseInt(str[1]);
    var T  = Integer.parseInt(str[2]);
    int ans = 0;

    var amari = N % X;
    var syou = N / X;

    if (amari > 0){
      ans = T * (syou + 1);
    }else{
      ans = T * syou;
    }

    System.out.println(ans);
    scan.close();
  }
}

Measured memory_bytes: 35592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int h, w;
  cin >> h >> w;

  vector<string> C(h);
  for (int i = 0; i < h; i++) {
    cin >> C[i];
  }

  for (int i = 0; i < h; i++) {
    cout << C[i] << endl;
    cout << C[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int gcd(int a,int b){
    if(b==0){
        return a;
    }
    else{
        int c=a%b;
        int d=gcd(b,c);
        return d;
    }
    
}
int main() {
	int n;
	long long sum=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
                int a=gcd(i,j);
                int b=gcd(a,k);
                sum+=b;
            }
        }
    }
    cout<<sum;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
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 dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int dp[3100][3100] = { 0 };
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> h(n);
	int sum = 0,res=0;
	for (int i = 0; i < n; ++i) {
		cin >> h[i];
		sum += h[i];
	}
	
	while (sum > 0) {
		for (int i = 0; i < n; ++i) {
			if (!(h[i])) continue;
			for (int j = i; j < n; ++j) {
				if (!(h[j])) break;
				--h[j];
				--sum;
			}
			++res;
			break;
		}
	}
	cout << res << endl;
	return 0;
}


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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

typedef long long LL;
const LL mod=1000000007;
#define MAX 10000
#define NIL -1
const double PI  = acos(-1.0);
const int INF = 1e9 + 7;
//-------------------------------------------


int main(){

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

    int maxi = 1;
    int x;
    cin >> x;

    for( int i = 1; i <= sqrt(x) ; i++){
        for( int j = 2; j <= sqrt(x); j++){
            //dump( double(pow(i,j) );
            if( double(pow(i , j)) > x && j > 2){

                int temp = pow(i,j-1);
                //dump(i);
                //dump(j);
                //dump(temp);
                maxi = max(maxi, temp);
                break;
            }
        }
    }
    cout << maxi << endl;


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

int main(){
  int X, Y, Z, K; cin >> X >> Y >> Z >> K;

  vector <ll> 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.begin(), A.end(), greater<ll>());
  sort(B.begin(), B.end(), greater<ll>());
  sort(C.begin(), C.end(), greater<ll>());

  vector <ll> ans;

  for (int i = 0; i < X; i++){
    for (int j = 0; j < Y; j++){
      for (int k = 0; k < Z; k++){
        if ((i + 1) * (j + 1) * (k + 1) > K){
          break;
        }else{
          ans.push_back(A[i]+B[j]+C[k]);
        }
      }
    }
  }
  
  sort(ans.begin(), ans.end(), greater<ll>());

  for (int i = 0; i < K; i++){
    cout << ans[i] << endl;
  }
  

  return 0;
}


Measured memory_bytes: 1404
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
hon = [2,4,5,7,9]
pon = [0,1,6,8]
#bon = [3]
r=n%10
if r in hon:
  print('hon')
elif r in pon:
  print('pon')
else:
  print('bon')


Measured memory_bytes: 9048
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 13:07:12 2020

@author: shinba
"""

import sys
sys.setrecursionlimit(10**7)
 
def patikaijou(n):
    if n == 0:
        return 1
    else:
        return (n*patikaijou(n-1))%(10**9+7)

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

if abs(n-m) >= 2:
    print(0)
elif n != m:
    print((patikaijou(n)*patikaijou(m))%(10**9+7))
else:
    print((2*((patikaijou(n))**2))%(10**9+7))
    

Measured memory_bytes: 83316
#include<bits/stdc++.h>
using namespace std;
int k,a,b;

int main()
{
	cin>>k>>a>>b;
	bool pd=false; 
	for(int i=k;i<=b;i+=k)
		if (a<=i&&i<=b)
			pd=true;
	if (pd) puts("OK");
	else puts("NG");
	return 0;
} 

Measured memory_bytes: 3640
// class point	の練習（クラスの高度な実装）
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>

typedef long long llong;
using namespace std;

int main() {
	char strin[1010];
	int a, b;
	int q;
	char querin[10];
	char repin[1100];
	char revin[1100];

	scanf("%s", strin);
	getchar();
	cin >> q;
	for (int i = 0; i < q; i++) {
		scanf("%s %d %d", querin, &a, &b);
		if (!strcmp(querin, "replace")) {
			scanf("%s", repin);
			for (int j = a; j <= b; j++) {
				strin[j] = repin[j - a];
			}
		}
		else if (!strcmp(querin, "print")) {
			for (int j = a; j <= b; j++) {
				printf("%c", strin[j]);
			}
			cout << '\n';
		}
		else if (!strcmp(querin, "reverse")) {
			for (int j = a; j <= b; j++) {
				revin[j - a] = strin[j];
			}
			for (int j = b; j >= a; j--) {
				strin[a + b - j] = revin[j - a];
			}
		}
	}

	return 0;
}



Measured memory_bytes: 3156
# coding: utf-8

import itertools
import sys

N = int(input())
C = [int(x) for x in input().split()]

# Cを昇順にソートしておく
C.sort()

# （C_iの個数×C_iのコスト）の総和×2**Nを求める
sum = 0
for i in range(N):
	sum += (N + 1 - i) * C[i]
sum *= 2 ** (N - 2)
sum *= 2 ** N

# 10**9 + 7で割った余りを求めて出力
print(int(sum % (10 ** 9 + 7)))

Measured memory_bytes: 25772
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

struct Sol{
  vector<int> a;
  string s;
  int n;
  vector<int> lin;
  bool dodaj(int x){
    while(x){
      int pom = x & -x;
      for(int el:lin){
        if((el & -el) == pom){
          x ^= el;
          goto ok;
        }
      }
      lin.PB(x);
      return 1;
      ok:;
    }
    return 0;
  }
  void run(){
    cin >> n;
    a.resize(n);
    R(i,n)cin >> a[i];
    cin >> s;
    for(int i = n - 1; i >=0; i--){
      bool x = dodaj(a[i]);
      debug(lin, x, a[i]);
      if(x && s[i] == '1'){
        cout << "1\n";
        return;
      }
    }
    cout << "0\n";
  }
};

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int t;
  cin >> t;
  while(t--){
    Sol sol;
    sol.run();
  }
}


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


int main(){
	
	int N,L,tempI;
	string tempS;
	//map  <string , int> M; 

	cin>>N>>L;

		vector< pair <string ,int>> M(N);


	for(int i=0; i<N; i++){

		cin >> tempS;

		M[i].first = tempS;
		M[i].second = i;
	}


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

	for(int i=0; i<N; i++) cout <<M[i].first;

	cout <<endl;

}

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

int main(){
	string s;
	cin >> s;
	int i=0, j=0;
	for(i=0; i<s.size(); i++){
		if(s[i]=='A') break;
	}
	for(j=s.size(); j>1; j--){
		if(s[j]=='Z') break;
	}
	cout << j-i+1;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
 
using namespace std;
 
int main(){
  double a,b,c,d,e,f;
  double x,y;
  while(cin>>a>>b>>c>>d>>e>>f){
    y = (double)(a*f-d*c) / (a*e - b*d);
    x = (c-b*y) / a;
    cout << setprecision(3) << setiosflags(ios::fixed) << x << ' ' << setprecision(3) << setiosflags(ios::fixed) << y << endl;
  }
  return 0;
}

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

int  main(){
	ll x,k,d;cin >> x >> k >> d;
	x = abs(x);
	ll possible = min(x/d,k);
	x -= possible*d;
	k -= possible;
	if(k%2 == 0)cout << abs(x) << endl;
	else cout << abs(x-d) << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n,h[100010],prv = INF;
	cin >> n;
	for(int i = 0;i < n;i++) cin >> h[i];
	for(int i = n - 1;i >= 0;i--){
		if(prv >= h[i]) prv = h[i];
		else{
			if(prv < h[i] - 1){
				No();
				return 0;
			}
			else prv = h[i] - 1;
		}
	}
	Yes();
}

Measured memory_bytes: 1024
#pragma region Template
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RNG(i, a, b) for(int i = a; i < b; i++)
#define RBF(i, v) for(auto& i : v)
#define ALL(x) x.begin(), x.end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }
#pragma endregion

signed main()
{	
	int n;
	cin >> n;

	while (n > 0) {
		n -= 1000;
	}

	col(n * (-1));
	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

#define INF 1e9

int prim(vector<vector<pair<int, int> > > adjlist){
  int n = adjlist.size();
  vector<int> result(n, INF);
  int sum = 0;
  
  priority_queue<pair<int, int> > wait;
  wait.push(make_pair(0, 0));
  result[0] = 0;
  while(!wait.empty()){
    int nowcost = -wait.top().first;
    int nowpoint = wait.top().second;
    wait.pop();
    if(nowcost > result[nowpoint]){ continue; }

    sum += nowcost;
    result[nowpoint] = -INF;
    
    for(int i = 0; i < (int)adjlist[nowpoint].size(); i++){
      int nextcost = adjlist[nowpoint][i].first;
      int nextpoint = adjlist[nowpoint][i].second;
      if(result[nextpoint] > nextcost){
        result[nextpoint] = nextcost;
        wait.push(make_pair(-nextcost, nextpoint));
      }
    }
  }

  return sum;
}


int main(void){
  while(true){
    int n, m;
    cin >> n >> m;
    if(n == 0 && m == 0){ break; }
    
    int a, b, cost;
    vector<vector<pair<int, int> > > adjlist(n);
    for(int i = 0; i < m; i++){
      cin >> a >> b >> cost;
      adjlist[a].push_back(make_pair(cost, b));
      adjlist[b].push_back(make_pair(cost, a));
    }

    cout << prim(adjlist) << endl;
  }

  return 0;
}

Measured memory_bytes: 3084