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

const int mod = 1e9 + 7;

signed main() {
  int n;
  cin >> n;
  string s1, s2;
  cin >> s1 >> s2;
  vector<int> v;
  for (int i = 0; i < n;) {
    if (s1[i] == s2[i]) {
      v.push_back(1);
      i++;
    } else {
      v.push_back(2);
      i += 2;
    }
  }
  int ans = (v[0] == 1) ? 3 : 6;

  for (int i = 1; i < v.size(); i++) {
    if (v[i - 1] == 1)
      ans = ans * 2 % mod;
    else if (v[i - 1] == 2 && v[i] == 1)
      continue;
    else if (v[i - 1] == 2 && v[i] == 2)
      ans = ans * 3 % mod;
  }
  cout << ans << endl;
//  for (auto&& w : v) cout << w << " ";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100000];
int main()
{
	int n,p,i,alls=0,pd=1,k=0;
	scanf("%d %d",&n,&p);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		alls += a[i];
	}
	sort(a+1,a+n+1);
	for(i=n,k = 0;k<p;i--,k++)
	{
		if(a[i]*4*p<alls)
		{
			pd = 0;
		}
	}
	if(pd==1)
	{
		printf("Yes");
	}
	else
	printf("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int oo = 0x3f3f3f3f;
const int N = 2000000 + 5;
const int mod = 1e9 + 7;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

LL fpm(LL base, LL exp) {
    LL res = 1;
    for(; exp > 0; exp >>= 1) {
        if(exp & 1LL)
            res = res * base % mod;
        base = base * base % mod;
    }
    return res;
}

LL fac[N + 5], inv[N + 5];
inline LL C(int n, int k) {
    return fac[n] * inv[k] % mod * inv[n-k] % mod;
}
inline LL Calc(int l1, int r1, int l2, int r2) {
    return (C(r1 + r2 + 2, r1 + 1) - C(l1 + r2 + 1, l1) - 
           (C(r1 + l2 + 1, r1 + 1) - C(l1 + l2, l1)) + (mod << 1)) % mod;
}

void init() {
    fac[0] = 1;
    for(int i = 1; i <= N; ++i) fac[i] = fac[i-1] * i % mod;
    inv[N] = fpm(fac[N], mod - 2);
    for(int i = N; i >= 1; --i) inv[i-1] = inv[i] * i % mod;
}

int X1, X2, X3, X4, X5, X6;
int Y1, Y2, Y3, Y4, Y5, Y6;

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif

    init();
    cin >> X1 >> X2 >> X3 >> X4 >> X5 >> X6;
    cin >> Y1 >> Y2 >> Y3 >> Y4 >> Y5 >> Y6;

    LL ans = 0;

    for(int t = Y3; t <= Y4; ++ t) {
        ans = (ans + Calc(X3-1-X2, X3-1-X1, t-Y2, t-Y1) * Calc(X5-X3, X6-X3, Y5-t, Y6-t)%mod * (-X3-t)) % mod;
        ans = (ans + Calc(X4-X2, X4-X1, t-Y2, t-Y1) * Calc(X5-X4-1, X6-X4-1, Y5-t, Y6-t)%mod * (X4+t+1)) % mod;
    }
    for(int s = X3; s <= X4; ++ s) {
        ans = (ans + Calc(s-X2, s-X1, Y3-1-Y2, Y3-1-Y1) * Calc(X5-s, X6-s, Y5-Y3, Y6-Y3)%mod * (-Y3-s)) % mod;
        ans = (ans + Calc(s-X2, s-X1, Y4-Y2, Y4-Y1) * Calc(X5-s, X6-s, Y5-Y4-1, Y6-Y4-1)%mod * (Y4+s+1)) % mod;
    }

    printf("%lld\n", (ans % mod + mod) % mod);
    return 0;
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Sep 13 21:09:40 JST 2020
 **/

template <class T> T pow(T x, long long n, const T UNION = 1) {
    T ret = UNION;
    while (n) {
        if (n & 1) ret *= x;
        x *= x;
        n >>= 1;
    }
    return ret;
}

/// @docs src/Math/ModInt.md
template <int Mod> struct ModInt {
    int x;
    static int runtime_mod;
    static std::unordered_map<int, int> to_inv;
    // テンプレート引数が負のときは実行時ModInt
    static int mod() { return Mod < 0 ? runtime_mod : Mod; }
    static void set_runtime_mod(int mod) {
        static_assert(Mod < 0, "template parameter Mod must be negative for runtime ModInt");
        runtime_mod = mod;
        to_inv.clear();
    }
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod() + mod()) >= mod()) x -= mod();
    }

    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod()) x -= mod();
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod();
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod();
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod();
        return *this;
    }
    ModInt operator-() const { return -x < 0 ? mod() - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return to_inv.count(this->x) ? to_inv[this->x] : (to_inv[this->x] = pow(*this, mod() - 2).x); }

    friend std::ostream& operator<<(std::ostream& s, ModInt<Mod> a) {
        s << a.x;
        return s;
    }
    friend std::istream& operator>>(std::istream& s, ModInt<Mod>& a) {
        long long tmp;
        s >> tmp;
        a = ModInt<Mod>(tmp);
        return s;
    }
    friend std::string to_string(ModInt<Mod> a) { return std::to_string(a.x); }
};
template <int Mod> std::unordered_map<int, int> ModInt<Mod>::to_inv;
template <int Mod> int ModInt<Mod>::runtime_mod;

#ifndef CALL_FROM_TEST
using mint = ModInt<1000000007>;
#endif

signed main() {
    Int n;
    std::cin >> n;
    mint all = pow(mint(10), n);
    mint zero = all - pow(mint(9), n);
    mint nine = all - pow(mint(9), n);
    std::cout << zero + nine + pow(mint(8), n) - all << std::endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(ll i=0;i<n;i++)
#define revf(i,n) for(ll i=n-1;i>=0;i++)
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep1(i,b) for(ll i=1;i<=b;i++)
#define inp(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define outp(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" "
#define outp1(a,n) for(ll i=1;i<n;i++)cout<<a[i]<<" "
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (((a)*(b))/gcd((a),(b)))
#define pb push_back
#define mp make_pair
#define mem(x,n) memset(x,n,sizeof(x))
#define BINSC binary_search
#define BITOUT __builtin_popcount
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define test ll t; cin>>t; while(t--)
#define cn cout<<"\n";
int main()
{
     fast;
     ll n,d;
     cin>>n>>d;
     ll x,y;
     
     ll k=0;
     forr(i,n)
     {
          cin>>x>>y;
          
          double d1=(double)d;
          if((double)sqrt(x*x+y*y)<=d1)
               k++;
          
     }
     cout<<k;cn}
     

Measured memory_bytes: 3692
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
    int N;
    cin >> N;
    int a[N];
    for(int i = 0; i < N; i++) cin >> a[i];

    ll ans = 0;
    int x = 0;
    for(int i = N - 1; i >= 0; i--){
        if(x == a[i]){
            x--;
        }
        else if(x < a[i]){
            ans += a[i];
            x = a[i] - 1;
        }
        else{
            cout << -1 << endl;
            return 0;
        }
    }

    if(x != -1) ans = -1;

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

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys
# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        error_print(e - s, 'sec')
        return ret

    return wrap


def ref(L):
    L = int(L, base=2)
    ans = 0
    for a in range(L+1):
        for b in range(L+1):
            if (a + b <= L) and (a ^ b == a + b):
                # print(a, b, a^ b, a+b)
                ans += 1
    return ans



@mt
def slv(L):
    M = 10**9 + 7
    ans = 1
    m = 0
    for b in map(int, L):
        m *= 3
        if b == 1:
            m += ans
            ans *= 2

        ans %= M
        m %= M
    return (m + ans) % M


def main():
    L = read_str()
    print(slv(L))


if __name__ == '__main__':
    main()


Measured memory_bytes: 83964
#include<bits/stdc++.h>
using namespace std;
 
int f(int x){
  int ans;
  x%2==0?ans=x/2:ans=3*x+1;
  return ans;
}

int main(){
  int s;cin>>s;
  int a[1000000],b[1000000];
  a[1]=s;
  b[s]=1;
  int i=2;
  while(1){
    a[i] = f(a[i-1]);
    b[a[i]] ++;
    if(b[a[i]]>1){cout<<i;return 0;}
    i++;
  }
}
  

Measured memory_bytes: 2304
/// ITNOG :)))
/// SAliB
#include <bits/stdc++.h>

using namespace std;

#define pb                      push_back
#define pp                      pop_back
#define mp                      make_pair
#define fi                      first
#define sec                     second
#define xmax(x,y)               ((x) = max((x),(y)))
#define xmin(x,y)               ((x) = min((x),(y)))
#define all(x)                  (x).begin(),(x).end()
#define mem(x , y)              memset(x , y , sizeof(x))
#define _                       ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define debug1(a)               cout << string(40 , '*') << '\n' << #a << " ---> " << a << '\n';
#define debug2(a , b)           cout << string(40 , '*') << '\n' << #a << " ---> " << a << '\n' << #b << " ---> " << b << '\n';
#define debug3(a , b , c)       cout << string(40 , '*') << '\n' << #a << " ---> " << a << '\n' << #b << " ---> " << b << '\n' << #c << " ---> " << c << '\n';
#define debug4(a , b , c , d)   cout << string(40 , '*') << '\n' << #a << " ---> " << a << '\n' << #b << " ---> " << b << '\n' << #c << " ---> " << c << '\n' << #d << " ---> " << d << '\n';
#define connect(a , b , c)      a[b].pb(c) , a[c].pb(b)
//
typedef long long int ll            ;
typedef unsigned long long int ull  ;
typedef unsigned int uint           ;
typedef long double ld              ;
typedef string str                  ;
typedef pair < int , int > pii      ;
typedef pair < pii , int > ppi      ;
typedef pair < int , pii > pip      ;
typedef pair < ll , ll> pll         ;
typedef pair < ll , pll> plp        ;
typedef pair < pll , ll> ppl        ;
typedef vector < ll > vl            ;
typedef vector < ld > vld           ;
typedef vector < int > vi           ;
typedef vector < str > vs           ;
//
inline int   iin()  { int x   ; scanf("%d" , &x)   ;  return x; }
inline ll    lin()  { ll  x   ; scanf("%lld" , &x) ;  return x; }
inline ll    Lin()  { ll  x   ; scanf("%I64d" , &x);  return x; }
//
inline int   iout(int  x)  { printf("%d" , x)   ;  }
inline ll    lout(ll   x)  { printf("%lld" , x) ;  }
inline ll    Lout(ll   x)  { printf("%I64d" , x);  }
//
const int maxn4 = 1e4 + 85 , maxn5 = 1e5 + 69 , maxn6 = 1e6 + 85 , maxn7 = 1e7 + 69 , maxn8 = 1e8 + 85 , maxn9 = 1e9 + 69 , modi1 = 1e7 + 7 , modi2 = 1e9 + 7;
const ll mod1 = 1e7 + 7 , mod2 = 1e9 + 7;
int mn = INT_MAX , mx = INT_MIN;
//
int main()
{_
    int n; cin >> n;
	if (n<=111){
		printf("111\n"); return 0;
	}
	if (n<=222){
		printf("222\n"); return 0;
	}
	if (n<=333){
		printf("333\n"); return 0;
	}
	if (n<=444){
		printf("444\n"); return 0;
	}
	if (n<=555){
		printf("555\n"); return 0;
	}
	if (n<=666){
		printf("666\n"); return 0;
	}
	if (n<=777){
		printf("777\n"); return 0;
	}
	if (n<=888){
		printf("888\n"); return 0;
	}
	if (n<=999){
		printf("999\n"); return 0;
	}
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const ll P = 1e9+7;
ll dp[50][1<<18];

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

	//for(int k=0; k<(1<<18);k++) dp[0][k] = 1;
	dp[0][0] = 1;
	for(int i=1; i<=N; i++){
		for(int k=0; k<(1<<18); k++){
			for(int n=1; n<=10; n++){
				int l=((1<<18)-1)&((k<<n)|(1<<(n-1)));
				if((l>>(Z-1))&(l>>(Y+Z-1))&(l>>(X+Y+Z-1))&1){
					continue;
				}
				dp[i][l] += dp[i-1][k];
				dp[i][l] %= P;
			}
		}
	}

	ll ans = 1;
	for(int i=0; i<N; i++){
		ans *= 10;
		ans %= P;
	}

	for(int k=0; k<(1<<18); k++){
		ans = (ans - dp[N][k] + P)%P;
		//if(dp[N][k] > 0) cout << k << " " << dp[N][k] << endl;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 84224
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

string S;

int main() {
    cin >> S;

    for (int i = 0; i < S.length(); i++) {
        cout << 'x';
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main(){
    string S;  cin >> S;
    string ans;
    for(int i=0; i<(int)S.size(); i++){
        if(i==4) ans+=' ';
        ans += S[i];
    }
    cout << ans << endl;
    
    return 0;
}





Measured memory_bytes: 256
def main():
    n = int(input())
    a = []
    b = []
    for _ in range(n):
        ae, be = map(int, input().split())
        a.append(ae)
        b.append(be)

    a = a[::-1]
    b = b[::-1]

    sm = 0
    for ae, be in zip(a, b):
        ae += sm
        q, r = divmod(ae, be)
        sm += (be - r) % be

    print(sm)


if __name__ == "__main__":
    main()


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

int main(){
  string S, T;
  int s, j = 0;
  cin >> S >> T;
  s = S.size();
  for(int i = 0; i < s; i++){
   if(S[i] != T[i]) j++;
 }
 cout << j;
}


Measured memory_bytes: 3920
//-----------------------------B-I-G------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define what_is(x) cerr << #x << " is " << x << endl;
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << "{"; for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi) { if (vi != v.begin()) os << ", "; os << *vi; } os << "}"; return os; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const ll M = 1000000007;

void solve(){
       ll a, b, c, k, ans;
       cin >> a >> b >> c >> k;
       a = min( a, k );
       b = min( b, k-a);
       c = min( c, k-a-b);
       ans = a-c;
       cout << ans << endl;

}

signed main(){
        fast;
        ll t=1;
        // cin >> t;
        while( t-- )
        solve();
        return 0;
}
//-----------------------------B-I-G------------------------------------------------

Measured memory_bytes: 3608
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;
int main(){
  double N;
  cin >> N;
  vector<double> X(5);
  for(int i=0; i<5; i++) cin >> X[i];
  cout << setprecision(18) << ceil(N / *(min_element(X.begin(), X.end())))+4 << endl;
  return 0;
}

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

struct Dinic
{
	struct edge
	{
		int to;
		int cap;
		int rev;
	};

	vector<vector<edge>> G;
	int N;
	vector<int> level;
	vector<int> itr;

	Dinic(int n) : N(n)
	{
		G.assign(N,vector<edge>());
	}

	void add_edge(int from ,int to,int cap)
	{
		G[from].push_back({to,cap,(int)G[to].size()});
		G[to].push_back({from,0,(int)G[from].size() - 1});
	}

	bool g_level(int s,int t)
	{
		level.assign(N,-1);
		queue<int> que;
		que.push(s);
		level[s] = 0;
		while(!que.empty())
		{
			int v = que.front();
			que.pop();
			for(edge& e : G[v])
			{
				if(e.cap > 0 && level[e.to] == -1)
				{
					level[e.to] = level[v] + 1;
					que.push(e.to);
				}
			}
		}
		return level[t] >= 0;
	}

	int dfs(int v,int t,int f)
	{
		if(v == t) return f;

		for(int& i = itr[v];i < G[v].size();i++)
		{
			edge& e = G[v][i];
			if(e.cap > 0 && level[e.to] > level[v])
			{
				int mi_f = dfs(e.to,t,min(f,e.cap));
				if(mi_f > 0)
				{
					e.cap -= mi_f;
					G[e.to][e.rev].cap += mi_f;
					return mi_f;
				}
			}
		}
		return 0;
	}

	int max_flow(int s,int t)
	{
		int result = 0;
		int flow;
		while(g_level(s,t))
		{
			itr.assign(N,0);
			while((flow = dfs(s,t,1e9)) > 0) result += flow;
		}
		return result;
	}
};

int main()
{
	int v;
	int e;
	cin >> v >> e;

	Dinic di(v);

	for(int i = 0;i < e;i++)
	{
		int s,t,c;
		cin >> s >> t >> c;
		di.add_edge(s,t,c);
	}

	cout << di.max_flow(0,v - 1) << endl;
	return 0;
}



Measured memory_bytes: 3236
#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));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))
 
int main(void){
	int n, t;
	cin >> n >> t;
	vector<int> v(n+1);
	rep(i, n) cin >> v[i];
	v[n] = v[n-1] + t;
	int c = 0;
	rep(i, n){
		if(v[i+1] - v[i] <= t) c += v[i+1] - v[i];
		else c += t;
	}
	
	cout << c << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PI (acos(-1))
#define ct cout<<
#define cn cin>>
#define spc <<" "<<
#define nl puts("")
#define _fl(x) puts("FLAG " #x);
#define  _(x)  cout<< #x <<" is "<< x <<endl;
#define fs first
#define sc second
#define pb push_back
#define all(v)  (v).begin(), (v).end()
#define _109 (1000000000)
#define _0(arr) memset(arr,0,sizeof ( arr ) )
#define _1(arr) memset(arr,-1,sizeof ( arr ) )
#define _ninp(n,arr) for(int i=0; i<n;i++)cin>>arr[i];
#define _nout(n,arr) for(int i=0; i<n;i++)cout<<arr[i]<<" \n"[i==n-1];
double _eps=1e-6;
long long gcd(long long a, long long b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll mn=1000000000000000;
int main() {


double a,b,v,x, y;


cn a>>b>>v;

if(v>=.5*a*b*a || fabs(v-.5*a*b*a)<=1e-7){
y=(2*(a*a*b-v))/(a*a);
double th=atan((a/y));
printf("%.10f",90.00-th*(180.00/PI));
}
else {
   
   x=(2*v)/(a*b);
  // _(x);
   double th=atan((x/b));
   printf("%.10f", 90.00-th*(180.00/PI));





}
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<x<<endl;
#define ll long long int
#define pb push_back
#define in insert
#define mp make_pair
#define F first
#define S second
#define N 1000000
#define MOD 1000000007
#define PI acos(-1)
ll dp[3005][3005];
ll func(ll l,ll r,ll a[])
{
	if(l>r)
	return 0;
	if(dp[l][r]!=-1)
	return dp[l][r];
	if(l==r)
	return dp[l][r]=a[l];
	return dp[l][r]=max(a[l]-func(l+1,r,a),a[r]-func(l,r-1,a));
}
int main()
{
	IOS
	ll n;
	cin>>n;
	ll a[n],i;
	for(i=0;i<n;i++)
	cin>>a[i];
	memset(dp,-1,sizeof(dp));
	ll ans=func(0,n-1,a);
	cout<<ans;
}

Measured memory_bytes: 71040
using System;
class Program
{
	static void Main(string[] args)
	{
      int A = int.Parse(Console.ReadLine());
      int B = int.Parse(Console.ReadLine());
      int C = int.Parse(Console.ReadLine());
      int X = int.Parse(Console.ReadLine());

      int ans = 0;
      for(int a=0; a<=A; ++a)
      {
        for(int b=0; b<=B; ++b)
        {
          for(int c=0; c<=C; ++c)
          {
            if (500*a + 100*b + 50*c == X)
            {
              ans++;
            }
          }
        }
      }
      Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13140
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
N = parseInt(readline())
A = parseMap(split(readline()))

sort!(A, rev=true)

ans = 0

for i in 1:N-1
    ans += A[div(i, 2) + 1]
end

println(ans)

end

main()

Measured memory_bytes: 202916
#include<stdio.h>

int main(void)
{
	int n, b, f, r, v;
	int i, j, k;
	int room[4][3][10];
	scanf("%d", &n);

	for (i = 0; i < 4; i++)
	{
		for (j = 0; j < 3; j++)
		{
			for (k = 0; k < 10; k++)
			{
				room[i][j][k] = 0;
			}
		}
	}

	for (i = 0; i < n; i++)
	{
		scanf("%d%d%d%d", &b, &f, &r, &v);
		room[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", room[i][j][k]);
			}
			printf("\n");
		}
		if (i != 3) printf("####################\n");
	}
	return 0;

}


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

int main(void){
    int N,K;
    cin >> N >> K;
    vector<double> vec(N);
    for(int i=0;i<N;i++){
        cin >> vec[i];
        vec[i] = (vec[i]+1.0)/2.0;
    }

    vector<double> sum(N);
    sum[0] = vec[0];
    for(int i=1;i<N;i++){
        sum[i] = sum[i-1]+vec[i];
    }

    double maxsum=sum[K-1];
    int i=K;
    while(i<sum.size()){
        maxsum = max(sum[i]-sum[i-K],maxsum);
        i++;
    }  
    printf("%.10f\n", maxsum);
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
//#include <cmath>
#include <cstdlib>

using namespace std;

int main(){

    int n;
    cin >> n;
    vector<int> a(n);

    for(int i=0;i<n;i++) cin >> a[i];

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

    int ans,c=1000000001;
    for(int i=0;i<n-1;i++){
        if(abs(a[i]*2 - a[n-1]) < c){
            c = abs(a[i]*2 - a[n-1]);
            ans = a[i];
        }
    }

    cout << a[n-1] << " " << ans;
    return 0;
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    int k;
    cin >> k;
    int n = (k + 1) / 2;
    if (n % 2) n++;
    if (k == 1) {
        cout << 1 << endl << 1 << endl;
        return 0;
    }
    VV<int> mp = VV<int>(n, V<int>(n));

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int ty = (i + j) % n;
            if (i % 2) ty += n;
            if (ty >= k) ty -= n;
            mp[i][j] = ty;
        }
    }

    cout << n << endl;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << mp[i][j] + 1 << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 2176
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>


/* ----- Type Alias ----- */
using Int = long long int;
using Real = long double;
using String = std::string;
template <class... Ts>
using Tuple = std::tuple<Ts...>;

template <class T>
using Vector = std::vector<T>;
template <class T>
using Queue = std::queue<T>;
template <class T>
using Stack = std::stack<T>;
template <class T>
using Deque = std::deque<T>;

template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T>
using Set = std::set<T>;
template <class T, class U>
using Map = std::map<T, U>;

template <class T, class... Us>
using Func = std::function<T(Us...)>;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return Vector<decltype(genv<T>(ts...))>(l, Vector<T>(ts...));
}

template <class Cost = Int>
struct Edge {
    Int src, dst;
    Cost cost;
    Edge(Int src = -1, Int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = Int>
using Edges = Vector<Edge<Cost>>;
template <class Cost = Int>
using Graph = Vector<Vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    Int precision;
    Fout(Int precision) : precision(precision) {}
};
std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}


/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// constexpr Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

int main() {
    Int s;
    std::cin >> s;

    Vector<Int> sum(s + 1);
    sum[0] = 0;
    for (Int i = 1; i <= s; ++i) {
        sum[i] = sum[i - 1] + i;
    }

    Int ans = 0;
    for (Int x = 1; x * x <= s; ++x) {
        if (s % x != 0) continue;

        Vector<Int> d({x, s / x});
        Int pat = 1;
        for (auto a : d) {
            Int cnt = 0;
            for (Int i = 0; i < s; ++i) {
                Int r = a + sum[i];
                if (*std::lower_bound(sum.begin(), sum.end(), r) == r) ++cnt;
            }
            pat *= cnt;
        }

        if (x * x != s) pat *= 2;
        ans += pat;
    }

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



Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin>>S;

    int n = S.size();
    int m = INT_MAX;
    rep(i, n - 2) {
        string sub = S.substr(i, 3);
        chmin(m, abs(stoi(sub) - 753));
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
import numpy as np
from itertools import accumulate

N, M = map(int, input().split())
P = []
p = [0] * (N+1)
for i in range(M):
    p1, y1 = map(str, input().split())
    p[int(p1)] += 1
    P.append(int(p1+y1.rjust(10,"0")))
    
ans = np.argsort(P)
ans = np.argsort(ans)
p = list(accumulate(p))

for i in range(M):
    a = P[i] // 10 ** 10 
    print(str(a).rjust(6,"0") + str(ans[i] - p[a-1] + 1).rjust(6,"0"))

Measured memory_bytes: 22800
mod = 10**9 + 7
def sgn(v):
    return (v > 0) - (v < 0)
def find_ans():
	v.sort(key=abs, reverse=True)
	ns = 1
	sg = 1
	for a in xrange(k):
	    ns *= v[a]
	    ns %= mod
	    sg *= sgn(v[a])

	if sg >= 0:
	    return ns

	if max(v) <= 0:
	    ns = 1
	    for a in xrange(-k,0):
	        ns *= v[a]
	        ns %= mod
	    return ns

	def helper_f(comp):
	    i = k-1
	    while i >= 0 and comp(v[i]): i -= 1
	    j = k
	    while j < n and not comp(v[j]): j += 1
	    if j == n: j = i
	    return i, j
	i, j = helper_f(lambda w: w >= 0)
	I, J = helper_f(lambda w: w <= 0)
	if I >= 0 and v[j] * v[I] < v[i] * v[J]:
	    i = I
	    j = J

	ns = v[j]
	for a in xrange(k):
	    if a != i:
	        ns *= v[a]
	        ns %= mod
	return ns

n, k = map(int, raw_input().strip().split())
v = map(int, raw_input().strip().split())
print(find_ans())
	

Measured memory_bytes: 101588
n, m, q = gets.split.map(&:to_i)

Q = []
1.upto(q) do |i|
  Q << gets.split.map(&:to_i)
end

ans = 0
(1..m).to_a.repeated_combination(n) do |ary|
  cnt = 0
  Q.each do |(a,b,c,d)|
    cnt += d if ary[b-1] - ary[a-1] == c
  end

  ans = [ans, cnt].max
end

p ans

Measured memory_bytes: 14596
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;

int main(){
    int k,n;
    string s;
    cin>>k>>s;
    n=s.size();
    if(n<=k){
        cout<<s<<endl;
    }
    else{
        cout<<s.substr(0,k)<<"..."<<endl;

    }
}

Measured memory_bytes: 3592
N,K=map(int,input().split())
H=[0]+list(map(int,input().split()))

inf=float('inf')
DP=[inf]*(N+1)  #DP[0]はダミー
DP[1]=0

def culc(index):   #index>=2
    global DP
    global H
    global K

    head=max(1,index-K)

    for i in range(head,index):
        DP[index]=min(DP[index],DP[i]+abs(H[i]-H[index]))

for j in range(2,N+1):
    culc(j)

print(DP[N])
    



Measured memory_bytes: 55904
#include <sys/time.h>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using P = pair<double, double>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
ll mod = 1000000007LL;



int main() {
	string s;
	cin >> s;
	int size = s.size();
	ll base = 1;

	ll dp[size + 1][13];
	rep (i, 13) {
		rep(j, size + 1) {
			dp[j][i] = 0;
		}
	}
	dp[0][0] = 1;
 
	rep(i, size) {
		int p = size - i - 1;
		if (s[p] == '?') {
			rep(from, 13) {
				rep(to, 10) {
					ll nj = (to * base + from) % 13;
					dp[i + 1][nj] = (dp[i + 1][nj] + dp[i][from]) % mod;   
				}
			}
		} else {
			ll cur = s[p] - '0';
			rep(from, 13) {
				ll nj = (cur * base + from) % 13;
				dp[i + 1][nj] = (dp[i + 1][nj] + dp[i][from]) % mod;
			}
		}

		base = (base * 10) % 13;

	}


	cout << dp[size][5] << endl;

	return 0;
}


Measured memory_bytes: 13468
#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vec             vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define inf             1e18
#define no_of_test(x)        int x; cin>>x; while(x--)
const int mod = 1e9 + 7;
int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//	no_of_test(x)
	{
        int n;
		cin>>n;
		int a[n];
		for(int i=0;i<n;i++) cin>>a[i];
		int maxi=a[0];int sum=0;
		for(int i=1;i<n;i++)
		{
			if(a[i]>maxi)
			{
				maxi=a[i];
			}
			else
			{
               sum+=abs(maxi-a[i]);
			}

			
		} 	
		cout<<sum<<'\n';	
	}
	return 0;
}

Measured memory_bytes: 5128
def main():
    w, h, n = map(int, input().split())
    minx = miny = 0

    for _ in range(n):
        x, y, a = map(int, input().split())

        if a == 1:
            minx = max(minx, x)
        elif a == 2:
            w = min(w, x)
        elif a == 3:
            miny = max(miny, y)
        else:
            h = min(h, y)
    else:
        print(max(w-minx, 0)*max(h-miny, 0))
        


if __name__ ==  "__main__":
    main()

Measured memory_bytes: 9160
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000000000000003 //1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int H,W;
  cin>>H>>W;

  int N;
  cin>>N;

  int a[N];
  rep(i,N){
    cin>>a[i];
  }

  int g[H][W];

  int now=0;

  rep(i,H){
    rep(j,W){
      if(a[now]==0) ++now;
      --a[now];
      if(i%2==0){
        g[i][j]=now+1;
      }
      else{
        g[i][W-1-j]=now+1;
      }
    }
  }

  rep(i,H){
    rep(j,W){
      cout<< g[i][j]<<" ";
    }
    cout<<"\n";
  }

}

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


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


int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll M = 0;
    rep(i,n-1){
        for(int j =1;j<n;++j){
            M = max(M,abs(a[j]-a[i]));
        }
    }
    cout << M <<endl;
}

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

using namespace std;




int  main()
{
	string S;
	string T;
	cin >> S;
	cin >> T;

	for (int i = 0; i < T.length(); i++) {
		char c = T[i];
		if (S.find_first_of(c) == string::npos) {
			cout << -1;
			return 0;
		}
	}
	long long p = 0;
	long long i = 0;
	string SS = S;
	while(true){
		if (i >= T.length()) {
			break;
		}
		char c = T[i];
		//cerr <<c << " : " << SS << " : " << p << endl;
		auto pos = SS.find_first_of(c);
		if (pos == string::npos) {
			p += SS.length();
			SS = S;
		}
		else {
			p += (pos+1);
			SS = SS.substr(pos + 1);
			i++;
		}
	}
	cout << p;
	return 0;
}


Measured memory_bytes: 768
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, m; bool ok[8000009];
int main() {
	while (cin >> m >> n, m) {
		fill(ok, ok + 8000000, true);
		for (int i = 0; i < m; i++) ok[i] = false;
		for (int i = m; i < 8000000; i++) {
			if (!ok[i]) continue;
			for (int j = i * 2; j < 8000000; j += i) ok[j] = false;
			if (n-- == 0) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 10924
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int N,P,A[50];
LL dp[51][10000];

int main(void){
    cin>>N>>P;
    REP(i,N)
        cin>>A[i];
    dp[0][0]=1;
    REP(i,N)
        REP(j,8000){
            // if(0<dp[i][j])
                // printf("dp[%d][%d]=%lld\n",i,j,dp[i][j]);
            dp[i+1][j+A[i]]+=dp[i][j];
            dp[i+1][j]+=dp[i][j];
        }
    LL ans=0;
    REP(i,8000)
        if(i%2==P)
            ans+=dp[N][i];
    cout<<ans<<endl;
     return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    double n, m, d;
    cin >> n >> m >> d;

    double ans;
    if(d == 0) {
        ans = n;
    }
    else {
        ans = 2*(n-d);
    }

    ans *= (m-1);
    ans /= (n*n);
    
    exout(ans);
    re0;
}

Measured memory_bytes: 256
import numpy as np
n = int(input())
num_list = list(map(int, input().split()))
mod = int(1e+9+7)
cumsum_list = np.cumsum(num_list[::-1])[::-1][1:]
all_sum = sum(num_list)
score = 0
for i in range(n-1):
    #print(num_list[i], cumsum_list[i])
    score += (num_list[i] * (cumsum_list[i]%mod)) % mod
print(score % mod)

Measured memory_bytes: 50012
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long N, long long K, std::string S) {
  S[K - 1] += 32;
  cout << S << endl;
}

int main() {
  cout << setprecision(10);
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::string S;
  std::cin >> S;
  solve(N, K, S);
  return 0;
}


Measured memory_bytes: 256
import math
A,B,H,M = (map(int , input().split()))
kado = min(360-abs(((H*5*6)+(M*(6/12)))-(M*6)) , abs(((H*5*6)+(M*(6/12)))-(M*6)))
print(((A**2) + (B**2) - ((2*A*B)*math.cos(math.radians(kado))))**0.5)

Measured memory_bytes: 9528
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

const int INF=100100100;
typedef pair<int,int> P;
char mp[21][21];
int d[21][21];
int ans=-1;
int dy[4]={-1,0,1,0},dx[4]={0,1,0,-1};
int h,w;


void bfs(int y,int x){
    rep(i,h)rep(j,w) d[i][j]=INF;
    d[y][x]=0;
    queue<P> q;
    q.push(P(y,x));
    while(!q.empty()){
        P p=q.front();
        q.pop();
        for(int i=0;i<4;i++){
            int yy=p.first+dy[i],xx=p.second+dx[i];
            if(yy<0||h<=yy||xx<0||w<=xx||d[yy][xx]!=INF||mp[yy][xx]=='#') continue;
            q.push(P(yy,xx));
            d[yy][xx]=d[p.first][p.second]+1;
        }
    }
    int maxv=-1;
    rep(i,h)rep(j,w){
        if(mp[i][j]=='#') continue;
        maxv=max(maxv,d[i][j]);
    }
    ans=max(ans,maxv);
}


int main(){
    cin >> h >> w;
    rep(i,h)rep(j,w){
        cin >> mp[i][j];
    }
    rep(i,h)rep(j,w){
        if(mp[i][j]=='.') bfs(i,j);
    }
    cout << ans << endl;
    return 0;
}











Measured memory_bytes: 256
N = int(input())

f_vals = []
for i in range(N):
    f_vals.append([int(_) for _ in input().split()])
p_vals = []
for i in range(N):
    p_vals.append([int(_) for _ in input().split()])


def solve():
    ans = -1e12
    for i in range(1, 2 ** 10):
        sumv = 0
        for l in range(N):
            fcnt = 0
            for j in range(10):
                fcnt += ((i >> j) & 1) and f_vals[l][j]
            sumv += p_vals[l][fcnt]

        ans = max(ans, sumv)
    print(ans)


solve()

Measured memory_bytes: 40048
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum(b)
for i in range(n-1):
    if a[i] + 1 == a[i+1]:
        ans += c[a[i]-1]

print(ans)


Measured memory_bytes: 38256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000

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

int N, W;
const int MAXN = 110;
const int MAXW = 10010;
int v[MAXN], w[MAXN];
int dp[MAXN][MAXW];

int main(void) {
    cin >> N >> W;
    for (int i = 1; i <= N; i++) {
        cin >> v[i]>> w[i];
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= W; j++) {
            if (j - w[i] >= 0) {
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
            } else {
                dp[i][j] = dp[i-1][j];
            }
//            cout << dp[i][j] << "  ";
        }
//        cout << endl;
    }
    int ret = 0;
    for (int i = 0; i <= W; i++) {
        ret = max(ret, dp[N][i]);
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 5216
n = int(input())
s = list(input())
ans = ''
cnt = 0
for c in s:
    ans += c
    if c == ')':
        cnt -= 1
    else:
        cnt += 1
    if cnt < 0:
        ans = '(' + ans
        cnt = 0

cnt = 0
for c in s[::-1]:
    if c == ')':
        cnt += 1
    else:
        cnt -= 1
    if cnt < 0:
        ans += ')'
        cnt = 0

print(ans)

Measured memory_bytes: 3064
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(N);
    READV(M);
    READV(X);
    ll C[N];
    ll S[N][M];
    FORI(i,0,N)
    {
        READ(C[i]);
        FORI(j,0,M)
        {
            READ(S[i][j]);
        }
    }
    ll ans=inf;
    FORI(i,0,1<<13)
    {
        ll Z[M]={0};
        ll x=i;
        ll cost=0;
        FORI(j,0,N)
        {
            if(x%2==1)
            {
                cost+=C[j];
                FORI(k,0,M)
                {
                    Z[k]+=S[j][k];
                }
            }
            x=x/2;
        }
        bool ok=true;
        FORI(j,0,M)
        {
            if(Z[j]<X)
            {
                ok=false;
            }
        }
        if(ok)
        {
            ans=min(ans,cost);
        }
    }
    if(ans!=inf)
    {
        cout<<ans<<endl;
    }
    else
    {
        cout<<-1<<endl;
    }


//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3812