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

using ll = long long;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define mp make_pair
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

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

inline tuple<ll, ll> rotate45(tuple<ll, ll> point) { ll x = get<0>(point), y = get<1>(point); return tuple<ll, ll>(x + y, x - y); }
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; }
void out_sequence(vector<ll> &out) { REP(i, out.size()) { cout << out[i]; if (i == out.size() - 1) cout << endl; else cout << " "; } }

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

	ll N, K; cin >> N >> K;
	vector<int> a(N); REP(i, N) cin >> a[i];
	vector<ll> as(N); REP(i, N) as[i] = (i == 0) ? a[i] : a[i] + as[i-1];
	vector<ll> bs(N); REP(i, N) bs[i] = (i == 0) ? max(0, a[i]) : bs[i-1] + max(0, a[i]);
	ll ans = 0, sum = 0;
	queue<ll> q;
	ll A = bs[N-1];
	REP(i, N) {
		q.push(a[i]); sum += a[i];
		if (q.size() > K) {
			sum -= q.front();
			q.pop();
		}
		if (q.size() == K) {
			ll b = (i - K >= 0) ? bs[i - K] : 0;
			b += (i < N) ? A - bs[i] : 0;
			chmax(ans, sum + b);
			chmax(ans, b);
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3072
//    https://www.youtube.com/watch?v=Dx6OQ7RvDXc

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;	// 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define shesh               "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define mest(a,b)           memset(a,b,sizeof(a))
ll mod=1000000007;
ll bigmod(ll temp,ll power){
    //cout<<temp<<" "<<power<<" "<<mod<<endl;
    if(power==0) return 1;
    else if(power%2) return (temp*bigmod(temp,power-1))%mod;
    else{
        ll bal=bigmod(temp,power/2);
        bal*=bal;
        bal%=mod;
        return bal;
    }
}

int main()
{
    fast;
    ll t,n,m,i,j,k,l,temp,flag,len,shit,ans,a,b,afact=1,bfact=1,A,B;
    cin>>n>>a>>b;
    ans=bigmod(2,n);
    //cout<<bigmod(6,mod-2)<<endl;
    //return 0;
    for(i=1;i<=a;i++){
        afact*=i;
        afact%=mod;
    }
    for(i=1;i<=b;i++){
         bfact*=i;
         bfact%=mod;
    }
    //debug(2);
    afact=bigmod(afact,mod-2);
    bfact=bigmod(bfact,mod-2);
    //debug(3);
    for(i=1,j=n,A=1;i<=a;i++,j--){
        A*=j;
        A%=mod;
    }
    for(i=1,j=n,B=1;i<=b;i++,j--){
        B*=j;
        B%=mod;
    }
    temp=((A*afact)%mod)+((B*bfact)%mod)%mod;
    temp=ans-temp;
    temp%=mod;
    temp+=mod;
    temp%=mod;
    temp--;
    temp+=mod;
    temp%=mod;
    cout<<temp;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mod 1000000007
//#define mod 998244353
using namespace std;
int check(string s,int l,int r)
{
	int n=r-l+1,i,flag=1;
	for(i=0;i<n/2;i++)
	{
		if(s[i+l]!=s[r-i])
		{
			flag=0;
			break;
		}
	}
	return flag;
}


int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    int x,y,z,i=s.length()-1;
    if(check(s,0,i)&&check(s,0,(i-1)/2)&&check(s,(i+3)/2,i))
    cout<<"Yes";
    else
    cout<<"No";
    
    
    
    
    

}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
int main(int argc, char const* argv[]) {
	string a, b;
	cin >> a >> b;
	string c = a + b;
	int num = atoi(c.c_str());
	int i = 1;
	while (1) {
		if (i * i == num) {
			printf("Yes\n");
			return 0;
		} else if (i * i > num) {
			printf("No\n");
			return 0;
		}
		i++;
	}
	return 0;
}


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

int main() {

	int c = 0;
	int a, b, N, D;

	cin >> N >> D;
	
	for (int i = 1; i <= N; i++) {
		for (int j = 22; j <= D; j++) {
			
			a = j / 10;
			b = j % 10;
			
			if (i == a * b && b != 1) {
				c++;
			}

		}
	}

	cout << c << endl;
}

Measured memory_bytes: 256
d = int(input())
c = tuple(map(int, input().split()))
s = [
    tuple(map(int, input().split()))
    for _ in range(d)
]

m = 0
ans = []
last = [0] * 26
for i in range(d):
    # for all contest
    mdmax = -10000000000000000
    mdi = 0
    for j, ss in enumerate(s[i]):
        md = 0
        # choose one contest to open
        for k in range(26):
            if j == k:
                md += ss
            else:
                md -= (i - last[k]) * c[k]
        if md > mdmax:
            mdi = j
            mdmax = md
    ans.append(mdi + 1)
    for j in range(26):
        if j == mdi:
            last[j] = 0
        else:
            last[j] += 1

for a in ans:
    print(a)

Measured memory_bytes: 9424
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 110
int a[MAXN],b[MAXN],n,m,cnt,first,last;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]%2) cnt++;
	}
	if(cnt>2) printf("Impossible\n");
	else
	{
		bool first=1;
		for(int i=1;i<=m;i++)
			if(a[i]%2)
			{
				if(first) swap(a[i],a[1]),first=0;
				else swap(a[i],a[m]);
			}
		for(int i=1;i<=m;i++)
			printf("%d ",a[i]);
		printf("\n");
		if(cnt==2)
		{
			a[1]--,a[m]++;
			if(a[1]==0)
				printf("%d\n",m-1);
			else printf("%d\n",m);
			for(int i=1+(a[1]==0);i<=m;i++)
				printf("%d ",a[i]);
		}
		else if(cnt==1)
		{
			if(m==1&&a[1]!=1) printf("2\n%d 1\n",a[1]-1);
			else if(m==1&&a[1]==1) printf("1\n1\n");
			else
			{
				a[1]--,a[m]++;
				if(a[1]==0)
					printf("%d\n",m-1);
				else printf("%d\n",m);
				for(int i=1+(a[1]==0);i<=m;i++)
					printf("%d ",a[i]);
			}
		}
		else
		{
			if(m==1) printf("2\n%d 1\n",a[1]-1);
			else
			{
				a[1]--,a[m]++;
				if(a[1]==0)
					printf("%d\n",m-1);
				else printf("%d\n",m);
				for(int i=1+(a[1]==0);i<=m;i++)
					printf("%d ",a[i]);
			}
		}
	}
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

signed main() {
    
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a*b, c*d) << endl;
    
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
class Program {
	static void Main() {
		int n = int.Parse(Console.ReadLine());
		int[] c = new int[n];
		for(int i = 0; i < n * (n - 1) / 2; i++) {
			int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int p = x[0] - 1, q = x[1] - 1, r = x[2], s = x[3];
			if(r > s) { c[p] += 3; }
			else if(r < s) { c[q] += 3; }
			else { c[p]++; c[q]++; }
		}
		for(int i = 0; i < n; i++) {
			int cnt = 1;
			for(int j = 0; j < n; j++) {
				if(c[i] < c[j]) cnt++;
			}
			Console.WriteLine(cnt);
		}
	}
}

Measured memory_bytes: 9736
// Problem : B - Homework
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


/**         srijan_de
 _____      _ _              ______     
/  ___|    (_|_)             |  _  \    
\ `--. _ __ _ _  __ _ _ __   | | | |___ 
 `--. \ '__| | |/ _` | '_ \  | | | / _ \
/\__/ / |  | | | (_| | | | | | |/ /  __/
\____/|_|  |_| |\__,_|_| |_| |___/ \___|
            _/ |                         
           |__/           23.02.2001     **/
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
#include    <bits/stdc++.h>  
using       namespace       std;
using       lli=            long long  int;
using       ulli=           unsigned long long int;
using       ld=             long double;
#define     mem(a,val)      memset( a,  val,  sizeof(a) )
#define     b_s             binary_search
#define     u_b             upper_bound
#define     l_b             lower_bound
#define     nl              cout<<endl
#define     pb              push_back
#define     pf              push_front
#define     ppb             pop_back
#define     ppf             pop_front
#define     in              insert
#define     fi              first
#define     se              second
#define 	pqueue			priority_queue
const lli   MOD=            (int)1e9 + 7;
const lli   MOD1=           (int)1e9 + 9;
const lli   MOD2=           998244353;
const ld    pi=             atan2(0, -1);
const ld    eps=            1e-9;
lli         tests=          1;
template<class x,class y>x max(x a,y b){return (a>b)?a:b;}
template<class x,class y>x min(x a,y b){return (a<b)?a:b;}
template<class x,class y>x log(x n,y r){return (n>r-1)?1+log(n/r,r):0;}

///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
int32_t main() 
{
	auto start = clock();
ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);	

//	cout<<fixed;
//	cout<<scientific;
//	cout<<fixed<<setprecision(12);
	// cin>>tests;
	for(lli test=1;test<=tests;test++) 
	{
//		cout<<"Case #"<<test<<": ";
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
		
		
		
		lli n,m;
		cin>>n>>m;
		lli a[m],sum=0;
		for(lli i=0;i<m;i++)
	    {
	        cin>>a[i];
	        sum+=a[i];
		
		    
		}
		
		if(sum>n)
		cout<<-1;
		else
		cout<<n-sum;
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
	}
	cerr<<endl<<endl<<endl<< "Time : " << double(clock() - start) / CLOCKS_PER_SEC <<endl;
	return 0;
}
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.


Measured memory_bytes: 3880
def ccw(p1, p2, p3):
    return (p2[1] - p1[1]) * (p3[0] - p1[0]) - (p2[0] - p1[0]) * (p3[1] - p1[1]) > 0

# Andrew's algorithm

def andrew(point_list):
    u = []
    l = []
    point_list.sort()

    u.append(point_list[0])
    u.append(point_list[1])
    
    l.append(point_list[-1])
    l.append(point_list[-2])

    # outward
    for p in point_list[2:]:
        while ccw(u[-1], u[-2], p):
            u.pop()
            if len(u) == 1:
                break
        u.append(p)

    # homeward
    for p in point_list[-3::-1]:
        while ccw(l[-1], l[-2], p):
            l.pop()
            if len(l) == 1:
                break
        l.append(p)

    # concatenate
    u.pop()
    l.pop()
    convex_hull = u + l

    # output
    print(len(convex_hull))
    for p in convex_hull:
        y, x = p
        print(x, y)

import sys

file_input = sys.stdin

n = int(file_input.readline())

P = []
for l in file_input:
    x, y = map(int, l.split())
    P.append((y, x))

# solve
andrew(P)


Measured memory_bytes: 19624
#include <cstdio>
#include <algorithm>
#include <queue>
#include <utility>
#include <cstring>
using namespace std;

#define mp make_pair

typedef pair<int, int> P;
struct Node {
	P a, b;
	int cnt;
	Node(P a, P b, int cnt) : a(a), b(b), cnt(cnt) {}
};

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

int conv(char c) {
	int ret;
	switch(c) {
		case '6': ret = 0; break;
		case '2': ret = 1; break;
		case '4': ret = 2; break;
		case '8': ret = 3; break;
		case '5': ret = 4; break;
	}
	return ret;
}

char field[20][21];

int main() {
	for(int H, W; ~scanf("%d%d", &H, &W), H || W;) {
		P a_fst, b_fst;

		for(int y = 0; y < H; y++) {
			scanf(" %s", field[y]);
			for(int x = 0; x < W; x++) {
				if(field[y][x] == 'A') {
					a_fst = mp(y, x);
					field[y][x] = '.';
				}
				if(field[y][x] == 'B') {
					b_fst = mp(y, x);
					field[y][x] = '.';
				}
			}
		}
		
		char goast[11];
		int gsize;
		scanf(" %s", goast);
		gsize = strlen(goast);

		queue<Node> Q;
		Q.push(Node(a_fst, b_fst, 0));

		bool done[20][20][20][20][10]; // a.y, a.x, b.y, b.x, goast_command_number
		memset(done, 0, sizeof done);

		Node answer = Node(a_fst, b_fst, -1);

		while(!Q.empty()) {
			Node now = Q.front(); Q.pop();
			P a = now.a, b = now.b;
			if(a.first == b.first && a.second == b.second) {
				answer = now;
				break;
			}
			for(int i = 0; i < 5; i++) {
				int nay = a.first + dy[i];
				int nax = a.second + dx[i];
				int nby = b.first + dy[conv(goast[now.cnt % gsize])];
				int nbx = b.second + dx[conv(goast[now.cnt % gsize])];

				if(!(0 <= nay && nay < H && 0 <= nax && nax < W)) continue;
				if(!(0 <= nby && nby < H && 0 <= nbx && nbx < W)) {
					nby = b.first;
					nbx = b.second;
				}
				if(field[nay][nax] != '#' && done[nay][nax][nby][nbx][now.cnt % gsize] == false) {
					done[nay][nax][nby][nbx][now.cnt % gsize] = true;
					Q.push(Node(mp(nay, nax), mp(nby, nbx), now.cnt + 1));
				}
			}
		}

		if(answer.cnt == -1) {
			puts("impossible");
		} else {
			printf("%d %d %d\n", answer.cnt, answer.a.first, answer.a.second);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

ll N;
ll ans = 0;

signed main(){
    cin >> N;
    for(int i=1; i<=N; i++){
        if(i%3 != 0 && i%5 != 0) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#!/usr/bin/env python3
#ABC66 D

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))


def comb(n,r):
    if n - r < 0:
        return 0
    return fact[n] * invfact[r] * invfact[n-r] % mod

n = I()
a = LI()
cnt = [0]*(n+1)
for i in range(n+1):
    if cnt[a[i]]:
        a = cnt[a[i]]
        b = i+1
        break
    else:
        cnt[a[i]] = i+1

fact = [1]*(n+2)
invfact = [1]*(n+2)
for i in range(1,n+2):
    fact[i] = i*fact[i-1] % mod
    invfact[i] = invfact[i-1] * pow(i,mod-2,mod) % mod

for i in range(n+1):
    res = 0
    res = (res + comb(n+1,i+1)) % mod
    res = (res - comb((a-1)+(n+1-b),i)) % mod
    print(res)
    

Measured memory_bytes: 57744
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  int ans = 0;
  for(char c : s){
    if(c == '+') ans++;
    else ans--;
  }
  cout << ans << endl;
  return 0;
}

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;





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

	string s; cin>>s;

	int one=0, zero=0;

	int ans =0;

	rep(i,s.length()){
		if(s[i] == '0'){
			if(one !=0){
				ans +=2;
				one -=1;
			}else {
				zero++;
			}
		}else {
			if(zero !=0){
				ans +=2;
				zero -=1;
			}else {
				one++;
			}
		}
	}

	writeln(ans);

}



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

int main() {
  int n, c, a;
  cin >> n;
  vector<int> vec(n);
  for (int i=0; i<n; i++){
    cin >> vec.at(i);
  }
  c = 1;
  for(int i=0; i<n; i++){
    if(vec.at(i)==c){
      c += 1;
    }
  }
  a = c-1;
  if(a==0){
    cout << -1 << endl;
  }
  else{
    cout << n-a << endl;
  }
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d=a/b;
    r=a%b;
    f=(double)a/(double)b;
    printf("%d %d %lf", d,r,f);
    return 0;
}


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

using namespace std;
#define int long long
#define x first
#define y second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

mt19937 rand1(time(0));
int randlr(int l, int r) {
    return rand1() % (r - l + 1) + l;
}

int dist[100009];
const int mod = 998244353;

int fpow(int x, int y) {
    int answ = 1;
    while (y) {
        if (y & 1) {
            answ = (answ * x) % mod;
        }

        x = (x * x) % mod;
        y >>= 1;
    }

    return answ;
}

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

    int n;
    cin >> n;
    int maxd = 0;

    for (int i = 0; i < n; i ++) {
        int x;
        cin >> x;
        dist[x]++;

        maxd = max(maxd, x);

        if (i == 0 && x != 0) {
            cout << 0;
            return 0;
        }

        if (x == 0 && i != 0) {
            cout << 0;
            return 0;
        }
    }

    int answ = 1;
    for (int i = 1; i <= maxd; i ++) {
        if (dist[i] == 0) {
            cout << 0;
            return 0;
        }

        answ = (answ * fpow(dist[i - 1], dist[i])) % mod;
    }

    cout << answ;

    return 0;
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  ll ans;
  if(x/d >= k) {
    rep(i, k) x -= d;
    ans = x;
  } else {
    k -= x/d;
    x = x%d;
    if(k%2 == 1) ans = abs(x-d);
    else ans = x;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication35
{
    class Program
    {
        static void Main()
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(a[0]*a[1]);
        }
    }
}

Measured memory_bytes: 9624
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
    string N;cin>>N;
    int d=N.size();
    int ans=0;
    int carry=false;
    int carryor=false;
    for (int i = d-1; i >= 0; i--){
        int tmp=(int)N[i]-(int)'0';
        if(carry)tmp++;
        if(carryor&&tmp>=5)tmp++;
        carry=false;carryor=false;
        if(tmp<=4)ans+=tmp;
        else if(tmp==5){
            ans+=5;
            carryor=true;
        }else{
            ans+=10-tmp;
            carry=true;
        }
    }
    if(carry)ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 5336
N = int(input())
S = [1 if s == '<' else 0 for s in input().strip()]
mod = 10**9+7

dp = [1]*N + [0]

for j, s in enumerate(S):
    dp2 = [0]*(N+2)
    if s == 1:
        for i, d in enumerate(dp):
            dp2[0] += d
            dp2[i] -= d
    else:
        for i, d in enumerate(dp):
            dp2[i] += d
            dp2[N-j-1] -= d
    dp2.pop()
    for i in range(1, N+1):
        dp2[i] = (dp2[i-1] + dp2[i]) % mod
    dp = dp2[:]
ans = 0
for d in dp:
    ans = (ans + d) % mod
print(ans)

Measured memory_bytes: 47068
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=100005,M=1e9+7;
struct Tree{
	int l,r,num;
}T[N*4];
int n,x,y,a[N],f[N],g[N],b[N];
void build(int x,int l,int r){
	T[x].l=l;T[x].r=r;
	if (l==r){
		T[x].num=b[l];
		return;
	}
	int mid=(l+r)/2;
	build(x*2,l,mid);
	build(x*2+1,mid+1,r);
	T[x].num=min(T[x*2].num,T[x*2+1].num);
}
int find(int x,int l,int r){
	if (l>r)return 1e18;
	if (T[x].l>r||l>T[x].r)return 1e18;
	if (T[x].l>=l&&T[x].r<=r)return T[x].num;
	return min(find(x*2,l,r),find(x*2+1,l,r));
}
signed main(){
	scanf("%lld%lld%lld",&n,&x,&y);
	for (int i=1;i<=n;i++)scanf("%lld",&a[i]);
	a[0]=-1e18;
	for (int i=1;i<n;i++)b[i]=a[i]-a[i-1];
	build(1,1,n);
	f[1]=g[1]=1;
	for (int i=2;i<=n;i++){
		int l=0,r=i-1;
		while (l<r){
			int mid=(l+r+1)/2;
			if (a[i]-a[mid]>=x)l=mid;
			else r=mid-1; 
		}
		if (i==l+1)f[i]=(f[i-1]+g[i-1])%M; 
		else if (find(1,l+2,i-1)>=y)f[i]=g[l+1];
		l=0,r=i-1;
		while (l<r){
			int mid=(l+r+1)/2;
			if (a[i]-a[mid]>=y)l=mid;
			else r=mid-1; 
		}
		if (i==l+1)g[i]=(g[i-1]+f[i-1])%M; 
		else if (find(1,l+2,i-1)>=x)g[i]=f[l+1];
	} 
	printf("%lld\n",(f[n]+g[n])%M);
}

Measured memory_bytes: 10496
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
#define PI 3.1415926535
using namespace std;
int main() {
	long long x, y;
	cin >> x >> y;
	if (x % y == 0) {
		cout << -1 << endl;
	}
	else {
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	int a, b;
	cin >> a >> b;
	cout << (a - 1)*(b - 1) << endl;
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  double w;

  while(scanf("%lf",&w)!=EOF){
    if(w > 91.0)printf("heavy\n");
    else if(w > 81.0)printf("light heavy\n");
    else if(w > 75.0)printf("middle\n");
    else if(w > 69.0)printf("light middle\n");
    else if(w > 64.0)printf("welter\n");
    else if(w > 60.0)printf("light welter\n");
    else if(w > 57.0)printf("light\n");
    else if(w > 54.0)printf("feather\n");
    else if(w > 51.0)printf("bantam\n");
    else if(w > 48.0)printf("fly\n");
    else printf("light fly\n");
  }

  return 0;
}

Measured memory_bytes: 0
N,M=map(int,input().split())
p=[0]*M
S=["a"]*M

x=[0]*N
y=[0]*N
for i in range(M):
  p[i],S[i]=input().split()
  k=int(p[i])-1
  if x[k]==0:
    if S[i]=="WA":
      y[k]+=1
    else:
      x[k]=1
z=sum(x)
w=0
for i in range(N):
  if x[i]==1:
    w+=y[i]
print(z,w)

Measured memory_bytes: 59856
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
const long long MAX_N = 1e18;
int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(all(A));

    ll ans = 1;
    rep(i, N) {
        if (A[i] != 0 && MAX_N / A[i] < ans) {
            ans = -1;
            break;
        }
        ans *= A[i];
    }

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

Measured memory_bytes: 4052
#include<iostream>
using namespace std;
  
main(){
   int m, f, b;
   cin >> m >> f >> b;

   if (  b > (m + f) ) cout << "NA" << endl;
   else
   if ( b <= m ) cout << 0 << endl;
   else cout << b-m << endl;
return 0;
}


Measured memory_bytes: 3136
#include <stdio.h>

int main(){
	char str[1200];
	char *p;
	int sum;

	while(1){
		gets(str);
		if(str[0] == '0' && str[1] == '\0')break;
		sum = 0;
		for(p = str; *p!='\0'; p++){
			sum += *p - '0';
		}
		printf("%d\n", sum);
	}

	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X,Y, sum;
  cin >> X;
  Y=X;
  int i = 0;
  while(i<8){
    sum += X%10;
    X = X / 10;
    i++;
  }
  if(Y%sum == 0){
    cout << "Yes" << endl;
  }else 
    cout <<"No"<<endl;
  return 0;
}


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


int main(void){
    int a,b,k; cin >> a >> b >> k;
    vector <int> d;
    int count=0,i=1;
    while(i <= max(a,b)){
        if(a%i==0 && b%i==0){
            d.push_back(i);
        }
        i++;
    }
    cout << d.at(d.size()-k) << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
    string s; cin >> s;
    int t[26] = {}, c = 0, m = 0, len[200000];
    for (int i = s.size()-1; i >= 0; i--) {
        t[s[i]-'a']++;
        if (t[s[i]-'a'] == 1) c++;
        if (c == 26) { m++; fill(t, t+26, 0); c = 0; }
        len[i] = m;
    }
    fill(t, t+26, 0);
    int i = 0;
    char prev = 0;
    while (m >= 0) {
        if (prev > 0) { while (i < s.size() && s[i] != prev) i++; i++; }
        if (m > 0) while (len[i+1] == m) { t[s[i]-'a'] = 1; i++; }
        else while (i < s.size()) { t[s[i]-'a'] = 1; i++; }
        for (int j = 0; j < 26; j++) if (t[j] == 0) { prev = j + 'a'; putchar(prev); break; }
        m--;
        fill(t, t+26, 0);
    }
    cout << endl;
}


Measured memory_bytes: 1412
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
typedef pair<ll, int> P;
ll X[100000];
int W[100000];
ll ans[100000];
ll N, L, T;
int get_num(int k) {
	ll cnt = 0;
	for (int i = 0; i < N; i++) {
		if (W[k] == W[i]) continue;
		double t = 0;
		if (W[k] == 1) {
			if (X[i] > X[k]) t = (X[i] - X[k]) / 2.0;
			else t = (X[i] + L - X[k]) / 2.0;
		}
		else {
			if (X[i] > X[k]) t = (L - X[i] + X[k]) / 2.0;
			else t = (X[k] - X[i]) / 2.0;
		}
		if (T < t) continue;
		(cnt += (ll)((T - t) / (L / 2.0)) + 1) %= N;
	}
	ll ret = k;
	if (W[k] == 1) (ret += cnt) %= N;
	else (ret += N - cnt) %= N;
	return ret;
}
int main() {
	cin >> N >> L >> T;
	for (int i = 0; i < N; i++) {
		cin >> X[i] >> W[i];
	}
	vector<P> pos;
	for (int i = 0; i < N; i++) {
		if (W[i] == 1) pos.emplace_back((X[i] + T) % L, i);
		else pos.emplace_back((X[i] + (L - T % L)) % L, i);
	}
	sort(pos.begin(), pos.end());
	int idx = get_num(pos[0].second);
	ans[idx] = pos[0].first;
	for (int i = 1; i < N; i++) {
		if (pos[i].first == pos[0].first) {
			if (W[pos[0].second] == 1) {
				ans[(idx + N - 1) % N] = pos[0].first;
			}
			else {
				(idx += 1) %= N;
				ans[idx] = pos[i].first;
			}
		}
		else {
			(idx += 1) %= N;
			ans[idx] = pos[i].first;
		}
	}
	for (int i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
}


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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a, b, c=0;
  cin >> a >> b;
  if (a >= b){
	c += a;
	a -= 1;
  }else{
	c += b;
	--b;
  }
  cout << c + max(a,b) << "\n";
return 0;
}

Measured memory_bytes: 256
<?php
	$stdin = explode(" ", trim(fgets(STDIN)));
	$rectangle = array(
		$stdin[0],
		$stdin[1]
	);

	$circle_width = array($stdin[2] - $stdin[4], $stdin[2] + $stdin[4]);
	$circle_height = array($stdin[3] - $stdin[4], $stdin[3] + $stdin[4]);

	if (0 <= $circle_width[0] && $circle_width[1] <= $rectangle[0] &&
		0 <= $circle_height[0] && $circle_height[1] <= $rectangle[1]) {
		echo "Yes" . PHP_EOL;
	} else {
		echo "No" . PHP_EOL;
	}

Measured memory_bytes: 15300
import pprint
import itertools

N = int(input())

S = []
for _ in range(N):
    S.append(input())

D = {'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0}

for k in [name[0] for name in S]:
    if k in D:
        D[k] = D[k] + 1

C = 0
for x, y, z in itertools.combinations(D.keys(), 3):
    C += D[x] * D[y] * D[z]

print(C)

Measured memory_bytes: 11180
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <climits>

uint32_t CalcDigits(uint64_t x) {
  uint32_t t = 0;
  while (x > 0) {
    x /= 10;
    t++;
  }
  return t;
}

int main() {
  uint64_t n = 0;
  std::scanf("%lld", &n);

  uint32_t cur_min = UINT_MAX;

  for (uint64_t i = 1; i * i <= n; i++) {
    if (n % i != 0) continue;
    cur_min = std::min(cur_min, std::max(CalcDigits(i), CalcDigits(n / i)));
  }
  std::cout << cur_min << std::endl;
  return 0;
}


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

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

    x = ( a + b ) / 2;
    if (x * 2 != ( a + b ) ) {
        cout << ( x + 1) << endl;
    } else {
        cout << x << endl;
    }

}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if((b-a) > x)
    {
        cout << "dangerous";
    }
    else if((b-a) <= x && (b-a) > 0)
    {
        cout << "safe";
    }
    else
    {
        cout << "delicious";
    }
    
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int inf = 1e9;

int main() {
	int N;
	cin>>N;
	vi a(N);
	rep(i,N)cin>>a[i];
	sort(all(a));
	int ans=a[N-1]-a[0];
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int n;
    scanf("%d",&n);
    int a[n];
    float ans = 0;
    for(int i = 0;i < n;i++) {
        scanf("%d",&a[i]);
        ans += 1.0/a[i];
    }
    printf("%f",1.0/ans);
    return 0;
}

Measured memory_bytes: 128
// I can't tell you what it really is,
// I can only tell you what it feels like.
#include "bits/stdc++.h"
using namespace std;

#define int long long
#define F first
#define S second
#define rep(i,a,n) for (int i = a; i <= n; ++i)
#define fo(i, n)   for (int i = 1; i <= n; ++i)
#define all(v)  v.begin(), v.end()
#define pb push_back
#define P pair < int, int >
#define fast  ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define E cout << '\n'
const int N = 1e5 + 5;
int dp[N], a[N];
signed main(){
   fast;
   int n;
   cin >> n;
   for(int i = 1; i <= n; ++i)
        cin >> a[i];
   if(n == 1)
        return cout << 0,0;
   dp[1] = 0;
   dp[2] = abs(a[1] - a[2]);

   for(int i = 3; i <= n; ++i) {
      dp[i] = min(dp[i-1] + abs(a[i] - a[i-1]), dp[i-2] + abs(a[i] - a[i-2]));
   }

   cout << dp[n];
   return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

int main()
{
	string N;
	cin >> N;
	int sum = 0;
	for (int i = 0; i < N.length(); ++i)
	{
		sum += (unsigned char)N[i] - 48;
		//cout << sum << endl;
	}

	if (sum % 9 == 0)
	{
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;

}

Measured memory_bytes: 3660
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<cctype>
using namespace std;

int main() {
	int x;
	cin >> x;
	if (x < 1200)
		cout << "ABC" << endl;
	else
		cout << "ARC" << endl;
}

Measured memory_bytes: 256
A = [0]*3
A[0] = list(map(int, input().split()))
A[1] = list(map(int, input().split()))
A[2] = list(map(int, input().split()))
n = int(input())
b = [0]*n
for i in range(n):
  b[i] = int(input())

flag = []
flag.append([0]*3)
flag.append([0]*3)
flag.append([0]*3)


for i in range(3):
  for j in range(3):
    if A[i][j] in b:
      flag[i][j] = 1
#print(flag)      
  
ans = "No"
for i in range(3):
  if flag[i] == [1,1,1]:
    ans = "Yes"
  
x = [0,0,0]
y = [0, 0]
for i in range(3):
  y[0] += flag[i][i]
  y[1] += flag[i][2-i]
  for j in range(3):
  	x[j] += flag[i][j]
#print(x,y)
if 3 in x:
  ans = "Yes"
if 3 in y:
  ans = "Yes"
  
print(ans)


    

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

typedef long long ll;

char s[200005];


int main()
{
	
	int n;
	cin>>n;
	vector<int> pos1,pos2;
	int num1=0,num2=0;
	cin>>s;
	for( int i=0;i<n;i++ )
	{
		if( s[i]=='R' ) pos1.push_back(i);
		else pos2.push_back(i);
	}
	int l=pos1.size()-1,r=0;
	if( pos1.size()==0 || pos2.size()==0 )
	{
		puts("0");
		return 0;
	}
	
	int ans=0;
	while( r<pos2.size() )
	{
		if( pos2[r]>pos1[l] ) break;
		
	//	while( r<pos2.size() && pos2[r]>=pos1[l] ) r--;
		
		if( l>=0 && r<pos2.size() )
		{
			ans++;
			l--;
			r++;
		}
	}
	cout<<ans<<endl;
	
	
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	ll n, p;
	cin >> n >> p;

	if(n == 1){
		cout << p << endl;
		return 0;
	}

	int sqp = (int)sqrt(p) + 1;
	map<int, int> mp;

	for(int i = 2; i <= sqp; i++){
		while(p % i == 0){
			auto it = mp.find(i);
			if(it == mp.end()) mp[i] = 0;
			mp[i]++;
			p /= i;
		}
	}

	int ans = 1;
	for(auto itr = mp.begin(); itr != mp.end(); ++itr){
		int k = itr->first;
		int v = itr->second;

		while(v >= n){
			ans *= k;
			v -= n;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstdio>
using namespace std;
typedef long long int ll;

main(){
	string s;
	vector<int> memo(10, 33);
	int memot = 0;
	cin >> s;
	cout << "+++++++++++[>+++<-]>[->+>+>+>+>+>+>+>+>+>+<<<<<<<<<<]>";
	for(int i=0;i<s.size();i++){
		int t = (s[i]-33)/10;
		cout << string(abs(t-memot), t < memot ? '<' : '>');
		cout << string(abs(s[i]-memo[t]), s[i] < memo[t] ? '-' : '+') << '.';
		memo[t] = s[i];
		memot = t;
	}
	return 0;
}

Measured memory_bytes: 1176
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#include<map>
#include<cmath>
#include<queue>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const int N=100010;

int main()
{
    IO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        cout<<max(max(a*c,a*d),max(b*c,b*d))<<endl;
    }
    return 0;
}

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

using namespace std;


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

    int res = a[0];
    for (int i = 1; i < N; i++) res = __gcd(res, a[i]);

    cout << res <<endl;
}
    


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

using namespace std;

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

  vector<int> p(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
  }

  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (p[i] == i) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  if (p[n] == n) ans++;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

/*

?±±?????????
?±±???????????????????????????????????´??°??§??¨?????? 10 ??????????????????????????????????????? 10 ????????????????????????????????????????????§??????????????????3???????????????????????°?????????????????????????????????

Input
?±±?????????1
?±±?????????2
     .
     .
?±±?????????10

Output
1????????????????±±?????????
2????????????????±±?????????
3????????????????±±?????????

*/

#define		D_NUM	10
#define		D_MAX	3

int main( void )
{
	int m[ D_NUM ], i, j, w;
	
	for ( i = 0 ; i < D_NUM ; i++ ) {
		scanf( "%d", &m[ i ] );
	}
	
	for ( i = 0 ; i < D_NUM - 1 ; i++ ) {
		for ( j = i + 1 ; j < D_NUM ; j++ ) {
			if ( m[ i ] < m[ j ] ) {
				w		= m[ i ];
				m[ i ]	= m[ j ];
				m[ j ]	= w;
			}
		}
	}
	
	for ( i = 0 ; i < D_MAX ; i++ ) {
		printf( "%d\n", m[ i ] );
	}
	
	return 0;
}

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

using namespace std;

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif
	
	int a, b, c;

	cin >> a >> b >> c;

	if (b*c >= a) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 3568
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
sys.setrecursionlimit(10**9)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i: divisors.append(n//i)
    return divisors
def is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n + 1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def sieve_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

S=input()
 
l = len(S)
cnt = [0] * (l+1)
for i in range(l):
    if S[i] == '<':
        cnt[i+1] = cnt[i]+1
for i in range(l-1, -1, -1):
    if S[i] == '>':
        cnt[i] = max(cnt[i], cnt[i+1]+1)
print(sum(cnt))

Measured memory_bytes: 25644
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

//-----------------------ここから-----------


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

    vector<int> x(N), y(M);

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

    bool ok = false;
    for(int z = 0; z < 101; z++){
        if(z <= X || z > Y)continue;
        
        bool xok = true;
        for(int i = 0; i < x.size(); i++){
            if(x[i] >= z){
                xok = false;
                break;
            }
        }
        if(!xok)continue;

        bool yok = true;
        for(int i = 0; i < y.size(); i++){
            if(y[i] < z){
                yok = false;
                break;
            }
        }
        if(!yok)continue;

        ok = true;
        break;
    }

    if(ok){
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }

}



Measured memory_bytes: 256
/*
本宝的程序外人别想看！！

name: [夏宝宝]
run time：[] ms
compilation time: [] ms
output memory: [] MiB
where: []
state: []
*/
#include<bits/stdc++.h>
using namespace std;

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	
	cout.sync_with_stdio(false);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	char a[4];
	
	a[1]=getchar();
	a[2]=getchar();
	a[3]=getchar();
	
	bool b[3]={false};
	
	for(int i=1; i<=3; i++)
	{
		if(a[i]=='A')
		{
			b[1]=true;
		}
		else if(a[i]=='B')
		{
			b[2]=true;
		}
	}
	
	if(b[1]==true && b[2]==true)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
n,y = map(int,input().split())
s,t,u = -1,-1,-1
for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i+5000*j+1000*(n-i-j) == y:
            s,t,u = i,j,n-i-j
print(s,t,u)

Measured memory_bytes: 3060
n,m,c=map(int,input().split())
b=list(map(int,input().split()))

cnt=0
for i in range(n):
    
    a=list(map(int,input().split()))
    wrk=0
    for j in range(m):
        wrk+=a[j]*b[j]
    if(wrk+c>0):
        cnt+=1
print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
 
using namespace std; 
 
#define NOT_FOUND -1
#define rep(i,n) for(int i=0;i<(int)(n); i++)
/*for文のマクロ定義
rep(i,回数){
    処理
}
*/
 
void swap(int *a, int *b){
	*b=*a-*b;
	*a-=*b;
	*b+=*a;
}
 
int sosu_judge(int N){
	/*素数ならば1
	  素数でなければ0を返す
	*/
	int i,j;
 
	if(N==2)   return 1;
	if(N%2==0) return 0;
 
	for(i=3;i<N && N%i!=0;i+=2);
 
	if(i>=N) return 1;
	
	return 0;
}
 
int factorial(int N){  //Nの階乗を求める関数
	int ans=1;
 
	while(N--) ans*=(N+1);
	return ans;
}
 
//クイックソートをする関数
void q_sort(int a[], int first, int last){
    int i,j;
    int x,t;
 
    x = a[(first + last) / 2];
    i = first; j=last;
 
    while(1){
        while( a[i] < x) i++;
        while( x < a[j]) j--;
        
        if( i >= j) break;
        
        swap(&a[i],&a[j]);
        i++; j--;
    }
    if(first < i-1) q_sort(a, first,i-1 );
    if(last > j+1)  q_sort(a, j+1,  last);
}
 
int b_search(int target, int array[],int right, int left){
    /*二分探索を行う関数である。
      戻り値は探索したい値の格納されている位置である。
      もし値が存在しない場合、NOT_FOUND(-1)を返す
    */
    int mid;
    while(left<right){
        mid=(right+left)/2;
        if(array[mid]<target) left =mid+1;
        else                  right=mid;
    }
    if(array[mid]==target) return mid;
    return NOT_FOUND;
}
 
unsigned long combination(int n, int r){
    /*nCrの値を求める関数である。
      値が巨大になる可能性があるため、戻り地はunsigned longである
    */
    int i,j;
    unsigned long a[17];
 
    if(n-r<r) r=n-r;
    if(r==0 ) return 1;
    if(r==1 ) return n;
    if(r>17 ) return 0;
    for(i=1;i<r;i++) a[i]=i+2;
    for(i=3;i<=n-r+1;i++){
        a[0]=i;
        for(j=1;j<r;j++)a[j]+=a[j-1];
    }
    return a[r-1];
}

int main(){
    long X,ans=0;

    cin>>X;

    ans=1000*(X/500);
    X=X%500;
    ans=ans+5*(X/5);
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256