akhauriyash/Code-Regression huggingface dataset:
#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/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

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

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;
using boost::algorithm::join;
// TOP

void	Main()
{
	ll n, g, l;
	cin >> n >> g >> l;

	ll dif;
	dif = abs(g - l);
	if (dif % 2 == 0)
		cout << dif / 2 << endl;
	else
	{
		if (g < l)
			swap(g, l);
		ll ans;
		ans = (dif + min(abs(l - 1), abs(g - n)) * 2 + 1) / 2;
		cout << ans << endl;
	}
}
// END
















int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N;
	cin>>N;
	if(N < 1000){
		cout<<"ABC"<<endl;
		return 0;
	}
	else if(N >= 1000 && N <= 1998){
		cout<<"ABD"<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
using namespace std;

int main() {
	int n;
	cin >> n;
	
	int min = 0;
	int max = 50000;
	string ans = ":(";
	while(max >= min){
		int mid = (min + max) / 2;
		if(floor(mid * 1.08) == n) {
			ans = to_string(mid);
			break;
		}else{
			if(floor(mid * 1.08) < n) {
				min = mid + 1;
			}else if(floor(mid * 1.08) > n) {max = mid - 1;}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int gcd(int x,int y){
	
	if(x%y==0){
		return y;
	}else{
		return gcd(y,x%y);
	}
	
}

int main() {
	

int N,H,W;
cin>>N>>H>>W;
int ans=(N-H+1)*(N-W+1);
ce(ans)
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

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

    int ans = 1;
    while (ans * 2 <= N)
    {
        ans *= 2;
    }

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

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

int main()
{
  int n;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n-1;i++)
    cin>>v[i];
  int sum=v[0];
  for(int i=1;i<n-1;i++)
    sum+=min(v[i-1], v[i]);
  sum+=v[n-2];
  cout<<sum;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>                                                                              
#include <vector>                                                                                
#include <cstdlib>                                                                               
#include <algorithm>                                                                             
                                                                                                 
using namespace std;                                                                             
                                                                                                 
int min_val(int xl, int xr) {                                                                    
  int min1 = abs(xl) + abs(xl - xr);                                                             
  int min2 = abs(xr) + abs(xr - xl);                                                             
  if (min1 < min2) {                                                                             
    return min1 ;                                                                                
  } else {                                                                                       
    return min2;                                                                                 
  }                                                                                              
}                                                                                                
                                                                                                 
int main() {                                                                                     
  vector<int> keiro;                                                                             
  vector<int> X;                                                                                 
  int N,K;                                                                                       
  cin >> N >> K;                                                                                 
  int x;                                                                                         
  for (int i=0;i<N;i++) {                                                                        
    cin >> x;                                                                                    
    X.push_back(x);                                                                              
  }                                                                                              
  for (int i=0; i < N-K+1;i++) {                                                                 
    keiro.push_back(min_val(X[i], X[i+K-1]));                                                    
  }                                                                                              
  cout << *std::min_element(keiro.begin(), keiro.end());                                         
}                                                                                                
             

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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h.at(i);
  }

  int ans = 0, active = 0;
  for (int i = 0; i < n; i++) {
    if (h.at(i) >= active) {
      ans += h.at(i) - active;
      active += h.at(i) - active;
    } else {
      active -= active - h.at(i);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
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)
using ll = long long;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll MOD=1e9+7 ;
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; }

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    // input part
    int n,k;
    cin >> n >> k;
    ll ans = 1;
    rep(i,n)
    {
        if (i==0) {
            ans *= k;
        }
        else
        {
            ans *= (k-1);
        }
        
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1<<30;
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 REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
//素因数分解
ll solve(ll n){
    ll copy = n;
    ll ans = INF;
    ll j;
    for(ll i=1;i*i<=copy;i++){
        if(n%i==0){
            j=n/i;
        }
        chmin(ans,i+j-2);
    }
    return ans;
}

//fixed<<setprecision(10)<<ans<<endl;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;

    ll ans=solve(N);

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 
#define PI 3.141592653589793238

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;
typedef gp_hash_table<long int,long int> HashTable;

int main(){
   IOS;
 /*    #ifndef ONLINE_JUDGE
         freopen("in.txt",  "r",  stdin);
         freopen("out.txt", "w", stdout);
     #endif */
   
   long int n,d,a;
   cin>>n>>d>>a;

   vector<pair<long int,long int>> v(n + 1);
   vector<long int> vec;

   for(long int i = 0; i < n; i++)
    cin>>v[i].first>>v[i].second;

   v[n].first = 1e10;
   sort(v.begin(),v.end());
   
   for(auto ele : v)
    vec.push_back(ele.first);

   long int ans = 0;
   vector<long int> damage(n + 1);
   long int damageAlreadyInflicted = 0;

   for(long int i = 0; i < n; i++){
      damageAlreadyInflicted += damage[i];
      long int effectiveMonsterHealth = v[i].second - damageAlreadyInflicted;
      if(effectiveMonsterHealth <= 0)
        continue;
      long int bombsReq = (effectiveMonsterHealth + a - 1) / a;
      ans += bombsReq;
      damageAlreadyInflicted += bombsReq * a;
      long int effect = upper_bound(vec.begin(),vec.end(),v[i].first + 2 * d) - vec.begin();      
      damage[effect] -= bombsReq * a;
   } 

   cout<<ans;

   return 0;
}

Measured memory_bytes: 6640
s = list(input())
n = (len(s)-1)
sum = 0
pt = []
for i in range(2 ** n):
  tmp = [""] * n
  for j in range(n):
    if (i >> j) &1 :
      tmp[j] = "+"
  pt.append(tmp)
  
for p in pt:
  fr = ""
  for j in range(n):
    
    fr += s[j] + p[j]
  sum += eval(fr+s[n])
    
print(sum)

Measured memory_bytes: 3064
/*
    (B_1 + B_2) = 2A_1
    (B_2 + B_3) = 2A_2
    ...
    (B_N + B_1) = 2A_N

    i = oddのとき
    Σ(A_i) = 2(B_1) + (B_2) + (B_3)
    Σ(A) = Σ(B) より
    (B_1) = 2(A_i) - Σ(B)
    以下は上の方程式から
*/
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
#define FOR(i, n) for (int i = 0; i < (int)(n); i++)

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

  vector<ll> A(N);
  ll sumA = 0;
  ll sumB = 0;
  FOR(i, N) {
    cin >> A[i];
    if (!(i % 2)) sumA += 2 * A[i];
    sumB += A[i];
  }
  vector<ll> B(N);
  B[0] = sumA - sumB;

  for (int i = 0; i < N - 1; i++) B[i + 1] = 2 * A[i] - B[i];
  FOR(i, N) cout << B[i] << " ";
  cout << endl;
}

Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>
#include <stack>
#include <iomanip>
#include <sstream>

using namespace std;

template <typename T>
inline bool sign(T A) {
    return (A>0)-(A<0);
}
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SREP(i,s,n) for(int i=s; (n-i)*sign(n-s)>0; i+=sign(n-s))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

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

template <template<class,class,class...> class C, typename K, typename V, typename... Args>
V map_get(const C<K,V,Args...>& m, K const& key, const V & defval)
{
    typename C<K,V,Args...>::const_iterator it = m.find( key );
    if (it == m.end())
        return defval;
    return it->second;
}

#define MOD (1'000'000'000 + 7
#define INF (ll(1e18))

int main(void)
{
    ll N;
    cin >> N;
    vector<string> S(N);
    REP(i, N) {
        cin >> S[i];
    }
    ll maxk = -1;
    REP(i, N) {
        queue<pair<ll,ll>> q;
        vector<ll> v(N, -1);
        ll k = -1;
        q.push(make_pair(i, 1));
        while (q.size())
        {
            auto j = q.front();
            q.pop();
            if (v[j.first] >= 0 && v[j.first] != j.second)
            {
                k = -1;
                break;
            }else if (v[j.first] == j.second) {
                continue;
            }
            v[j.first] = j.second;
            k = j.second;
            REP(l, N) {
                if (S[j.first][l] == '1') {
                    if (v[l] < 0) {
                        q.push(make_pair(l, k+1));
                    }
                    else if (v[l] != k - 1 && v[l] != k+1)
                    {
                        k = -1;
                        break;
                    }
                }
            }
            if (k < 0)
                break;
        }
        maxk = max(maxk, k);
    }
    cout << maxk << endl;
}


Measured memory_bytes: 528
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

int main()
{
    string c1, c2, c3;
    cin >> c1 >> c2 >> c3;

    cout << c1[0] << c2[1] << c3[2] << endl;

    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<tuple<string, int, int>> x(n);
	for (int i = 0; i < n; i++)
	{
		string s;
		int p;
		cin >> s >> p;

		x.at(i) = make_tuple(s, p, i + 1);
	}

	sort(all(x), [](const tuple<string, int, int>& a, const tuple<string, int, int>& b)
		{
			if (get<0>(a) != get<0>(b))
			{
				return get<0>(a) < get<0>(b);
			}
			else
			{
				return get<1>(a) > get<1>(b);
			}
		});

	for (int i = 0; i < n; i++)
	{
		println(get<2>(x.at(i)));
	}
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  string line;
  cin>>line;
  REP(i,line.size()){
    cout<<(char)((line[i]-3-'A'+26)%('Z'-'A'+1)+'A');
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char s[105];
ll k;
int main(){
    //while(1){
        scanf("%s",s);
    scanf("%lld",&k);
    int len = strlen(s);
    ll ans = 0;
    bool judge = 1;
    if (len == 1){
        printf("%lld\n",k/2);
        return 0;
    }
    for (int i = 1;i < len;++i){
        if (s[i] != s[i-1]) judge = 0;
    }
    if (judge){
        printf("%lld\n",len*k/2);
        return 0;
    }
    for (int i = 1;i < len;++i){
        int cnt = 1;
        while(s[i] == s[i-1] && i < len ){
            cnt++;
            i++;
        }
        ans += cnt/2;
    }
    //cout <<ans <<endl;
    ans = ans*k;
    ll lnum = 1;
    for (int i = 1;i < len && s[i] == s[i-1];++i) lnum++;
    ll rnum = 1;
    for (int i = len-2;i >= 0 && s[i] == s[i+1];--i) rnum++;
    if (lnum &1 == 1 && rnum&1 == 1 && s[0] == s[len-1]){
        ans += k-1;
    }
    printf("%lld\n",ans);
    //}
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		double ans = 0.0;
		for(int i=1; i<=n; i++) {
			int x = 1;
			int j=i;
			while(j<k) {
				x *= 2;
				j *= 2;
			}
			x *= n;
			ans += (double)1/(double)x;
		}
		System.out.println(ans);
		sc.close();
	}

}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
vector<vector<int>> adj;
int dis[2005];
void bfs(int ver)
{
   queue<int>qq;
   qq.push(ver);
   while(!qq.empty())
   {
      int z=qq.front();
      qq.pop();
      for(auto i:adj[z])
      {
         if(dis[i]>dis[z]+1)
         {
            dis[i]=dis[z]+1;
            qq.push(i);
         }
      }
   }
}

signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
   
 #ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
 #endif
 
// -------------------------------------Code starts here---------------------------------------------------------------------     

   int n;
   cin>>n;
   adj.resize(n+1);
   int x,y;
   cin>>x>>y;
   for(int i=1;i<=n-1;i++)
   {
      adj[i].push_back(i+1);
      adj[i+1].push_back(i);
   }
   adj[x].push_back(y);
   adj[y].push_back(x);
   int ans[n+1]={0};
   for(int i=1;i<=n;i++)
   {
      fill_n(dis,n+1,1e17);
      dis[i]=0;
      bfs(i);
      for(int i=1;i<=n;i++)
      {
         ans[dis[i]]++;
      }
   }
   for(int i=1;i<=n-1;i++)
   {
      cout<<ans[i]/2<<'\n';
   }

// -------------------------------------Code ends here------------------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
    clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }
 

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

int main(){
  int n, l; cin >> n >> l;
  int eat;
  if (l >= 0) eat = l;
  else if (l + n - 1 <= 0) eat = l + n - 1;
  else eat = 0;

  int sum = n*l + n*(n+1)/2 - n;
  cout << sum - eat << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll,ll>
#define PP pair<P,P>
using namespace std;

int main(){
    string t; cin >> t;
    string ans="";
    rep(i,t.length()){
        if(t[i]=='?') ans+='D';
        else ans+=t[i];
    }
    /*
    if(t.length()!=1){
    if(t[0]=='?'){
        if(t[1]=='?') ans+='P';
        else ans+='D';
    }
    else ans+=t[0];
    rep(i,t.length()-2){
        if(t[i+1]=='?'){
        if(ans[i]=='P') ans+='D';
        else if(ans[i]=='D' && t[i+1]=='?') ans+='P';
        else if(ans[i]=='D') ans+='D';
        }
        else ans+=t[i+1];
    }
    if(t[t.length()-1]=='?') ans+='D';
    else ans+=t[t.length()-1];
    }
    if(t[0]=='?') ans+='D';
    else ans+=t[0];
    */
    cout << ans << endl;
return 0;
}


Measured memory_bytes: 3824
import sys
input  = sys.stdin.readline

N,M = map(int,input().split())
dp = [0]*N
for i in range(M):
  a = int(input())
  dp[a-1]=-1

for i in range(N):
  if dp[i]==-1:
    dp[i]=0
  else:
    if i==0:
      dp[i]=1
    elif i==1:
      dp[i]=1+dp[0]
    else:
      dp[i]=dp[i-1]+dp[i-2]
    dp[i]=dp[i]%1000000007
print(dp[-1])

Measured memory_bytes: 41708
S=list(input())
x=S.pop(0)
if x!='A':
  print('WA')
else:
  for i in range(1,len(S)-1):
    if S[i]=='C':
      del S[i]
      if str.islower("".join(S)):
        print('AC')
        break
      else:
        print('WA')
        break
  else:
    print('WA')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <chrono>
#include<math.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std::chrono;
using namespace std;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// declaration: ordered_set os;  methods->  1. *os.find_by_order(x)   2. os.order_of_key(k) ->return int

#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<ll,ll>
#define prr pair<pr,ll>
#define ll long long int
#define ld long double
const ll mod=1e9+7;
const int N=2e5+5;
void solve(){
    int a;
    cin>>a;
    cout<<a+a*a+a*a*a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
//    build();
    int t=1;
//    cin>>t;
    while(t--)
    solve();

}


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

int main(){
  int N;
  string S;
  cin >> N >> S;
  deque<char> q;
  int num=0;
  for(int i=0; i<N; i++){
    if(num==0 && S[i]==')'){
      q.push_front('(');
      q.push_back(')');
    }
    else if(num>0 && S[i]==')'){
      q.push_back(')');
      num--;
    }
    else{
      num++;
      q.push_back('(');
    }
  }
  if(num>0){
    for(int i=0; i<num; i++){
      q.push_back(')');
    }
  }
  while(!q.empty()){
    cout << q.front();
    q.pop_front();
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
(* Examples *)
(*
stdin.ReadLine()
printfn "%d"
printfn "%s"
*)

(* Library *)
module Library =
  let modPow x y m =
    let rec loop x y m result =
      match y with
      | 0L -> result
      | _ -> 
        loop x (y - 1L) m ((result * x) % m)
    loop x y m 1L

(* Standard Input *)
let readSplit elementFun=
  stdin.ReadLine().Split()
  |> Array.map elementFun

let read elementFun =
  stdin.ReadLine() |> elementFun

let readMap H =
  [|for i in 1..H -> stdin.ReadLine()|]
  |> Array.map(fun line ->
    line.ToCharArray()
  )
  |> array2D

(* Main *)
open Library

let N = read int64
let A = readSplit int64
let m = pown 10L 9 + 7L

[|0..62|]
|> Array.map (fun x ->
  A
  |> Array.sumBy (fun y ->  (y >>> x) % 2L)
)
|> Array.fold2 (fun sum x y ->
  (sum + ((((pown 2L x) % m) * y % m) * (N - y)) % m) % m
) 0L [|0..62|]
|> printfn "%d"

Measured memory_bytes: 58172
s= input()
 
char_list = [ chr(ord('a')+num) for num in range( 26 ) ]

ind = 0
for i in char_list:
  if s.count(i) % 2 != 0:
    ind = 1
    break
if ind == 1:
  print("No")
else:
  print("Yes")

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

#define ll long long  
#define endl "\n"

const ll int MOD=1e9+7;

void solve()
{
	ll a; float b;
	cin >> a >> b;
	int c = round(b*100);
	cout << fixed;
	cout << (a*c)/100<< endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	solve();
	return 0;
}

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

# define ll long long
ll mod=pow(10,9)+7;

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

    int n;
    cin>>n;
    if(n>=1800)
        cout<<1;
    else if(n>=1600)
        cout<<2;
    else if(n>=1400)
        cout<<3;
    else if(n>=1200)
        cout<<4;
    else if(n>=1000)
        cout<<5;
    else if(n>=800)
        cout<<6;
    else if(n>=600)
        cout<<7;
    else if(n>=400)
        cout<<8;
    
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long int lli;

int main()
{
	int n,qq,s,c;
	map<int,int>mp;
	mp[2]=mp[3]=0;
	mp[1]=-1;
	
	bool chk=true;
	bool cc=true;
	cin>>n>>qq;
	int tem=qq;
	while(qq--)
	{
		cin>>s>>c;
		if (s==1 && cc==true){
			mp[1]=0;
			cc=false;
		}
			
		if (mp[s]!=0 && mp[s] !=c)
			chk=false;
		
		else 
			mp[s]=c;

	}
	if (chk)
	{
		if (n==1)
		{
			if (tem==0)
				cout<<"0\n";
			else if (mp[1]>=0)
				cout<<mp[1]<<endl;
			else
				cout<<"-1\n";
		}
		else if (n==2)
		{
			if (tem==0)
				cout<<"10\n";
			else if (mp[1]==-1 && mp[2]>=0)
				cout<<"1"<<mp[2]<<endl;
				
			else if (mp[1]>0 && mp[2]>=0)
				cout<<mp[1]<<mp[2]<<endl;
			else
				cout<<"-1\n";	
		}
		else if (n==3)
		{
			if (tem==0)
				cout<<"100\n";
			else if (mp[1]==-1 && mp[2]>=0 &&mp[3]>=0)
				cout<<"1"<<mp[2]<<mp[3]<<endl;
			else if (mp[1]>0 and mp[2]>=0 and mp[3]>=0)
				cout<<mp[1]<<mp[2]<<mp[3]<<endl;
			else
				cout<<"-1\n";
		}

	}
	else
		cout<<"-1\n";
	
	
	return 0;
}

Measured memory_bytes: 384
import math

n=int(input())
mae=n/1.08
sute=math.floor(mae)
koho=[sute-2, sute-1, sute, sute+1, sute+2]
answer=-1
for k in koho:
    nedan=math.floor(k*1.08)
    if nedan==n:
        answer=k

if answer==-1:
    print(":(")
else:
    print(answer)

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

using namespace std;

int n;
vector<int> a;

int main()
{
	cin >> n;
	a.resize(n);
	int b1=0,b2=0,b4=0;
	for(int i=0;i < n;i ++)
	{
		cin >> a[i];
		if(a[i]%4 == 0)
		{
			b4++;
		}
		else if(a[i]%2 == 0)
		{
			b2++;
		}
		else
		{
			b1++;
		}
	}
	if(b2 == 0)
	{
		if(b1 <= b4+1)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
	else
	{
		if(b1 <= b4)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 640
from queue import Queue
import sys

inf = float("inf")
N, M = list(map(int, input().split()))
dist = [[] for x in range(N+1)]
value = [inf for x in range(N+1)]

for i in range(M):
    l, r, d = list(map(int, input().split()))
    dist[l].append((r, d))
    dist[r].append((l, -d))

for i in range(1, N+1):
    if value[i] != inf: continue
    
    value[i] = 0
    q = Queue()
    q.put(i)
    while not q.empty():
        tmp = q.get()
        for x in dist[tmp]:
            nxt = x[0]
            nxt_val = value[tmp] + x[1]
            if value[nxt] != inf:
                if value[nxt] == nxt_val: continue
                print("No")
                sys.exit()
            value[nxt] = nxt_val
            q.put(nxt)
print("Yes")

Measured memory_bytes: 70308
p = [[int(i) for i in input().split()] for i in range(3)]
a = []
for i in range(3): a.append((p[i][0]-p[(i+1)%3][0])**2+(p[i][1]-p[(i+1)%3][1])**2)
a.sort()
print(a[2]**0.5/
(((2*(a[0]*a[2])**0.5+a[0]+a[2]-a[1])/(2*(a[0]*a[2])**0.5-a[0]-a[2]+a[1]))**0.5+
((2*(a[1]*a[2])**0.5+a[1]+a[2]-a[0])/(2*(a[1]*a[2])**0.5-a[1]-a[2]+a[0]))**0.5+2))

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back



int main(){
    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    char ans=s2[0];
    cout << 'A' << ans << 'C' << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main() {
	int C[10001];
	for (int i = 0; i < 10001; i++) C[i] = 0;
	int n;
	scanf("%d", &n);
	int* A = new int[n];
	int* B = new int[n];
	for (int i = 0; i < n; i++) {
		scanf("%d", &A[i]);
		C[A[i]]++;
	}

	for (int i = 0, j = 0; i < 10001; i++) {
		if (C[i] != 0) {
			for (int k = 0; k < C[i]; k++) {
				B[j++] = i;
			}
		}
	}

	for (int i = 0; i < n - 1; i++) printf("%d ", B[i]);
	printf("%d\n", B[n - 1]);
	delete[] A;
	delete[] B;
	return 0;
}



Measured memory_bytes: 17972
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
vi ans;
void insert(int pos, int v)
{
	ans.insert(ans.begin()+pos,v);
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n; cin>>n;
	ll res=0;
	
	int cur=0;
	for(ll i = 0; i <= 50; i++)
	{
		if(res+(1LL<<i)<=n)
		{
			res+=(1LL<<i);
			insert(i,++cur);
			insert(0,cur);
		}
	}
	n-=res;
	for(int i = 50; i >= 0; i--)
	{
		if(n&(1LL<<i))
		{
			int pos = int(ans.size()) - i;
			insert(pos,++cur);
			insert(0,cur);
		}
	}
	cout<<ans.size()<<'\n';
	for(int i=0;i<ans.size();i++)
	{
		cout<<ans[i];
		if(i+1<ans.size()) cout<<' ';
	}
	cout<<'\n';
}	


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    ll a, b, n;
    cin >> a >> b >> n;
    ll x = min(b - 1, n);
    cout << floor(a*x/b) - a*floor(x/b);
    return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
//#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;


signed main(){
    int m, n;
    while(1){
        cin >> m;
        if(m == 0) break;
        vector<pii> a(m);
        rep(i, 0, m){
            cin >> a[i].fi >> a[i].se;
        }
        rep(i, 1, m){
            a[i].fi -= a[0].fi;
            a[i].se -= a[0].se;
        }
        int dx = a[0].fi;
        int dy = a[0].se;
        a[0].fi = a[0].se = 0;
        cin >> n;
        set<pii> st;
        vector<pii> b;
        rep(i, 0, n){
            int x, y;
            cin >> x >> y;
            b.push_back(make_pair(x, y));
            st.insert(make_pair(x, y));
        }
        int ans = -1;
        rep(i, 0, n){
            rep(j, 0, m){
                if(!(st.count(make_pair(b[i].fi + a[j].fi, b[i].se + a[j].se)))){
                    break;
                }
                if(j == m - 1){
                    ans = i;
                    j = m; i = n;
                }
            }
        }
        //o(ans);
        cout<< b[ans].fi - dx <<" "<< b[ans].se - dy <<endl;
    }
}

Measured memory_bytes: 1256
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


class UnionFind:
    def __init__(self, n: int):
        self.n = n
        self.parents = [-1] * n
    
    def find(self, x: int):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x: int, y: int):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        if self.parents[y] < self.parents[x]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x: int):
        return -self.parents[self.find(x)]
    
    def same(self, x: int, y: int):
        return self.find(x) == self.find(y)
    
    def members(self, x: int):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    
    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def solve():
    N = int(rl())
    a = list(map(int, rl().split()))
    
    b = [0] * (N + 1)
    for i, x in enumerate(a):
        b[x] = i
    
    uf = UnionFind(N)
    ans = 0
    for idx in b[:0:-1]:
        left, right = 1, 1
        if 0 <= idx - 1 and a[idx] < a[idx - 1]:
            left += uf.size(idx - 1)
            uf.union(idx - 1, idx)
        if idx + 1 <= N - 1 and a[idx] < a[idx + 1]:
            right += uf.size(idx + 1)
            uf.union(idx, idx + 1)
        ans += left * right * a[idx]
    print(ans)


if __name__ == '__main__':
    solve()


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

int main(){
  int n,m,s,g1,g2;
  while(true){
    cin>>n>>m>>s>>g1>>g2;
    if(n==0) break;
    s--,g1--,g2--;
    const long long int INF=1e10;
    vector<vector<long long int>> d(n,vector<long long int>(n,INF));
    for(int i=0;i<m;i++){
      int b1,b2,c;
      cin>>b1>>b2>>c;
      b1--,b2--;
      d[b1][b2]=c;
    }
    for(int i=0;i<n;i++) d[i][i]=0;
    for(int k=0;k<n;k++){
      for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
	  d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	}
      }
    }
    long long int res=1e10;
    for(int g=0;g<n;g++){
      long long int share=d[s][g];
      long long int cost1=d[g][g1];
      long long int cost2=d[g][g2];
      long long int cost=share+cost1+cost2;
      res=min(res,cost);
    }
    
    cout<<res<<endl;

  }
  
  return 0;
}

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

int main(){
    int n;
    double s[1000];
    double mean, dev;
    while(1){
        cin >> n;
        if (n==0) break;
        double sum = 0;
        for (int i=0;i<n;i++){
            cin >> s[i];
            sum += s[i];
        }
        mean = sum / n;   
        double sum_pow2=0;
        for (int i=0;i<n;i++){
            sum_pow2 += (s[i]-mean)*(s[i]-mean);
        }
        dev = sqrt(sum_pow2/n);
        printf("%f\n", dev);
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

const int N = 1e5 + 5;
int n;
int a[N];
ii d[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    d[0] = {1, 0};
    int p = a[0];
    for (int i = 1; i < n; ++i) {
        int cur = gcd(p, a[i]);
        d[i] = {p / cur, i};
        p = cur;
    }
    int res1 = a[1];
    for (int i = 2; i < n; ++i) {
        res1 = gcd(res1, a[i]);
    }
    sort(d, d + n, greater<ii>());
    int skip = d[0].second;
    int res = a[0];
    for (int i = 1; i < n; ++i) {
        if (i == skip) continue;
        res = gcd(res, a[i]);
    }
    cout << max(res, res1) << endl;

    return 0;
}



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


signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);

    ll n,x;
    cin>>n>>x;
    ll a[n];
    ll mini[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        mini[i] = a[i];
    }
    ll ans = 1e18;
    for(int i=0;i<n;i++){
        ll ret = 0;
        for(int j=0;j<n;j++){
            ret += mini[j];
            mini[j] = min(mini[j], a[(j-i-1+n) % n]);
        }
        
        ans = min(ans, ret + x*i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let A = read![[i64]];

    let mut m = 60;
    for i in 0..N {
        let mut a = A[i];
        let mut count = 0;
        while a != 0 && a % 2 == 0 {
            count += 1;
            a /= 2;
        }
        m = min(m, count);
    }

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


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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        int d = s[i] - '0';
        sum += d;
        sum %= 9;
    }
    if(sum == 0) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 3716
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int A, B, X;
		A = scan.nextInt();
		B = scan.nextInt();
		X = scan.nextInt();

		int wantCat = X - A;

		if (A > X) {
			System.out.println("NO");
		} else if (B > wantCat) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 27036
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long int
#define mem(x) memset(x,0,sizeof(x))
#define setbits(x)  __builtin_popcount(x)
#define ull unsigned long long int
#define all(c) (c).begin(),(c).end()
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define cps CLOCKS_PER_SEC
#define complex cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / cps << '\n';
#define db double
#define endl "\n"
#define  fbo(x) find_by_order(x)
#define  ook(x) order_of_key(x)

using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os1;
typedef tree<int, null_type, greater<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os2;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair<ll,ll > ii;
typedef pair<ll,int> li;
inline void fast()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
const ll pi=31;
const ll MOD[2] = {1187278649, 1149736019};//for double hashing
const ll mod=(ll)(1e9)+7;
ll pmod(ll x,ll n){
  ll r=1;
  while(n)
  {
    if(n&1LL)
      r=(r*x)%mod;
    x=(x*x)%mod;
    n=n/2;
  }
  return r;
}

//think recursively also
 ll n,m,x;
ll c[14];
ll a[14][14];
ll inc[14]={0};
ll sol(ll in,ll inc[])
{
   if(in==n+1)
   {
      for(int i=1;i<=m;i++)
      {
         if(inc[i]<x)
          return INT_MAX;
      }
      return 0;
   }
  
  ll nar[m+1];
  for(int i=1;i<=m;i++)
  {
    nar[i]=inc[i]+a[in][i];
  }
  return min(sol(in+1,inc),sol(in+1,nar)+c[in]);

}
void solve()
{   
  
    cin>>n>>m>>x;

    for(int i=1;i<=n;i++)
    {

      cin>>c[i];
      for(int j=1;j<=m;j++)
      {
        cin>>a[i][j];
        inc[j]+=a[i][j];
      }
    }
    for(int i=1;i<=m;i++)
    {
      if(inc[i]<x)
      {
        cout<<"-1";
        return;
      }
    }
    mem(inc);
    cout<<sol(1,inc);

  
}
int main()
{
   fast();
  
   // int t;
   // cin>>t;
   // for(int casee=1;casee<=t;casee++)
  {// cout<<"Case #"<<casee<<": ";
    solve();
  }
 
 
 
}


Measured memory_bytes: 3640
def combnk_mod(n, k, p):
    # pが素数かつaとpが互いに素であるとき
    # フェルマーの小定理より以下が成り立つ.
    # 1 / a = a ** (p - 2) (mod p)
    # これを使って (1 / k!) mod p を計算する.

    if  2 * k > n:
        k = n - k
    x = 1 # 分母にあたる数 1 / n! mod p
    y = 1 # 分子にあたる数. n! / (n - k)! mod p
    for i in range(1, k + 1):
        x *= pow(i, p - 2, p)
        y *= n - i + 1
        x %= p
        y %= p
    return (x * y) % p

if __name__ == '__main__':
    MOD = 10 ** 9 + 7
    n, a, b = map(int, input().split())
    ans = pow(2, n, MOD) - 1
    ans %= MOD
    for k in [a, b]:
        ans -= combnk_mod(n, k, MOD)
        ans %= MOD
    print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
char t1[1510];
char t2[1510];
int main(){
	int i,j;
	int n1,n2;
	int	cnt=0;
	scanf("%s",t1);
	for(i=0;i<strlen(t1);i++){
		t1[i]=tolower(t1[i]);
	}
	while(scanf("%s",t2)){
		if(strcmp(t2,"END_OF_TEXT")==0) break;
		for(i=0;i<strlen(t2);i++){
			t2[i]=tolower(t2[i]);
		}
		if(strcmp(t1,t2)==0) cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}



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

int p[200];
int main(){
	int m, nmin, nmax;
	while (scanf("%d%d%d", &m, &nmin, &nmax), m){
		int n, Max = 0;
		for (int i = 0; i < m; i++)
			scanf("%d", &p[i]);
		sort(p, p + m, greater<>());
		for (int i = nmin; i <= nmax; i++){
			if (p[i - 1] - p[i]>=Max){
				Max = p[i - 1] - p[i];
				n = i;
			}
		}
		printf("%d\n", n);
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
const int MAXN = 5100;
const ll MOD = 1e9 + 7;

int N;
int A, B;

ll dmod[2][MAXN];
ll dp[2][MAXN];

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> N >> A >> B;
    if (A > B) swap (A, B);

    for (int i = 1; i < A; i++)
        dmod[0][i] = 1;

    dmod[1][1] = 1;
    for (int i = 2; i <= B; i++)
    {
        dmod[1][i] = dmod[1][i-1];
        for (int j = i - (A + 1); j >= 1; j--)
            dmod[1][i] = (dmod[1][i] + dmod[1][j]) % MOD;
    }
    for (int i = 0; i < B; i++)
        dp[0][i] = dmod[1][i+1];
    ll v = dmod[1][B];
    dmod[1][B] = 0;

    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j <= N; j++)
        {
            for (int k = 0; k < 2; k++)
            {
                dp[1-k][j] = (dp[1-k][j] + dp[k][i] * dmod[k][j-i]) % MOD;
            }
        }
    }

    dmod[1][B] = v;
    for (int i = 0; i <= N; i++)
        dp[1][N+1] = (dp[1][N+1] + dp[1][i] * dmod[1][N+1-i]) % MOD;

    /*for (int i = 0; i < N; i++)
    {
        cout << dp[0][i] << " " << dp[1][i] << "\n";
    }*/
    ll res = 1;
    for (int i = 0; i < N; i++)
        res = (res * 2) % MOD;

    if (B > 1)
        res = (res - dp[1][N+1] + 2 * MOD) % MOD;
    cout << res << "\n";
}

Measured memory_bytes: 3708