akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int a,b; cin>>a>>b;
    cout<<(a-1)*(b-1)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string target;
    cin >> target;
    transform(target.begin(), target.end(), target.begin(), ::toupper);
    int count = 0;
    while(true){
        string word;
        cin >> word;
        if(word == "END_OF_TEXT"){break;}
        transform(word.begin(), word.end(), word.begin(), ::toupper);
        if(word == target){count++;}
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define vec_output(v) for(auto it=v.begin();it!=v.end();it++){if(it!=v.begin())cout<<" ";cout<<*it;}cout<<endl;
#define vec_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
using namespace std;
using ll = long long;
template <typename T>T digitsum(T n);
template <typename T>bool isPrime(T n);
template <typename T>vector<pair<T, T>> prime_factor(T n);
long long int intpow(long long int,long long int);
template <typename T>T intlog(T);
long long int combination(long long int,long long int);
long long int series_sum(long long int);

int main(){
    vector<int> vec(4);
    vec_input(vec);
    sort(all(vec));
    cout<<abs(vec[3]+vec[0]-vec[1]-vec[2])<<endl;
}


Measured memory_bytes: 3152
#include <iostream>
#include <vector>
using namespace std;
#define ll long long

int main(void)
{
    ll h, w, k, ans = 0;
    cin >> h >> w >> k;
    vector<vector<char>>  c(h, vector<char>(w));
    vector<bool>  he(h), wi(w);
    for(ll i = 0; i < h; i++)
        for(ll j = 0; j < w; j++)
            cin >> c.at(i).at(j);
    
    for(ll i = 0; i < (1 << h); i++) {
        for(ll j = 0; j < h; j++) {
            if(1 & (i >> j))
                he.at(j) = false;
            else
                he.at(j) = true;
        }

        for(ll j = 0; j < (1 << w); j++) {
            ll num = 0;
            for(ll k = 0; k < w; k++) {
            if(1 & (j >> k))
                wi.at(k) = false;
            else
                wi.at(k) = true;
            }

            for(ll k = 0; k < h; k++)
                for(ll l = 0; l < w; l++)
                    if(he.at(k) && wi.at(l) && c.at(k).at(l) == '#')
                        num++;

            if(num == k)
                ans++;
        }
    }

    cout << ans;

}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define fo(i,n) for(int i=0;i<n;++i)
#define Fo(i,k,n) for(int i=k;i<=n;++i)
typedef long long int lli;
int main(){
    FIO
    string S ; cin>>S;
    int i,n=S.size(),count=0,ans=0;
    fo(i,n){
    if(S[i]=='R')
        count++;
      if(count>ans) ans=count;
      else count=0;
    }
  cout<<ans<<endl;
}


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

int main() 
{
    string s;
    long k;
    cin >> s >> k;
    for (int i = 0; i < k; i++) 
    {
        if (s[i] != '1')
        {
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 256
string = input()
for i in range(len(string)):
    if i % 2 == 0:
        if string[i] == 'h':
            continue
        else:
            print('No')
            break
    elif i % 2 == 1:
        if string[i] == 'i':
            continue
        else:
            print('No')
            break
else:
    if len(string) % 2 == 1:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 3060
while True:
    try:
        n = int(input())
        N = list(map(int, input().split()))
        N.reverse()

        mini = N[0]
        noAns = False
        for i in range(1, n):
            if N[i] <= mini:
                mini = N[i]
            elif N[i] == mini + 1:
                N[i] -= 1
            else:
                noAns = True
                break
        
        if noAns:
            print("No")
        else:
            print("Yes")
    except:
        break
                

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

int main()
{
	/*
	while (true) {
		long long  x;
		cin >> x;
		if (x == 0)
			break;
		else {
			long long   n = 0;
			while (x > 0) {
				int m = x % 10;
				n += m;
				x = x / 10;
			}
			cout << n << endl;
		}
		
	}
    */

	while (true) {
		string x;
		cin >> x;
		if (x == "0")
			break;
		int sum = 0;
		for (int i = 0; i < x.size(); i++) {
			sum += x.at(i) - '0';
		}
		cout << sum << endl;
	}



}




Measured memory_bytes: 3156
n = int(input())
h = [int(i) for i in input().split()]
a = [0]*n
for i in reversed(range(1, n)):
    if h[i] - h[i-1] < 0:
        if h[i] - h[i-1] == -1:
            h[i-1] = h[i-1] - 1
        else:
            print('No')
            exit(0)
print('Yes')

Measured memory_bytes: 14224
from collections import Counter

class BIT:
    def __init__(self,n):
        self.tree = [0]*(n+1)
        self.size = n
    
    def sum(self,i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i&-i
        return s

    def add(self,i,x):
        while i <= self.size:
            self.tree[i] += x
            i += i&-i

S = input()
N = len(S)
count = Counter(S)
flag = False
for v in count.values():
    if v%2 == 1:
        if flag:
            print(-1)
            exit()
        else:
            flag = True


"""
文字sのi文字目がどこにあるか、をO(1)で取り出せる辞書が必要
"""
placeAtS = {s:[] for s in list(set(S))}
for i in range(N):
    s = S[i]
    placeAtS[s].append(i)

count2 = {s:0 for s in list(set(S))}

placeAtT = [None]*(N)
tmp = 0
for i in range(N):
    s = S[i]
    count2[s] += 1
    if count2[s] <= count[s]//2:
        placeAtT[i] = tmp
        mirror = placeAtS[s][count[s]-count2[s]]
        placeAtT[mirror] = N - tmp - 1
        tmp += 1

for i in range(N):
    if placeAtT[i] == None:
        placeAtT[i] = tmp

bit = BIT(N)
ans = 0
for i in range(N):
    bit.add(placeAtT[i]+1,1)
    ans += bit.sum(N) - bit.sum(placeAtT[i]+1)

print(ans)


Measured memory_bytes: 96184
nget::Int -> IO [(Int,Int)]
nget 0 = return []
nget n = do
    tac<-getLine
    let t:a:[] =  map read (words tac)::[Int]
    rest<-nget (n-1)
    return ((t,a):rest)

main::IO()
main = do
  nc<- getLine
  let n = read nc ::Int
  dat<-nget n
  print (solver dat)


solver::[(Int,Int)]-> Int
solver (x:xs) = let (t,a)= (foldl step x xs) in (t+a)


step::(Int,Int) -> (Int,Int) -> (Int,Int)
step (t_tot,a_tot) (t,a)
      | (t_q > a_q)  = let l =  if t_m==0 then t_q else t_q +1 in (l*t,l*a)
      | (t_q < a_q)  = let l =  if a_m==0 then a_q else a_q +1 in (l*t,l*a)
      | (t_q ==a_q)  = if (t_m==0)&&(a_m==0) then (t_q*t,a_q*a) else ((t_q+1)*t,(a_q+1)*a)
                    where t_q = div t_tot t
                          a_q = div a_tot a
                          t_m = mod t_tot t
                          a_m = mod a_tot a


Measured memory_bytes: 1660
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans = 0

for i in range(n):
    cnt = 0
    for j in range(n):
        if j < i:
            cnt += a[j]
        elif j == i:
            cnt += a[j]+b[j]
        else:
            cnt += b[j]
        ans = max(cnt, ans)

print(ans)

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


int main() {
	int n;
	int r, g, b;
	cin >> r >> g >> b >> n;
	int ans = 0;
	int a, c;
	a = (n - n % r) / r;
	for (int i = a; i >= 0; i--) {
		int x;
		x = n - r * i;
		c = (x - x % g) / g;
		for (int j = c; j >= 0; j--) {
			int y;
			y = x - g * j;
			if (y%b == 0) ans++;
			else;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(k,i,n) for(long long i=k;i<n;++i)
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll N,K,Q;
    cin>>N>>K>>Q;
    ll A[100000]={0};
    rep(0,i,Q){
        ll B;
        cin>>B;
        ++A[B-1];
    }
    rep(0,i,N){
        ll sum=K+A[i]-Q;
        if(sum>0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,st,en) for(i=st;i<=en;i++)
#define repv(i,en,st) for(i=en;i>=st;i--)
#define fout cout<<fixed<<setprecision(7)
#define bi(n) __builtin_popcount(n)
#define bil(n) __builtin_popcountll(n)


typedef long long ll;
typedef pair<int,int> pii;
const int N = 200010;
ll mod = 1e9+7;
ll fmod(ll b,ll exp){
    ll res =1;
    while(exp){if(exp&1ll)res=(res*b)%mod;
    b =(b*b)%mod;exp/=2ll;
    }
    return res;
}


int pre[N];
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n,m,i,j,k,x,q;
    int t=1;
    string s;
    cin>>s;
    n = s.length();
    s = "#"+s;
    if(n<=2){cout<<"0\n";return 0;}
    rep(i,1,n){pre[i]=pre[i-1];if(s[i]=='A')pre[i]++;}
    i = 1;
    int ind = 0;
    ll tot = 0;
    while(i<n){
        if(s[i]=='B' && s[i+1]=='C'){
            tot += pre[i]-pre[ind];
            i += 2;
            continue;
        }
        if(s[i]=='A'){i++;continue;}
        if(s[i]=='B' || s[i]=='C'){ind=i;i++;continue;}
    }
    cout<<tot<<"\n";





        

    
    return 0;
}


Measured memory_bytes: 1360
#include <cstddef>
#include <cstdint>
#include <vector>

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

template <typename T>
std::vector<T> make_v(usize a) { return std::vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(usize a, Ts... ts) {
  return std::vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename std::enable_if<std::is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename std ::enable_if<std::is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
  for (auto &e : t) fill_v(e, v);
}

template <typename T, typename V>
inline void chmin(T &a, V b) {
  if (a > b) a = b;
}
template <typename T, typename V>
inline void chmax(T &a, V b) {
  if (a < b) a = b;
}

} // namespace null_null

#include <algorithm>
#include <iostream>
#include <utility>

namespace null_null {

void main_() {
  usize N;
  std::cin >> N;
  std::vector<i32> d(N);
  for (usize i = 0; i < N; i++) std::cin >> d[i];

  std::sort(d.begin(), d.end());

  std::cout << d[N / 2] - d[N / 2 - 1] << std::endl;
}

} // namespace null_null

int main() {
  null_null::main_();
  return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/ruby
while gets
  a,b,n = $_.chomp.split.map{|x| x.to_i}
  s = (a.to_f/b).to_s.sub(/[^\.]*\./,"")[0,n]
  t = s.split(//).map{|x|x.to_i}
  u = t.inject(0){|acc,i| acc += i}
  puts u
end

Measured memory_bytes: 8696
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1e9+7;
const long long maxn=2*1e5+10;
const long long inf=99999999999;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<ll> uid(l, r); return uid(rng); }
 
ll power(ll x, ll y){  
	ll p=mode, res=1;
    x = x % p;
    while (y > 0) {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}  

vector<ll> adj[maxn];

void solve(){
	
	ll x;
	cin>>x;
	for (ll i=-120;i<=120;i++){
		for (ll j=-120;j<=120;j++){
			ll a=pow(i, 5);
			ll b=pow(j, 5);
			if ((a-b)==x){
				cout<<i<<" "<<j<<endl;
				return;
			}
		}
	}
	
	return;
}
 
int main(){ 
    
    #ifndef ONLINE_JUDGE
		//freopen("input.txt", "r", stdin);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);
 	
	//T{ solve(); }
	solve();
	
	return 0;
}

Measured memory_bytes: 8648
n=int(input(""))
list1=list(map(int,input("").split(" ")))

list2=[i for i in list1]

    
list1.sort()

count=0

for i in range(n):
    if(list1[i]!=list2[i]):
        count+=1
 
if(count>2):
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3064
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    x = int(ipt())
    for i in range(10**9):
        if i*(i+1)//2 >= x:
            print(i)
            exit()

    return

if __name__ == '__main__':
    main()


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

struct Work {int s, t, e;};

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

  int s, t, e;
  vector<Work> work;
  while(cin >> s >> t >> e, s | t | e) work.push_back({s - 1, t - 1, e});

  int L;
  cin >> L;
  for(int l = 0; l < L; ++l) {
    vector<int> b(M);
    for(auto& i: b) cin >> i;
    vector<int> c(N, 0);
    for(const auto& w: work) c[w.s] += b[w.t] * w.e;

    for(int i = 0; i < N; ++i) cout << (i == 0 ? "" : " ") << c[i];
    cout << endl;
  }
}

Measured memory_bytes: 2004
if __name__ == '__main__':
    # ??????????????\???
    my_cards = []  # ????????¶?????\??????????????????????????§
    card_num = int(input())
    for i in range(card_num):
        data = [x for x in input().split(' ')]
        suit = data[0]
        rank = int(data[1])
        my_cards.append((suit, rank))

    full_cards = []  # 52?????¨????????£??????????????????
    for r in range(1, 13+1):
        full_cards.append(('S', r))
        full_cards.append(('H', r))
        full_cards.append(('D', r))
        full_cards.append(('C', r))

    # ??????????????¨???????¶??????????????¢???????????????°??????????????????
    missing_cards = set(my_cards) ^ set(full_cards)
    missing_spades = [x for x in missing_cards if x[0]=='S']
    missing_hearts = [x for x in missing_cards if x[0] == 'H']
    missing_clubs = [x for x in missing_cards if x[0] == 'C']
    missing_diamonds = [x for x in missing_cards if x[0] == 'D']
    missing_spades.sort(key=lambda x: x[1])
    missing_hearts.sort(key=lambda x: x[1])
    missing_clubs.sort(key=lambda x: x[1])
    missing_diamonds.sort(key=lambda x: x[1])

    # ????¶???????????????¨???
    for s, r in missing_spades:
        print('{0} {1}'.format(s, r))
    for s, r in missing_hearts:
        print('{0} {1}'.format(s, r))
    for s, r in missing_clubs:
        print('{0} {1}'.format(s, r))
    for s, r in missing_diamonds:
        print('{0} {1}'.format(s, r))

Measured memory_bytes: 7788
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;

const int MOD = 1000000007;
const lint INF = 1LL << 60;

const double PI = acos(-1);
const double Rad2Deg = 180.0 / PI;
const double Deg2Rad = PI / 180.0;

int main() {
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if (A1 + A2 + A3 >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}


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

int main(){
    long long a, b, c;
    cin >> a >> b >> c;
    if(a%2 == 0 || b%2 == 0 || c%2 == 0){
        cout << 0;
    }else{
        cout << min(a*b, min(b*c, c*a));
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define NIL -1
//#define DEBUG

typedef struct node{
  int id;
  int k;
  int parent;
  int *c;
}node;

void printTree(node*,int);
int depth(node*,int,int);

int main(){
  node *tree;
  int i,j,n,id,k;

  scanf("%d",&n);

  tree = (node *)malloc(sizeof(node)*n);

  for(i=0;i<n;i++) tree[i].parent = -1;

  for(i=0;i<n;i++){
    scanf("%d %d",&id,&k);
    tree[id].c = (int *)malloc(k*sizeof(int));
    tree[id].id=id;
    tree[id].k=k;
    for(j=0;j<tree[id].k;j++){
      scanf("%d",&tree[id].c[j]);
      tree[tree[id].c[j]].parent = id;
    }
  }

  #ifdef DEBUG
  printf("debug\n");
  
  for(i=0;i<n;i++){
    printf("id=%d k=%d parent=%d depth=%d ",tree[i].id,tree[i].k,tree[i].parent,depth(tree,i,0));
    for(j=0;j<tree[i].k;j++){
      printf("c%d=%d ",j+1,tree[i].c[j]);
    }
    printf("\n");
  }
  #endif

  printTree(tree,n);
    
  return 0;
}

void printTree(node* tree,int n){
  int i,j,d;
  
  for(i=0;i<n;i++){
    d=depth(tree,i,0);
    printf("node %d: parent = %d, depth = %d, ",i,tree[i].parent,d);
    if(d == 0) printf("root, [");
    else if(tree[i].k == 0) printf("leaf, [");
    else printf("internal node, [");
    for(j=0;j<tree[i].k;j++){
      if(j != 0) printf(", ");
      printf("%d",tree[i].c[j]);
    }
    printf("]\n");
  }
  
  return;
}

int depth(node* tree,int c,int d){
  if(tree[c].parent == NIL) return d;
  else{
    d++;
    return depth(tree,tree[c].parent,d);
  }
}
  

Measured memory_bytes: 6472
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;

ll gcd(ll x, ll y) {
	if (x < y) swap(x, y);
	if (y == 0)return x;
	return gcd(y, x % y);
}

long long mypow(long long k, long long n) {
	long long temp = 1;

	k = k % DIV;
	while (n) {
		if (n % 2) temp = temp * k % DIV;
		k = k * k % DIV;
		n = n / 2;
	}
	return temp % DIV;
}

int main() {
	int N; cin >> N;
	map<tuple<int, ll, ll>, int> cnt;
	ll zab = 0, za = 0, zb = 0;
	for (int i = 0; i < N; i++) {
		ll a, b; cin >> a >> b;
		if (a == 0 && b == 0)zab++;
		else if (a == 0) za++;
		else if (b == 0)zb++;
		else {
			ll co = gcd(abs(a), abs(b));
			tuple<int, ll, ll> temp;
			if ((a / abs(a)) * (b / abs(b)) >= 0) get<0>(temp) = 1;
			else get<0>(temp) = -1;
			get<1>(temp) = abs(a) / co, get<2>(temp) = abs(b) / co;
			cnt[temp]++;
		}
	}

	ll a1 = 1;
	map<tuple<int, ll, ll>, bool> his;
	for (auto x : cnt) {
		his[x.first] = true;
		tuple<int, ll, ll> pr;
		get<0>(pr) = (-1) * get<0>(x.first), get<1>(pr) = get<2>(x.first), get<2>(pr) = get<1>(x.first);
		if (his[pr])continue;
		his[pr] = true;
		ll  temp = (mypow(2, x.second) + mypow(2, cnt[pr]) - 1) % DIV;
		a1 *= temp;
		a1 %= DIV;
	}

	a1 *= (mypow(2, za) + mypow(2, zb) - 1) % DIV;
	a1 %= DIV;
	a1 += zab;
	a1 %= DIV;
	cout << (a1 - 1+DIV)%DIV << endl;
}


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

void CHECK_NUM(int, int);
void INCLUDE3(int, int, int);
void END_CHECK_NUM(int, int);

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

	CHECK_NUM(n, 1);

	return 0;
}

void CHECK_NUM(int n, int i)
{
	int x = i;
	if (x % 3 == 0) {
		cout << " " << i;
		END_CHECK_NUM(n, i);
	}
	INCLUDE3(x, i,n);
}

void INCLUDE3(int x, int i,int n)
{
	if (x % 10 == 3) {
		cout << " " << i;
		END_CHECK_NUM(n, i);
	}
	x /= 10;
	if (x) {
		INCLUDE3(x, i, n);
	}
	END_CHECK_NUM(n, i);
}

void END_CHECK_NUM(int n, int i)
{
	if (++i <= n) {
		CHECK_NUM(n, i);
	}
	cout << endl;

	exit(EXIT_SUCCESS);
}


Measured memory_bytes: 4224
#include <iostream>

using namespace std;


int main(){
    
    int r, c, value;
    long long table[101][101]={0L}; 

    cin >> r >> c;
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
           cin >> value;
           table[i][j] = value;
           table[i][c] += value;
           table[r][j] += value;
        }
        table[r][c] += table[i][c];
    }

    for(int i=0; i<=r; i++){
        for(int j=0; j<=c; j++){
            cout << table[i][j];
            if(j<c){
                cout << " ";
            }
        }
        cout << endl;
    }
    

    return 0;
}




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

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> cities[100001];
    for(int i=0; i<M; i++){
        int p, y;
        cin >> p >> y;
        cities[p].push_back({y, i});
    }

    pair<int, int> ans[100001];
    for(int i=1; i<=N; i++){
        sort(cities[i].begin(), cities[i].end());
        for(int j=0; j<cities[i].size(); j++){
            ans[cities[i][j].second] = {i, j+1};
        }
    }

    for(int i=0; i<M; i++){
        printf("%06d%06d\n", ans[i].first, ans[i].second);
    }
    return 0;
}

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

//const int mod = 998244353;
const int mod=1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

// 出力は.xで！！！！

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
    int n,k; cin >> n >> k;
    vector<ll> pos,neg;
    rep(i,n){
        ll a; cin >> a;
        if(a<0) neg.push_back(a);
        else pos.push_back(a);
    }
    sort(all(pos));
    sort(all(neg));
    reverse(all(neg));
    int pl=pos.size();
    int nl=neg.size();
    mint ans=1;
    if(n==k){
        rep(i,pl){
            ans*=pos[i];
        }
        rep(i,nl){
            ans*=neg[i];
        }
        cout << ans.x << endl;
        return 0;
    }
    if(nl==n && k%2==1){
        rep(i,k){
            ans*=neg[i];
        }
        cout << ans.x << endl;
        return 0;
    }
    int posp=pl-1;
    int negp=nl-1;
    while(k>0){
        if(k==1){
            ans*=pos[posp];
            break;
        }
        if(posp<0){
            ans*=neg[negp--];
            ans*=neg[negp--];
            k-=2;
            continue;
        }
        if(negp<1){
            ans*=pos[posp--];
            k--;
            continue;
        }
        if(posp==0 && k%2==1){
          ans*=pos[posp--];
          k--;
          continue;
        }
        if(posp==0 && k%2==0){
          ans*=neg[negp--];
          ans*=neg[negp--];
          k-=2;
        }
        ll can1=pos[posp]*pos[posp-1];
        ll can2=neg[negp]*neg[negp-1];
        if(can1>can2){
            ans*=pos[posp--];
            k--;
        }
        else{
            ans*=neg[negp--];
            ans*=neg[negp--];
            k-=2;
        }
    }

    cout << ans.x << endl;

    return 0;
}

Measured memory_bytes: 5436
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b,c = LI()
    print(9*max(a,b,c)+a+b+c)
    return

#B
def B():
    a,b = LI()
    if a*b %2:
        print("Yes")
    else:
        print("No")
    return

#C
def C():
    k = I()
    print((k//2)*(k//2+k%2))
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 39152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Atcoderrrrrrr
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            int C = int.Parse(Console.ReadLine());
            int D = int.Parse(Console.ReadLine());

            var trainlist = new int[] { A, B};
            var buslist = new int[] { C, D };

            Console.WriteLine(trainlist.Min() + buslist.Min());

        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int N;
int A[200000];
int main(){
  int i;
  long long d, res=4611686016279904256LL, sum=0;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  for(i=0;i<N;i++){
    sum += A[i];
  }
  d = 0;
  for(i=0;i<N-1;i++){
    d += A[i];
    chmin(res, abs(sum - 2*d));
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// int N, A[2d5];
// {
//   int i;
//   ll d, sum = 0, res = ll_inf;
// 
//   rd(N,A(N));
//   
//   rep(i,N) sum += A[i];
// 
//   d = 0;
//   rep(i,N-1){
//     d += A[i];
//     res <?= abs(sum - 2d);
//   }
//   
//   wt(res);
// }


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin>>a;
    if(a[0]=='Y'&&a[1]=='A'&&a[2]=='K'&&a[3]=='I'){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// long long check(long long x, long long y)
// {
//     return x * x * x * x + x * x * x * y + x * x * y * y + x * y * y * y + y * y * y * y;
// }
// void tf(long long x, long long y)
// {
//     long long l = 0, r = y - x;
//     while (l < r)
//     {
//         long long mid = (l + r) >> 1;
//         if (check(mid, mid + x) > y / x)
//         {
//             r = mid - 1;
//         }
//         else
//         {
//             l = mid;
//         }
//     }
//     if (check(l, l + x) == y / x)
//     {
//         cout << l + x << " " << l << endl;
//         exit(0);
//     }
//     for (int i = -x; i <= x; i++)
//     {
//         if (check(i, i + x) == y / x)
//         {
//             cout << i + x << " " << i << endl;
//             exit(0);
//         }
//     }
// }
void solve(long long X)
{
    for (long long i = 0; i <= X; i++)
    {
        long long y = pow(abs(i * i * i * i * i - X), 1.0 / 5);
        // cout << i << " " << y << " " << i * i * i * i * i - X << endl;
        if (i * i * i * i * i == X + y * y * y * y * y)
        {
            cout << i << " " << y << endl;
            exit(0);
        }
        if (i * i * i * i * i == X - y * y * y * y * y)
        {
            cout << i << " " << -y << endl;
            exit(0);
        }
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long X;
    scanf("%lld", &X);
    solve(X);
    return 0;
}


Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
char c[101][101];
int h,w;
int main(){
	cin>>h>>w;
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			cin>>c[i][j];
	for(int i=1;i<=2*h;i++){
		for(int j=1;j<=w;j++)
			cout<<c[(i+1)/2][j];
		cout<<endl;
	}
	
		
}

Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)

base = A.max_by(&:abs)
bi = A.index(base)
query = []

if base > 0
  0.upto(N - 2) do |i|
    while A[i] > A[i + 1]
      A[i + 1] += base
      query << [bi + 1, i + 1 + 1]
    end

    if base < A[i + 1]
      base = A[i + 1]
      bi = i + 1
    end
  end
elsif base < 0
  (N - 1).downto(1) do |i|
    while A[i - 1] > A[i]
      A[i - 1] += base
      query << [bi + 1, i - 1 + 1]
    end

    if base > A[i - 1]
      base = A[i - 1]
      bi = i - 1
    end
  end
end

if query.empty?
  puts 0
else
  puts query.size
  puts query.map { |q| q.join(' ') }.join("\n")
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rall(x) x.rbegin(),x.rend()
#define mu(x) x.resize(unique(all(x))-x.begin());
#define srt(x) sort(all(x));
#define sum(x) accumulate(all(x),0ll);
#define rev(x) reverse(all(x));
#define each(x,a) for(auto& x:a)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define PER(i,a,b) for(int i=a;i>=b;i--)
#define debug(x) cerr<<#x<<" "<<x<<"\n";
#define debug_v(x) { cout<<#x<<"\n";  each(y,x) cout<<y<<" "; cout<<'\n';}
#define debug_vp(x) { cout<<#x<<"\n";  each(y,x) cout<<y.ff<<" "<<y.ss<<'\n'; cout<<'\n';}
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<bool> vb;

int main(){
	fastio;
	ll n,k;
  cin>>n>>k;
  cout<<min(n%k,k-(n%k));
	return 0;
}



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

if n < 600:
    print(8)
elif n < 800:
    print(7)
elif n < 1000:
    print(6)
elif n < 1200:
    print(5)
elif n < 1400:
    print(4)
elif n < 1600:
    print(3)
elif n < 1800:
    print(2)
elif n < 2000:
    print(1)


Measured memory_bytes: 9144
#include <bits/stdc++.h>
using namespace std;
char op[5];
int main() {
    op[0] = '+', op[1] = '-';
    char s[5];
    while (scanf("%s", s) != EOF) {
        for (int i = 0; i < 2; i++)
            for (int j = 0; j < 2; j++)
                for (int k = 0; k < 2; k++) {
                    int tmp1 = (s[0] - '0') + (op[i] == '+' ? s[1] - '0' : '0' - s[1]);
                    int tmp2 = tmp1 + (op[j] == '+' ? s[2] - '0' : '0' - s[2]);
                    if (tmp2 + (op[k] == '+' ? s[3] - '0' : '0' - s[3]) == 7)
                        return !printf("%c%c%c%c%c%c%c=7\n", s[0], op[i], s[1], op[j], s[2], op[k], s[3]);
                }
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
using ll = long long;
using namespace std;
const ll M = 1000000007;
int main(){
    int n; cin >> n;
    long long power = 1;
    long long ans;
    for(int i = 2; i <= n; i++){
        power *= i;
        power %= M;
    }
    power %= M;
    cout << power << endl;
}

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

int main()
{
	int get ;
	int hour,min,sec ;
	cin >> get ;

	sec = get%60 ;
	get -= sec ;
	min = (get%3600)/60 ;
	get -= min ;
	hour = get/3600 ;

	cout << hour << ":" << min << ":" << sec << endl ;
}

Measured memory_bytes: 1168
def main():

    from bisect import bisect_left as bl

    n = int(input())
    a = list(map(int, input().split()))
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
    g = [set() for _ in [0]*n]
    ans = [0]*n
    [g[a-1].add(b-1) for a, b in ab]
    [g[b-1].add(a-1) for a, b in ab]
    visited = [False]*n

    q = [0]
    lis = []
    while q:
        i = q.pop()
        ai = a[i]
        if not visited[i]:
            b = bl(lis, ai)
            if b == len(lis):
                visited[i] = "push"
                lis.append(ai)
            else:
                visited[i] = [b, lis[b]]
                lis[b] = ai
            ans[i] = len(lis)
        if not g[i]:
            if visited[i] == "push":
                lis.pop()
            else:
                lis[visited[i][0]] = visited[i][1]
        else:
            q.append(i)
            j = g[i].pop()
            g[j].remove(i)
            q.append(j)
    for i in ans:
        print(i)


main()

Measured memory_bytes: 132524
//Warmdust Code
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#define db double
#define ll long long
#define ft float
#define PI acos(-1)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Fro(i,a,b) for(int i=a;i>=b;i--)
#define inf 0x3f3f3f3f
#define Warmdust int main(){ TvT;
#define RETURN return 0;}
#define TvT ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
const int maxn=10005;
int n,a[25],b[25],c[25];
int sum=0;
Warmdust
	cin >> n;
	For(i,1,n) cin >> a[i];
	For(i,1,n) {
		cin >> b[i];
		sum+=b[i];
	}
 	For(i,1,n-1) cin >> c[i];
    for(int i=1;i<n;i++){
    	if(a[i]==a[i+1]-1) sum+=c[a[i]];
	}
	cout << sum << endl;
   
RETURN

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>


long long X[ 100 ][ 2 ] ,x[ 100 ] ;
long long Y[ 100 ][ 2 ] ,y[ 100 ] ;
long long Z[ 100 ][ 2 ] ,z[ 100 ] ;

int i ,j ,k ,l ;


int cmp( const void *a ,const void *b )
{
	return *( int* )a - *( int* )b ;
}

void sort( long long *a ,int size )
{
	qsort( a ,size ,sizeof( long long ) ,cmp ) ;
}

int check()
{
	if(
			X[ l ][ 0 ] > x[ i ] || X[ l ][ 1 ] < x[ i + 1 ] ||
			Y[ l ][ 0 ] > y[ j ] || Y[ l ][ 1 ] < y[ j + 1 ] ||
			Z[ l ][ 0 ] > z[ k ] || Z[ l ][ 1 ] < z[ k + 1 ]
	)
	{
		return 1 ;
	}

	return 0 ;
}

int main( void )
{
	int N ,K ;
	scanf( "%d %d" ,&N ,&K ) ;

	N *= 2 ;

	--K ;

	int n = N - 1 ;

	for( i = 0 ; i < N ; ++i )
	{
		scanf( "%lld %lld %lld" ,x + i ,y + i ,z + i ) ;

		X[ i / 2 ][ i % 2 ] = x[ i ] ;
		Y[ i / 2 ][ i % 2 ] = y[ i ] ;
		Z[ i / 2 ][ i % 2 ] = z[ i ] ;
	}

	sort( x ,N ) ;
	sort( y ,N ) ;
	sort( z ,N ) ;

	long long ans = 0 ;
	for( i = 0 ; i < n ; ++i )
	{
		for( j = 0 ; j < n ; ++j )
		{
			for( k = 0 ; k < n ; ++k )
			{
				int cnt = 0 ;

				for( l = 0 ; l < N ; ++l )
				{
					if( check() == 0 )
					{
						++cnt ;
					}
				}

				if( cnt > K )
				{
					ans += ( x[ i + 1 ] - x[ i ] ) * ( y[ j + 1 ] - y[ j ] ) * ( z[ k + 1 ] - z[ k ] ) ;
				}
			}
		}
	}


	printf( "%lld\n" ,ans ) ;

	return 0 ;
}

Measured memory_bytes: 1768
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
const int N=200005,INF=0X3F3F3F3F;
int n,P,a[N],b[N],ans=INF;
bool chk(int mid){
	rep(i,1,n)b[i]=a[i]-(i>=n-mid+1)*P;
	inplace_merge(b+1,b+n-mid+1,b+1+n);
	int mx=0;
	rep(i,1,(n+1)/2){
		if(b[i]+b[n+1-i]<0)return 0;
		mx=max(mx,b[i]+b[n+1-i]);
	}
	/*printf("%d:",mid);
	rep(i,1,n)printf("%d ",b[i]);
	puts("");*/
	ans=min(ans,mx);
	return 1;
}
int main(){
	scanf("%d%d",&n,&P);
	n*=2;
	rep(i,1,n)scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	int l=0,r=n;
	while(l<=r){
		int mid=(l+r)>>1;
		if(chk(mid))l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 5796
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <stack>

using namespace std;

int main() {

  string c;
  stack<int> st;  
  int a,b;

  while(cin >> c){
    if(c=="+"||c=="-"||c=="*"){
      a = st.top();
      st.pop();
      b = st.top();
      st.pop();
      if(c=="+") st.push(a+b);
      if(c=="-") st.push(b-a);
      if(c=="*") st.push(a*b);
    }
    else st.push(atoi(c.c_str()));
  }
  cout << st.top() << endl;
  
}

Measured memory_bytes: 1200
n=int(input())
arr=list(map(int,input().split()))
arr2=[0]*n
for i in range(0,2*n,2):
  arr2[i//2]=arr[i%n]
ans=[0]*n
s=sum(arr)//2
cum=[0]*n
start=sum(arr2[:n//2])
cum[0]=start
l=n//2
for i in range(n):
  start=start+arr2[(i+l)%n]-arr2[i]
  cum[(i+1)%n]=start
for i in range(n):
  ans[(n-1+i*2)%n]=(s-cum[i])*2
print(*ans)


Measured memory_bytes: 18680
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int x = scn.nextInt();
        int n = scn.nextInt();
        String[] p = new String[n];
        for(int i=0;i<n;i++){
            p[i]=scn.next();
        }
        for(int j=0;j<=51;j++){
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        }
        scn.close();

    }

}

Measured memory_bytes: 27176
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    vi a(4);
    string s;
    cin >> s;
    rep(i, 4) a[i] = s[i] -'0';
    rep(bit, 1<<3) {
        int sum = a[0];
        rep(i, 3) {
            if (bit>>i&1) {
                sum += a[i+1];
            } else {
                sum -= a[i+1];
            }
        }
        if (sum == 7) {
            cout << a[0];
            rep(i, 3) {
                if (bit>>i&1) cout << "+";
                else cout << "-";
                cout << a[i+1];
            }
            cout << "=7" << endl;
            return 0;
        }
        
    }
}

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

def attack(N, times=-1):
    times += 1
    if N // 2 == 0:
        return times
    else:
        enemie = N // 2
        return attack(enemie, times)

ans = 0
for i in range(attack(enemie)+1):
    ans += 2**i

print(ans)

Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <assert.h>
#include <utility>
#include <tuple>
using namespace std;

using int64 = long long;
using int128 = __int128;

#define repeat(i, n) for (auto i = decltype(n)(); (i) < (n); (i)++)

template<typename T>
vector<T> MakeVector(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto MakeVector(size_t a,Ts... ts){
  return vector<decltype(MakeVector<T>(ts...))>(a,MakeVector<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
FillVector(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
FillVector(T &t,const V &v){
  for(auto &e:t) FillVector(e,v);
}

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

  int N;
  cin >> N;

  vector<int> T(N);
  repeat (i, N) {
    cin >> T[i];
  }

  int M;
  cin >> M;

  int tsum = accumulate(T.begin(), T.end(), 0);

  repeat (i, M) {
    int P, X;
    cin >> P >> X;
    P--;
    cout << tsum - T[P] + X << endl;
  }

  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
char a ; cin >> a;
if (
a == 'A' or
a == 'B' or
a == 'C' or
a == 'D' or
a == 'E' or
a == 'F' or
a == 'G' or
a == 'H' or
a == 'I' or
a == 'J' or
a == 'K' or
a == 'L' or
a == 'M' or
a == 'N' or
a == 'O' or
a == 'P' or
a == 'Q' or
a == 'R' or
a == 'S' or
a == 'T' or
a == 'U' or
a == 'V' or
a == 'W' or
a == 'X' or
a == 'Y' or
a == 'Z'     
)
{
    cout << "A" << endl;
}
else
{
    cout << "a" << endl;
}
    
}

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

using namespace std;

#define X first
#define Y second
#define ll long long
#define inf (ll)1e18
#define all(x) x.begin(), x.end()

const int MX = 200020;
const int N = 1000060;
const int mood = ((int)1e9 + 7);

int bst[MX];
bool in[MX];
vector<pair<int, int>> g[MX];

void dfs(int x, int cost){
	for(auto y : g[x]){
		if(bst[y.X] == -1){
			bst[y.X] = cost + y.Y;
			dfs(y.X, cost + y.Y);
		}
		else if(bst[y.X] != cost + y.Y)
		{
			cout << "No" << endl;
			exit(0);
		}		
	}
}

void remove(int x){

	for(auto y : g[x]){
		if(bst[y.X] != -1){
			bst[y.X] = -1;
			remove(y.X);
		}
	}
}

int main(){
/*
    Hossam ^_^
     ___     ___
    (^_^)   (^_^)
   /( | )\ /( | )\
     | |     | |
*/
    cin.tie(0);
    cin.sync_with_stdio(0);

    #ifdef Cyborg101
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int n, m;
    cin >> n >> m;

    if(m == 0){
    	cout << "Yes" << endl;
    	return 0;
    }

   	while(m--){
   		int a, b, d;
   		cin >> a >> b >> d;
   		--a, --b;
   		g[a].push_back({b, d});
   		in[b] = true;
   	}

   	memset(bst, 0xff, sizeof bst);
   	bool found = false;
   	for(int i = 0; i < n; ++i){
   		if((int)g[i].size() && !in[i]){
   			dfs(i, 0);
   			found = true;
   			remove(i);
   		}
   	}

   	if(found)
   		cout << "Yes" << endl;
   	else
   		cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 200005;
int a[maxn];
int find(int x)
{
    if (a[x] == x)
        return x;
    else
        return a[x] = find(a[x]);
}
int main()
{
    int n, m, aa, bb;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        a[i] = i;
    for (int i = 1; i <= m; i++)
    {
        cin >> aa >> bb;
        a[find(aa)] = find(a[bb]);
    }
    int ans = 0;
    map<int, int> ma;
    for (int i = 1; i <= n; i++)
    {
        ma[find(a[i])]++;
    }
    for (auto i : ma)
    {
        ans = max(ans, i.second);
    }
    cout << ans << endl;

    return 0;
}

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

void f(int index, string a, vector<string> &t) {
    if (index == 9) {
        t.push_back(a);
        return;
    }
    
    if (a.at(index) == 'A') {
        string s1 = a, s2 = a;
        s1.at(index) = '0';
        f(index + 1, s1, t);
        f(index + 1, s2, t);
    }
    else f(index + 1, a, t);
}

int main() {
    string s;
    cin >> s;
    vector<string> t;
    
    f(0, "AKIHABARA", t);
    for (int i = 0; i < 16; i++) {
        for (int j = 0; j < (int)t.at(i).size(); j++) if (t.at(i).at(j) == '0') t.at(i).erase(t.at(i).begin() + j);
    }
    
    for (int i = 0; i < (int)t.size(); i++) {
        if (s == t.at(i)) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
const int N=205;

int32_t main(){
    IOS;
    int gcd[N][N];
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            gcd[i][j]=__gcd(i,j);
        }
    }
    int k;
    cin>>k;
    int ans=0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                ans+=gcd[gcd[i][j]][l];
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3972
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <cstdlib>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int main(){
  int N,A[50];
  PA MAX,MIN;
  MAX.first=-INF;
  MIN.first=INF;
  cin>>N;
  FOR(i,0,N){
    cin>>A[i];
    if(MAX.first<A[i]){
      MAX.first=A[i];
      MAX.second=i;
    }
    if(MIN.first>A[i]){
      MIN.first=A[i];
      MIN.second=i;
    }
  }
  if(abs(MAX.first)>=abs(MIN.first)){
    cout<<2*N-1<<endl;
    FOR(i,0,N){
      cout<<MAX.second+1<<" "<<i+1<<endl;
    }
    FOR(i,0,N-1){
      cout<<i+1<<" "<<i+2<<endl;
    }
  }else{
    cout<<2*N-1<<endl;
    FOR(i,0,N){
      cout<<MIN.second+1<<" "<<i+1<<endl;
    }
    for(int i=N-2;i>=0;i--){
      cout<<i+2<<" "<<i+1<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,d;
	char r[1001],t[1001];
	char n[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	char c[27]="DEFGHIJKLMNOPQRSTUVWXYZABC";
	for(a=0;a<=1000;a++){
		scanf("%c",&r[a]);
		for(b=0;b<27;b++){
			if(r[a]==c[b]){
				t[a]=n[b];
				break;
			}
		}
		if(r[a]==10){
			break;
		}
	}
	for(b=0;b<a;b++)
	printf("%c",t[b]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 2584