akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

template<typename T>
struct SegmentTree {
private:
  ll n;                       //最下段のサイズ
  T e;                        //単位元
  vector<T> node;             //セグメント木を表現する配列
  typedef function<T(T,T)> Func;
  Func f;         //区間クエリで使う処理

public:
  SegmentTree(vector<T> v, Func f_input, T e_input) {
    f = f_input;
    e = e_input;
    ll sz = SZ(v);
    n = 1; while(n < sz) n *= 2;
    node.resize(2*n-1, e);
    REP(i,sz) node[i+n-1] = v[i];
    IREP(i,n-1) node[i] = f(node[2*i+1], node[2*i+2]);
  }

  // x番目(0-indexed)の要素にvalを加算する
  void update(ll x, T val) {
    x += (n - 1);
    node[x] += val;
    while(x > 0) {
      x = (x - 1) / 2;
      node[x] = f(node[2*x+1], node[2*x+2]);
    }
  }

  // [a, b) に対する区間クエリに答える
  // k := 自分がいるノードのインデックス
  // [l, r) : ノードkの対象区間
  T query(ll a, ll b, ll k=0, ll l=0, ll r=-1) {
    if(r < 0) r = n;
    if(r <= a || b <= l) return e;
    if(a <= l && r <= b) return node[k];
    T vl = query(a, b, 2*k+1, l, (l+r)/2);
    T vr = query(a, b, 2*k+2, (l+r)/2, r);
    return f(vl, vr);
  }

  // 添字でアクセス
  T operator[](ll i) {
      return node[i + n - 1];
  }
};

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

int main(){
  ll N; cin >> N;
  vector<ll> a(N);
  REP(i,N) cin >> a[i];
  SegmentTree<ll> st(a, [](ll s, ll t){return gcd(s,t);},0);
  ll ans = 0;
  REP(i,N){
    ll left = st.query(0,i);
    ll right = st.query(i+1,N);
    ans = max(ans, gcd(left,right));
  }
  cout << ans << endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a[14];

int main() {
    ll n;
    string str = "abcdefghijklmnopqrstuvwxyz";
    a[1] = 26;
    for (int i = 2; i <= 13; ++i) a[i] = a[i - 1] * 26;
    cin >> n;
    --n;
    vector <int> v;
    int i = 1;
    while (n - a[i] >= 0) {
        n -= a[i];
        ++i;
    }
    //cout << n << endl;
    for (int j = i; j >= 1; --j) {
        cout << str[n / (ll)pow(26, j - 1)];
        //cout << " " << n / (ll)pow(26, j - 1) << " ";
        n -= n / (ll)pow(26, j - 1) * (ll)pow(26, j - 1);
    }
    return 0;
}

Measured memory_bytes: 4048
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,x,m = readInts()
an = x
ans = an
moddict = {an:1}
for i in range(2,n+1):
  an = pow(an,2,m)
  if an in moddict:
    break
  else:
    moddict[an]=i
  ans += an
#print(ans)
if an in moddict:
  rep = (n-len(moddict))//(len(moddict)-moddict[an]+1)
  rem = (n-len(moddict))%(len(moddict)-moddict[an]+1)
  #print(rep,rem)
  rep_sum = 0
  boo = 0
  for key in moddict:
    if boo or key==an:
      boo = 1
      rep_sum+=key

  ans += rep_sum*rep
  for i in range(rem):
    ans+=an
    an=pow(an,2,m)


print(ans)

Measured memory_bytes: 15748
%:pragma GCC optimize("Ofast")
  %:pragma GCC optimize("inline")
#include<bits/stdc++.h>
#define int long long
#define rint register int
  using namespace std;
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar();bool f = 0;
  for (; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if (f) x = -x;
}
const int N = 1e5 + 233;
int n, a[N], b[N];
int x[N], x_cnt = 0;

namespace bit {
  int tr[N];
  inline void replace(void) {
    memset(tr, 0, sizeof (int) * (x_cnt + 2));
  }
  inline void add(int x, int v) {
    for (; x <= x_cnt; x += x & -x) tr[x] += v;
  }
  inline int query(int x) {
    int ans = 0;
    for (; x >= 1; x -= x & -x) ans += tr[x];
    return ans;
  }
}

inline bool check(int mid) {
  for (rint i = 1; i <= n; i ++) {
    int f = 0;
    if (b[i] < mid) f = 1;
    a[i] = a[i - 1] + f;
  }     
  for (int i = 0; i <= n; i ++)
    a[i] = a[i] * 2 - i, x[++ x_cnt] = a[i];
  sort(x + 1, x + x_cnt + 1);
  x_cnt = unique(x + 1, x + x_cnt + 1) - x - 1;
  for (int i = 0; i <= n; i ++)
    a[i] = lower_bound(x + 1, x + x_cnt + 1, a[i]) - x;
  // for (int i = 1; i <= n; i ++)
  //   cout << a[i] << " "; puts("");
  rint ans = 0;
  for (rint i = 0; i <= n; i ++) {
    ans += bit::query(a[i] - 1);
    bit::add(a[i], 1);
  }
  rint tmp = (n * (n + 1) / 2) / 2;
  // cout << ans << "\n";
  bit::replace(); x_cnt = 0;
  return ans <= tmp;
}

main(void) {
  read(n);
  for (rint i = 1; i <= n; i ++)
    read(b[i]);
  rint l = 1, r = 1e9;
  while (l < r) {
    rint mid = l + (r - l + 1) / 2;
    if (check(mid)) l = mid;
    else r = mid - 1;
  }
  cout << l << "\n";
}


Measured memory_bytes: 3328
#include <iostream>

#include <string>


using namespace std;



int main(){
    int n;
    cin>>n;
    string taro_hand;
    string hanako_hand;
    int taro_point=0;
    int hanako_point=0;
    
    while(n){
        cin>>taro_hand>>hanako_hand;
        bool jud=false;
        for(int i=0;(i!=taro_hand.size())||(i!=hanako_hand.size());++i){
            if(taro_hand[i]>hanako_hand[i]){
                taro_point+=3;
                jud=true;
                break;
            }else if(taro_hand[i]<hanako_hand[i]){
                hanako_point+=3;
                jud=true;
                break;
            }
        }
        if(!jud){
            taro_point+=1;
            hanako_point+=1;
        }
        --n;
        
    }
    
    cout<<taro_point<<" "<<hanako_point<<endl;
    
    
    
}


Measured memory_bytes: 3104
def main():
    H, W = list(map(int, input().split()))

    if H == 1 or W == 1:
        print(1)
        return

    if H % 2 == 0:
        print(H // 2 * W)
        return

    if W % 2 == 0:
        print(W // 2 * H)
        return

    odd = W // 2 + 1
    even = W // 2

    ans = odd * (H // 2 + 1) + even * (H // 2)
    print(ans)

main()

Measured memory_bytes: 2940
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
ans = 0

0.upto(a) do |ai|
	0.upto(b) do |bi|
		0.upto(c) do |ci|
			ans += 1 if (ai * 500)+(bi * 100)+(ci * 50) == x
		end
	end
end 

puts ans

Measured memory_bytes: 14304
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 1e6 + 5, mod = (int) 0;
int cnt[N][2], q[N], mark[N], h, t;
vector<int> adj[N];
int main() {
	int n, m;
	cin >> n >> m;
	string s;
	cin >> s;
	for (int j = 0; j < m; ++j) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	for (int v = 0; v < n; ++v)
		for (int u : adj[v])
			cnt[v][s[u] - 'A']++;
	for (int v = 0; v < n; ++v)
		if (!cnt[v][0] || !cnt[v][1])
			mark[v] = 1, q[t++] = v;
	while (h != t) {
		int v = q[h++];
		for (int u : adj[v]) {
			cnt[u][s[v] - 'A']--;
			if (!mark[u] && cnt[u][s[v] - 'A'] == 0)
				mark[u] = 1, q[t++] = u;
		}
	}
	for (int v = 0; v < n; ++v)
		if (!mark[v]) {
			cout << "Yes\n";
			return 0;
		}
	cout << "No\n";
}



















Measured memory_bytes: 34436
N, M = map(int, input().split())
A = list(map(int, input().split()))

from fractions import gcd
from functools import reduce
import math

def mod(a):
  result = 0
  while a % 2 == 0:
    a //= 2
    result += 1
  return result

def lcm(x, y):
  return (x * y) // gcd(x, y)

A = list(map(lambda x: x // 2, A))

t = mod(A[0])

for i in range(N):
  if mod(A[i]) == t:
    A[i] >>= t
  else:
    print(0)
    exit()

M >>= t
M //= reduce(lcm, A)
print(math.ceil(M/2))

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

int main() {
  string S;
  bool flag=false;
  int a, b;
  cin >> S;

  for(int i=0; i<S.size(); i++){
    if(S.at(i) == 'A' && flag==false){
      a=i;
      flag=true;
    }
    if(S.at(i) == 'Z')
      b=i;
  }
  
  cout << b - a + 1 << endl;
  
  return 0;
}

Measured memory_bytes: 640
N, M, P = map(int, input().split())
Edges = []
pos = [[] for _ in range(N)]
neg = [[] for _ in range(N)]
for _ in range(M):
    a, b, c = map(int, input().split())
    Edges.append((a-1, b-1, P-c))
    pos[a-1].append(b-1)
    neg[b-1].append(a-1)

from collections import deque

def dfs(s, lis):
    checked = [0]*N
    stack = deque([(s, 0)])
    while stack:
        v, c = stack.pop()
        if checked[v]!=0:
            continue
        checked[v] = 1
        for i in lis[v]:
            if checked[i]==0:
                stack.append((i, c+1))
    return checked

posc = dfs(0, pos)
negc = dfs(N-1, neg)
used = [0]*N
for i, (p, n) in enumerate(zip(posc, negc)):
    if p and n:
        used[i] = 1

def BellmanFord(s):
    inf = 10**18
    dist=[inf for i in range(N)]
    dist[s]=0
    for i in range(N):
        for edge in Edges:
            if used[edge[0]]==0 or used[edge[1]]==0:
                continue
            if edge[0] != inf and dist[edge[1]] > dist[edge[0]] + edge[2]:
                dist[edge[1]] = dist[edge[0]] + edge[2]
                if i>=N-1:
                    return []
    return dist

d = BellmanFord(0)
if len(d)==0:
    print(-1)
else:
    print(max(0, -d[-1]))

Measured memory_bytes: 52076
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int N, M, X, Y;
    vector<int> x(100, -101), y(100, 101);
    cin >> N >> M >> X >> Y;
    for (int i = 0; i < N; i++) {
        cin >> x[i];
    }
    for (int i = 0; i < M; i++) {
        cin >> y[i];
    }

    int xm = *max_element(x.begin(), x.end());
    int ym = *min_element(y.begin(), y.end());
    if(xm < X) {
        xm = X;
    }
    if(ym > Y) {
        ym = Y;
    }

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

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

using ll = long long;
using p = pair<ll, ll>;

constexpr ll MAX_N = 1e5;

ll N;
ll A[MAX_N + 2];

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

    cin >> N;
    A[0] = A[N + 1] = 0;
    for (ll i = 1; i <= N; i++) {
        cin >> A[i];
    }

    vector<ll> ldp(N + 1, 0), rdp(N + 1, 0);
    for (ll i = 0; i < N; i++) {
        ldp[i + 1] = ldp[i] + abs(A[i + 1] - A[i]);
        //cout << ldp[i + 1] << " ";
    }
    //cout << endl;

    for (ll i = N; i > 0; i--) {
        rdp[i - 1] = rdp[i] + abs(A[i] - A[i + 1]);
    }
    /*
    for (ll i = 0; i < N; i++) {
        cout << rdp[i] << " ";
    }
    cout << endl;
    */

    for (ll k = 1; k <= N; k++) {
        //cout << ldp[k - 1] << " + " << rdp[k] << " = ";
        cout << ldp[k - 1] + rdp[k] + abs(A[k - 1] - A[k + 1]) << endl;
    }

    return 0;
}



Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    long long int sum=0, len;
    len = s.size();
    for(long long int i=0; i<len; i++)
    {
        sum = sum + (s[i] - '0');
    }
    if(sum%9 == 0)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
    
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vi a(n), b(n), c(n);
	REP(i, n) {
		cin >> a[i];
		a[i] *= -1;
	}
	REP(i, n)cin >> b[i];
	REP(i, n)cin >> c[i];
	sort(ALL(a));
	sort(ALL(c));
	ll ans = 0;
	REP(i, n) {
		ll x = upper_bound(ALL(a), -b[i]) - a.begin(),
			y = upper_bound(ALL(c), b[i]) - c.begin();
		ans += (n - x)*(n - y);
	}
	cout << ans << endl;
}


Measured memory_bytes: 1408
import java.util.*;;

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

        int H = sc.nextInt();
        int W = sc.nextInt();
        String[] s = new String[H];

        for(int i=0; i<H; i++){
            s[i] = sc.next();
        }

        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                int[] a = new int[4];
                a[0] = i + 1;
                a[1] = i - 1;
                a[2] = j + 1;
                a[3] = j - 1; 
                if(s[i].charAt(j)=='#'){
                    for(int k=0; k<4; k++){
                        if(k==0 || k==1){
                            if(a[k]>=0 && a[k]<H){
                                if(s[a[k]].charAt(j)=='#'){
                                    break;
                                }
                            }
                        }
                        else{
                            if(a[k]>=0 && a[k]<W){
                                if(s[i].charAt(a[k])=='#'){
                                    break;
                                }
                            }
                        }
                        if(k==3){
                            System.out.println("No");
                            return;
                        }
                    }
                }
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    vector<int> menu(5);
	vector<int> mod(5);
	for(int i=0; i<5; i++){
        cin >> menu[i];
		int rest = menu[i] % 10;
		mod.push_back(10 - (rest==0?10:rest));
	}

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

	int menuOder = accumulate(menu.begin(), menu.end(), 0);
	int rest = accumulate(mod.begin(), mod.end()-1, 0);
	cout << menuOder + rest << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z main.cpp
//.\a.exe

int main(void){ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////////////////
int n;
cin >> n;
ll L[n];
L[1] = 1;
L[0] = 2;

if(n==1){
	cout << 1 << endl;
	return 0;
}
for(int i=2;i<n+1;i++){
	L[i] = L[i-1] + L[i-2];
	if(i==n){
		cout << L[i] << endl;
	}
}



////////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#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 mn = a[0], mx = a[0];
	for(int i = 1; i < n; i++){
		if(mn > a[i])
			mn = a[i];
		if(mx < a[i])
			mx = a[i];
	}
	
	cout<< mx - mn <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	string x;
	cin >> x;
	
	int n = (int)x.size();
	int ans = n;
	int s = 0, t = 0;
	bool sflag = false, tflag = false;
	
	for(int i = 0; i < n; ++i) {
		if( x[i] == 'S' ) {
			if( tflag ) {
				ans -= 2 * min(s, t);
				s = max(0, s - min(s, t)), t = 0;
				tflag = false;
			}
			
			s++;
			sflag = true;
			
		} else if( x[i] == 'T' && sflag && s > t ) {
			t++;
			tflag = true;
		}
	}
	
	if( sflag && tflag ) {
		while( s != 0 && t != 0 ) {
			ans -= 2 * min(s, t);
			s = max(0, s - min(s, t)); t = max(0, t - min(s, t));
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    print(max(0,c-a+b));
    return 0;
}

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

int main(){
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    
    if(abs(a-b)>pow(10,18))cout << "Unfair" << endl;
    else if(k%2 == 0)cout << a-b << endl;
    else cout << b-a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m=numeric_limits<T>::max()){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


int main() {
  int N,K; cin >>N >>K;
  vector<int> a(N); rep(i, N) cin >>a[i];
  sort(all(a));
  int res = 0;
  rep(i, K) res += a[i];
  cout <<res <<endl;
}

Measured memory_bytes: 3632
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
A = get_int
B = get_int
C = get_int
D = get_int
E = get_int

min = [A, B, C, D, E].min

puts (N / min) + (N % min > 0 ? 1 : 0) + 4



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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k,a,b;
  cin>>k;
  cin>>a>>b;
  int cur=a;
  bool bener=false;
  while(cur<=b){
    if(cur%k==0){
      bener=true;
      break;
    }
    cur++;
  }
  if(bener){
    cout<<"OK"<<endl;
  }else{
    cout<<"NG"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>
int main()
{
	int D;
	scanf("%d",&D);
	if(22<=D&&D<=25)
	{if(D==25)printf("Christmas");
	else if(D==24)printf("Christmas Eve");
	else if(D==23)printf("Christmas Eve Eve");
		else printf("Christmas Eve Eve Eve");}
	else
		printf("请重新输入数字");
}


Measured memory_bytes: 128
h1, h2 = map(int, input().split())
k1, k2 = map(int, input().split())
a, b, c, d = map(int, input().split())
hiroshi = h1*a + h2*b + (h1//10)*c + (h2//20)*d;
kenjiro = k1*a + k2*b + (k1//10)*c + (k2//20)*d;

if hiroshi > kenjiro: print("hiroshi")
elif hiroshi < kenjiro: print("kenjiro")
else: print("even")




Measured memory_bytes: 5596
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int num_cnt = 0;
    int num_tmp = 0;
    int max_val = -2000000000;
    int min_val = 0;
    vector<int> store_num;
    
    cin >> num_cnt;
    for (int i = 0; i < num_cnt; i++)
    {
        cin >> num_tmp;
        store_num.push_back(num_tmp);
    }
    
    min_val = store_num[0];
    for (int i = 1; i < num_cnt; i++)
    {
        max_val = max(max_val, store_num[i] - min_val);
        min_val = min(min_val, store_num[i]);
    }
    
    cout << max_val << endl;
    
    return 0;
}



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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll W[100005];

int main()
{
    ll N;
    cin >> N;
    ll S = 0;
    REP(i, N)
    {
        cin >> W[i];
        S += W[i];
    }

    ll min = INF;
    REP(i, N + 1)
    {
        ll s = 0;
        REP(j, i)
        {
            s += W[j];
        }
        min = std::min(min, abs(S - s - (s)));
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <cstring>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int maxn = 100005;

int n,m,ti[maxn],mask[maxn],rti[maxn],cti[maxn];
vector<int>e[maxn];
int ct=0;

void dfs(int x, int c) {
  ti[x]=ct;
  if(!mask[x])cti[ct]++;
  mask[x]|=(1<<c);
  for(int i=0; i<e[x].size(); i++) {
    int v=e[x][i];
    if(mask[v]&(1<<(1-c)))continue;
    dfs(v,1-c);
  }
}

int main() {
  //freopen("in.cpp","r",stdin);
  cin>>n>>m;
  for(int i=0; i<m; i++) {
    int x,y;
    cin>>x>>y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  for(int i=1; i<=n; i++) {
    if(mask[i])continue;
    ti[i]=++ct;
    rti[ct]=i;
    dfs(i,0);
  }
  int cnt0=0,cnt1=0,cnt2=0;
  for(int i=1; i<=ct; i++) {
    if(cti[i]==1)cnt0++;
    else {
      if(mask[rti[i]]==3)cnt2++;
      else cnt1++;
    }
  }
  //cout<<cnt0<<" "<<cnt1<<" "<<cnt2<<endl;
  ll ret=cnt0*(ll)n*2 - cnt0;
  if(cnt0)ret-=cnt0*ll(cnt0 - 1);
  ret+=cnt1*(ll)cnt1*2+cnt2*(ll)cnt2+cnt1*(ll)cnt2*2;
  cout<<ret<<endl;
  return 0;
}


Measured memory_bytes: 13184
#include <stdio.h>
#include <math.h>
int main()
{
	int a,b,i;
long int h;
	scanf("%ld",&h);
	int rt=(int)sqrt(h);
	for(i=rt;;--i)if(h%i==0)break;
	printf("%d\n",(int)log10(h/i)+1);
    return 0;
}

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

int main(int argc, const char * argv[]) {
    int A, B;
    cin >> A >> B;
    
    if(A >= 13) cout << B;
    else if(6 <= A && A <= 12) cout << B/2;
    else cout << 0;
    
    return 0;
}


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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b)
{
	return b ? gcd(b, a % b) : a;
}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

void printVec(vector<int> &vec)
{
	for (auto &e : vec)
	{
		cout << e << " ";
	}
	cout << endl;
}

int main()
{
	int h,a;
	cin>>h>>a;
	int ans=0;
	rep(i,100000){
		if(h<=0){
			ans=i;
			break;
		}
		h=h-a;
	}
	cout << ans	 << endl;


	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100
  

int main()
{
  int i,j,key,n,flag=1,count=0;
  int A[N];
  scanf("%d",&n);
  if(n>=1&&n<=100){
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  }
 
  while(flag){
    flag=0;
  for(j=n-1;j>=1;j--){
    key=A[j];
    if(A[j]<A[j-1]){
     
    A[j]=A[j-1];
    A[j-1]=key;
    flag=1;
    count++;
    }
  }
  }
  for ( i = 0; i < n-1; i++ ){
  
  printf("%d ", A[i]);
  }
  printf("%d\n", A[n-1]);
  
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};

int main() {
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  if (H>1&&W>1) {
    for (int i=0; i<H; i++) {
      for (int j=0; j<W; j++) {
        if (i<B) {
          if (j<A) cout << 0;
          else if (j!=W-1) cout << 1;
          else cout << 1 << endl;
        }
        else {
          if (j<A) cout << 1;
          else if (j!=W-1) cout << 0;
          else cout << 0 << endl;
        }
      }
    }
  }
  else if (H==1&&W==1) cout << 0 << endl;
  else if (H==1) {
    for (int j=0; j<W; j++) {
      if (j<A) cout << 0;
      else if (j!=W-1) cout << 1;
      else cout << 1 << endl;
    }
  }
  else if (W==1) {
    for (int i=0; i<H; i++) {
      if (i<B) cout << 0 << endl;
      else cout << 1 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3612
import collections


N=int(input())
vote_list= [input() for i in range(N)]

count = collections.Counter(vote_list).most_common()


mode = count[0]
mode = int(mode[1])
count= sorted(count)

for i in range(len(count)):
    temp = count[i]
    if(temp[1] == mode):
        print(temp[0])
    else:
        pass

Measured memory_bytes: 45040
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<ll, ll>
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define vvi vector<vector<int> >
#define vvl vector<vector<long long> >
ll mod = 1e9 + 7;
const double pi = acos(-1.0);

struct node{
ll x, y;
};

bool cmp1(node a, node b){
    ll p = a.x + a.y;
    ll q = b.x + b.y;
    return p<q;
}
bool cmp2(node a, node b){
    ll p = a.x - a.y;
    ll q = b.x - b.y;
    return p<q;
}
bool cmp3(node a, node b){
    ll p = a.y - a.x;
    ll q = b.y - b.x;
    return p<q;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout<<fixed;
    cout.precision(12);
    ll n;
    cin>>n;
    vector<node> po(n);
    ll ma = 0;
    for(ll i=0;i<n;i++){
        ll x, y;
        cin>>x>>y;
        po[i] = {x, y};
    }
    sort(po.begin(), po.end(), cmp1);
    ma = max(ma, po[n-1].x + po[n-1].y - po[0].x - po[0].y);
    sort(po.begin(), po.end(), cmp2);
    ma = max(ma, po[n-1].x - po[n-1].y - (po[0].x - po[0].y));
    sort(po.begin(), po.end(), cmp3);
    ma = max(ma, po[n-1].y - po[n-1].x - (po[0].y - po[0].x));
    cout<<ma<<endl;
    return 0;
}


Measured memory_bytes: 6360
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read(){
	int res=0,sign=1;char ch;
	while((ch=getchar())<'0'||ch>'9')if(ch=='-')sign=-1;res=res*10+ch-48;
	while((ch=getchar())>='0'&&ch<='9')res=res*10+ch-48;
	return res*sign;
}
const int maxn=101;
char ch[maxn];
int main(){
    cin>>ch;
    int len=strlen(ch);
    cout<<ch[0]<<len-2<<ch[len-1]<<endl;
	return 0;
}


Measured memory_bytes: 256
n, a = input(), map(int, raw_input().split())

s = 1
ans = [0] * n
for x in a[-1::-1]:
    ans[0] += x * s
    s = -s

ans[0] >>= 1
for i in xrange(1, n):
    ans[i] = a[i - 1] - ans[i - 1]

for i in xrange(n):
    ans[i] <<= 1
print (' '.join(map(str, ans)))



Measured memory_bytes: 46376
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
const int mod=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<int>A(N+1);
  for(int i=1;i<=N;i++){
    cin>>A[i];
  }
  map<int,int>k;
  int64_t  cnt=0;
  for(int j=1;j<=N;j++){
    cnt+=k[j-A[j]];
    k[j+A[j]]++;
  }
  cout<<cnt<<endl;
  return 0;                       
}

Measured memory_bytes: 21112
#include<iostream>
#include<cmath>
#include<cassert>
#include<algorithm>
#include<string>
using namespace std;
const int N=4,N2=16,LIMIT=100;
static const int dx[4]={0,-1,0,1};
static const int dy[4]={1,0,-1,0};
static const char dir[4]={'r','u','l','d'};
int MDT[N2][N2];
int limit;
int path[LIMIT];

struct Puzzle{int f[N2], space, MD;};

Puzzle state;

int getAllMD(Puzzle pz){
    int sum=0;
    for(int i=0;i<N2;++i){
        if(pz.f[i]==N2) continue;
        sum+=MDT[i][pz.f[i]-1];
    }
    return sum;
}

bool isSolved(){
    for(int i=0;i<N2;++i) if(state.f[i]!=i+1) return false;
}

bool dfs(int depth,int prev){
    if(state.MD==0) return true;
    if(depth+state.MD>limit) return false;

    int sx=state.space/N;
    int sy=state.space%N;
    Puzzle tmp;

    for(int r=0;r<4;++r){
        int tx=sx+dx[r];
        int ty=sy+dy[r];
        if(tx<0 || ty<0 || tx>=N || ty>=N) continue;
        if(max(prev,r)-min(prev,r)==2) continue;
        tmp=state;

        state.MD-=MDT[tx*N+ty][state.f[tx*N+ty]-1];
        state.MD+=MDT[sx*N+sy][state.f[tx*N+ty]-1];
        swap(state.f[tx*N+ty],state.f[sx*N+sy]);
        state.space=tx*N+ty;
        if(dfs(depth+1,r)){
            path[depth]=r;
            return true;
        }
        state=tmp;
    }
    return false;
}

string iterative_deepening(Puzzle in){
    in.MD=getAllMD(in);

    for(limit=in.MD;limit<=LIMIT;++limit){
        state=in;
        if(dfs(0,-100)){
            string ans="";
            for(int i=0;i<limit;++i){
                ans+=dir[path[i]];
            }
            return ans;
        }
    }
    return "unsolvable";
}

int main(){
    for(int i=0;i<N2;++i){
        for(int j=0;j<N2;++j){
            MDT[i][j]=abs(i/N-j/N)+abs(i%N-j%N);
        }
    }
    Puzzle in;
    for(int i=0;i<N2;++i){
        cin>>in.f[i];
        if(in.f[i]==0){
            in.f[i]=N2;
            in.space=i;
        }
    }

    string ans=iterative_deepening(in);
    cout<<ans.size()<<endl;
}


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

#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair

#define forn(i,s,n) for(i=s;i<n;i++)
#define all(c)  c.begin(),c.end()
#define boost ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(0);srand(time(NULL));
#define tc(t) ll t;cin >> t; while(t--)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>



#define pii pair<long long,long long>
#define vii vector<pii>
#define vvi vector<vector <long long> >

#define ff first
#define ss second

#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vector<int> , greater<int> >

#define deb1(x) cout<<#x<<" : "<<x<<endl;
#define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
#define deba(a,n) for(ll i=0;i<n;++i) {  cout<<a[i]<<" "; };cout<<"\n"

#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN




int main()
{
 boost;
 int n,d;
 cin >> n >> d;
 vector<vector<int> > p;
  for(int i=0;i<n;i++)
  {   vector<int> nn;
  	for(int j=0;j<d;j++)
  	{  int e;
  	 cin >> e;
	  nn.push_back(e);
	  }
	  p.push_back(nn);
  }
  
  
  
  int c=0;
   for(int i=0;i<n-1;i++)
  {
  	for(int j=i+1;j<n;j++)
  	{  
  	  float sum=0;
  	   for(int k=0;k<d;k++)
  	   {
  	   	sum+=pow( abs(p[i][k]-p[j][k])  ,2 ); 
		 }
		 
		 float tt=sqrt(sum);
		 float dd=floor(tt);
		 if(abs(dd-tt)==0)
		 c++;
		 
	  
	  
	  }
  }
  
 cout << c;

}





Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	ll K;
	cin>>K;
	ll l = 0;
	ll r = 10000000000000000LL;
	// ll k = K/50*50;
	// while(r-l>1){
	// 	ll mid = (r+l)/2;
	// 	ll a = mid-49;
	// 	if(a<=k) l = mid;
	// 	else r = mid;
	// }
	vll ans(50, 49);
	rep(i,50){
		ans[i] += K/50*50 - K/50*49;
	}
	rep(i,50){
		if(i<K%50){
			ans[i] += 50+1;
		}
		ans[i] -= K%50;
	}

	cout<<50<<endl;
	rep(i,50){
		if(i) cout<<" ";
		cout<<ans[i];
	}
	cout<<endl;
}


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

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

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : b;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	ll n;
	cin >> n;
	
	ll ans = 10000000000000;
	for(ll i = 1; i * i <= n; ++i){
		if(n % i == 0){
			ll tmp = n / i;
			ans = min(ans, (tmp + i - 2));
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void)
{
	char str[1000];
	int i;
	int s;
	
	scanf("%s", str);
	
	 s = strlen(str);
	
	for (i = 0; i < s; i++){
		str[i] -= 'A';
		
	str[i] = (str[i] + 23) % 26;
	
	str[i] += 'A';
	}
	printf("%s\n", str);

	return (0);
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
using namespace std;
const int MOD = 1000000007; 
typedef long long ll;
typedef string str;
  
int main(){
  int n,l;
  cin >> n >> l;
  pair<str,int> a[n];
  rep(i,n){
    str tmp;
    int dic_cnt = 0;
    cin >> tmp;
    rep(j,l)
      dic_cnt += tmp[j];
    a[i] = mp(tmp,dic_cnt);
  }
  sort(a, a + n);
  rep(i,n)
    cout << a[i].first;
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)

N, M = map(int, input().split())

lightBulbs = [None]*M
for i in range(M):
    data = list(map(int, input().split()))
    lightBulbs[i] = data[1:]

P = list(map(int, input().split()))

def rec(pos, count, status):
    if pos == N:
        count += judge(status)
        return count
    status[pos] = 0
    count = rec(pos+1, count, status)
    status[pos] = 1
    count = rec(pos+1, count, status)
    return count

def judge(status):
    for i, lightBulb in enumerate(lightBulbs):
        toggle = 0
        for switch in lightBulb:
            toggle += status[switch-1]
        toggle %= 2
        if P[i] != toggle:
            return 0
    return 1 
    

ans = rec(0, 0, [0]*N)
print(ans)


Measured memory_bytes: 42076
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#define int long long
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

signed main()
{
  double W, H;
  int x, y;
  cin >> W >> H >> x >> y;

  double ans0 = W * H / 2;
  int ans1 = 0;
  if (x * 2 == W && y * 2 == H) ans1 = 1;

  cout << setprecision(15) << ans0 << " " << ans1 << endl;
}

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

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

int main(){
  vector<int> donuts;
  int N,X;  cin >> N >> X;
  int sum = 0;
  for(int i = 0;i < N;i++){
    int emp;  cin >> emp;
    sum += emp;
    donuts.push_back(emp);
  }

  int ing = X - sum;//残りの材料
  int mindon = *min_element(donuts.begin(),donuts.end());

  cout << N + (ing/mindon) << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
using namespace std;
long long f(long long a){
	if(a == 0 || a == 1)
		return 1;
	else
		return a * f(a-1);
}
long long n;
int main(){
	cin >> n;
	cout << f(n) << "\n";
	
	return 0;
}

Measured memory_bytes: 2976
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read();
    let m: usize = read();

    let mut food: std::collections::HashSet<_> = (1..m + 1).collect();
    for _ in 0..n {
        let k = read();
        let a: std::collections::HashSet<_> = (0..k).map(|_| read()).collect();
        food = food.intersection(&a).cloned().collect();
    }

    println!("{}", food.len());
}

Measured memory_bytes: 4352
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)


int main() {
    string s, t; cin >> s >> t;

    map<char, set<int>> place;
    rep(i, s.size()){
        place[s[i]].insert(i);
    }

    ll index = -1, lap = 0;
    bool ok = true;
    rep(i, t.size()){
        char c = t[i];
        set<int>& st = place[c];
        if(st.size() == 0){ ok = false; break; }

        auto num = st.upper_bound(index);
        if(num == st.end()){
            index = -1; lap++;
            num = st.upper_bound(index);
        }
        index = *num;
    }
    ll res;
    ok ? res = s.size() * lap + index + 1 : res = -1;
    cout << res << ln;
}




Measured memory_bytes: 5120
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using NX = System.Int64;


public class Prog
{
    public static void Solve()
    {
        int N = NextInt();
        string S = NextString();
        string T = NextString();
        for (int i = 0; i < N; i++) { Console.Write(S[i] + "" + T[i]); }
        Console.WriteLine();
    }
    public static long RepPow(long x, long p, long m = 1000000007)
    {
        if (p == 0) return 1;
        if (p == 1) return x % m;
        long b = RepPow(x, p / 2, m) % m;
        if (p % 2 == 0) { return (b * b) % m; }
        else { return (x * ((b * b) % m)) % m; }
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        return;
    }
}
public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 11220
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int x, y;
    x = abs(a - b);
    y = abs(a - c);
    cout << (x > y ? "B" : "A") << endl;
    return 0;
}


Measured memory_bytes: 256