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

int main() {
  int n;
  while (cin >> n, n) {
    auto c = vector<int>(n);
    for (int i = 0; i < n; ++i) {
      string w; cin >> w;
      c[i] = w.length();
    }
    auto solve = [&]() {
      for (int i = 0; i < n; ++i) {
        auto phrase = vector<int>{5, 7, 5, 7, 7};
        int idx = 0;
        for (int j = i; j < n; ++j) {
          if (phrase[idx] > 0) phrase[idx] -= c[j];
          if (phrase[idx] < 0) break;
          if (phrase[idx] == 0) ++idx;
          if (idx == 5) return i + 1;
        }
      }
      return 0;
    };
    cout << solve() << endl;
  }
  return 0;
}



Measured memory_bytes: 3128
import java.util.ArrayDeque;
import java.util.Iterator;
import java.util.Scanner;

// Java8
public class Main
{
	static Scanner sc = new Scanner(System.in);

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

	void run()
	{
		int n = sc.nextInt();
		ArrayDeque<Integer> deq = new ArrayDeque<>(n+1);
		for(int i=0; i<n; i++)
		{
			int a = sc.nextInt();
			if((i&1)==0)
			{
				deq.offerLast(a);
			}
			else
			{
				deq.offerFirst(a);
			}
		}
		Iterator<Integer> itr = (n&1)==0 ? deq.iterator() : deq.descendingIterator();
		System.out.print(itr.next());
		while(itr.hasNext())
		{
			System.out.print(" ");
			System.out.print(itr.next());
		}
		System.out.println();
	}
}

Measured memory_bytes: 94468
#include <iostream>


int main()
{
	char ch;
	int counter[26] = {};
	while (!(std::cin >> ch).eof()) {

		if (ch >= 'a' && ch <= 'z')
			counter[ch - static_cast<int>('a')] += 1;
		else if (ch >= 'A' && ch <= 'Z')
			counter[ch - static_cast<int>('A')] += 1;
	}


	for (int i = 0; i < 26; i++) {
		std::cout << static_cast<char>(i + 'a') << " : " << counter[i] << "\n";
	}
	return 0;
}



Measured memory_bytes: 3108
def Qb():
    ans = 'No'
    x, y = map(int, input().split())
    for b in range(0, x + 1):
        z = y - (4 * b)
        if z % 2 == 0 and x == (z / 2 + b):
            ans = 'Yes'
            break
    print(ans)


if __name__ == "__main__":
    Qb()


Measured memory_bytes: 9108
#include <bits/stdc++.h>
typedef long long int ll;
#define rep(i,n) for (int i = 0; i< (n); i++)
#define Rep(i,n,m) for (int i = (n); i< (m); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
const int INF = 1e9;
const ll MOD = 1000000007;
const ll LINF = 1e18;
using namespace std;



int main() {
    int a,b,c,d;
    string s;
    cin>>a>>b>>c>>d;
    
    while(true){
        c=c-b;
        if(c<=0){
            s = "Yes";
            break;
        }
        
        a = a - d;
        if(a<=0){
            s = "No";
            break;
        }
    }
    
    cout<<s<<endl;
    
    return 0;
}



Measured memory_bytes: 3636
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    x = [int(i) for i in input().split()]
    y = [int(i) for i in input().split()]
    x.append(a[2])
    y.append(a[3])

    if min(y) > max(x):
        print("No War")
    else:
        print("War")

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

class edge{
public:
    int from,to,num,p_color;
    edge(int _from, int _to, int _num):from(_from),to(_to),num(_num),p_color(-1){}
};

int main(){
    int n;
    cin>>n;
    vector<vector<edge>> G(n);
    for(int i=0;i<n-1;++i){
        int a,b;
        cin>>a>>b;
        --a,--b;
        G[a].emplace_back(a,b,i);
        G[b].emplace_back(b,a,i);
    }

    int max_color=0;
    for(int i=0;i<n;++i) max_color=max(max_color,(int)G[i].size());

    vector<int> res(n-1,-1);
    int color=0;
    queue<edge> que;
    for(auto e: G[0]) que.push(e);
    
    while (!que.empty())
    {
        edge e=que.front();
        que.pop();
        if(res[e.num]!=-1) continue;
        res[e.num]=color++%max_color+1;
        while(res[e.num]==e.p_color) res[e.num]=color++%max_color+1;
        for(auto nv :G[e.to]){
            nv.p_color=res[e.num];
            que.push(nv);
        }
    }
    
    cout<<max_color<<endl;
    for(int i=0;i<n-1;++i) cout<<res[i]<<endl;
}

Measured memory_bytes: 11332
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define MOD ((int)1e9 + 7)
#define atoi(x) ((x)-'0')
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

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

ll k, cur = 7, ans = 1, visited[1000010];

int main() {
	cin >> k;
	while (1) {
		if (cur % k == 0) {
			cout << ans;
			return 0;
		}
		cur %= k;
		if (visited[cur]) {
			cout << -1;
			return 0;
		}
		visited[cur] = 1;
		cur = cur * 10 + 7;
		ans++;
	}
}

Measured memory_bytes: 11372
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        int rectangleCnt = 0;
        int lozengeCnt = 0;
        
        while (scanner.hasNext()) {
            String input = scanner.nextLine();
            String[] data = input.split(",");
            int side1 = Integer.parseInt(data[0]);
            int side2 = Integer.parseInt(data[1]);
            int diagonal = Integer.parseInt(data[2]);
            
            double a = Math.pow(side1, 2) + Math.pow(side2, 2);
            double b = Math.pow(diagonal, 2);
            
            if (a==b) {
                rectangleCnt++;
            } else if (side1 == side2) {
                lozengeCnt++;
            }
        }
        
        System.out.println(rectangleCnt);
        System.out.println(lozengeCnt);
    }   
}

Measured memory_bytes: 17148
N,M = map(int,input().split())

A = [[] for i in range(N)]

for i in range(N):
    A[i] = list(map(int,input().split()))

B = [[0]*1 for i in range(M)]

for i in range(M):
    B[i] = int(input())


for row in range(N):
    tmp = 0
    for col in range(M):
        tmp += A[row][col]*B[col]
    print("%d"%(tmp))


Measured memory_bytes: 6024
#include <bits/stdc++.h>
#include <iostream>
typedef long long ll;
#define rep(i,a,b) for(int i =a ;i <= b;i++)
using namespace std;

int main(int argc, char const *argv[])
{
	//ifstream cin("input.txt");
	cout.sync_with_stdio(false);
	cin.tie(0);
	ll k;

	cin>>k;

	ll start = 7 % k;
	ll count = 1;
	if(k % 2 == 0 || k % 5 == 0)
	{
		cout<<"-1";
		return 0;
	}
	while(start != 0){
		start = ((start *10)%k + 7%k)%k;
		count ++;
	}

	cout<<count;	
}

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

int A[2000000];
int H;

int l(int i) {
    return i * 2;
}

int r(int i) {
    return i * 2 + 1;
}

int p(int i) {
    return i/2;
}
void maxify(int i) {
    int mi = i;
    if (l(i) <= H && A[l(i)] > A[i]) {
        mi = l(i);
    }
    if (r(i) <= H && A[r(i)] > A[mi]) {
        mi = r(i);
    }
    if (mi != i) {
        swap(A[i], A[mi]);
        maxify(mi);
    }
}

void insert(int k) {
    H++;
    A[H] = k;
    int i = H;
    while (i >= 1) {
        maxify(i);
        i = p(i);
    }
}

int extract() {
    int ret = A[1];
    A[1] = A[H];
    H--;
    maxify(1);
    return ret;

}

int main() {
    string cmd;
    int k;
    while (true) {
        cin >> cmd;
        if(cmd == "insert") {
            cin >> k;
            insert(k);
        } else if (cmd == "extract") {
            cout << extract() << endl;
        } else if (cmd == "end") {
            break;
        }
    }


    return 0;
}



Measured memory_bytes: 7032
x, y, z, k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)
ans = []
for i in range(x):
    for j in range(y):
        for l in range(z):
            if (i+1) * (j+1) * (l+1) <= k:
                ans.append(a[i] + b[j] + c[l])
            else:
                break
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])


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

int main(){
    int N;
    cin >> N;
    int num = 0,ans=0;
    for(int i = 1; i <= N; i++){
        int n = i;
        num = 0;
        while(n){
            n /= 10;
            num++;
        }
        if(num % 2 != 0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int a;
	cin>>a;
	string s;
	cin>>s;
	if(a<3200)
		cout<<"red";
	else
		cout<<s;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}







Measured memory_bytes: 3616
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    L = list(map(int, sys.stdin.readline().split()))
    L = sorted(L)
    ans = L[0]
    for l in L[1::]:
        ans = (ans + l) / 2
    print(ans)

Measured memory_bytes: 5612
import math
import sys

s = list(sys.stdin.readline().rstrip())
k = int(sys.stdin.readline().rstrip())

if len(set(s)) == 1:
    print(len(s) * k // 2)
    sys.exit()
ss = s * 2
tmp, tmp2 = 0, 0
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        tmp += 1
        s[i + 1] = '-1'
for i in range(len(s) * 2 - 1):
    if ss[i] == ss[i + 1]:
        tmp2 += 1
        ss[i + 1] = '-1'
print(tmp + (tmp2 - tmp) * (k - 1))

Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>
int main()
{int t,i,j;
double a[12],b[12],s=0;
	scanf("%d",&t);
	  	for(i=0;i<t;i++)
	  	  {
			scanf("%lf%lf",&a[i],&b[i]);
	  	 }
	  	  for(i=0;i<t-1;i++)
	  	    for(j=i+1;j<t;j++)
	  	    s+=sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));
	  	printf("%.10lf\n",2*s/t);
	  
 } 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=100005,INF=1<<30;

struct UF{
    int n;
    vector<int> par,size;
    
    void init(int n_){
        n=n_;
        par.assign(n,-1);
        size.assign(n,1);
        
        for(int i=0;i<n;i++){
            par[i]=i;
        }
    }
    
    int root(int a){
        if(par[a]==a) return a;
        else return par[a]=root(par[a]);
    }
    
    void unite(int a,int b){
        if(root(a)!=root(b)){
            size[root(a)]+=size[root(b)];
            par[root(b)]=root(a);
        }
    }
    
    bool check(int a,int b){
        return root(a)==root(b);
    }
};

vector<int> G[MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<int> A(N),B(N),used(N);
    int sub=0;
    map<int,int> MA;
    for(int i=0;i<N;i++){
        cin>>A[i];
        sub^=A[i];
        MA[A[i]]++;
    }
    MA[sub]++;
    for(int i=0;i<N;i++){
        cin>>B[i];
        MA[B[i]]--;
        if(MA[B[i]]<0){
            cout<<-1<<endl;
            return 0;
        }
    }
    
    for(int i=0;i<N;i++){
        if(A[i]==B[i]) used[i]=1;
    }
    
    UF uf;
    uf.init(N);
    
    vector<pair<int,int>> S;
    map<int,int> F;
    for(int i=N-1;i>=0;i--){
        if(used[i]) continue;
        S.push_back(mp(B[i],i));
        F[B[i]]=i;
    }
    sort(all(S));
    
    for(int i=0;i+1<si(S);i++){
        if(S[i].fi==S[i+1].fi){
            uf.unite(S[i].se,S[i+1].se);
        }
    }
    
    for(int i=0;i<N;i++){
        if(used[i]) continue;
        if(F.count(A[i])){
            uf.unite(i,F[A[i]]);
        }
    }
    
    for(int i=0;i<N;i++){
        if(used[i]) continue;
        G[uf.root(i)].push_back(i);
    }
    
    int ans=0;
    
    for(int i=0;i<N;i++){
        if(si(G[i])==0) continue;
        
        vector<int> X,Y;
        for(int a:G[i]){
            X.push_back(A[a]);
            Y.push_back(B[a]);
        }
        
        sort(all(X));
        sort(all(Y));
        
        if(X==Y&&!binary_search(all(X),sub)) ans+=si(G[i])+1;
        else ans+=si(G[i]);
    }
    
    cout<<ans<<endl;
    
}


Measured memory_bytes: 17652
def libra(A: int, B: int, C: int, D: int) -> str:
    if A + B > C + D:
        return 'Left'
    if A + B < C + D:
        return 'Right'
    return 'Balanced'


if __name__ == "__main__":
    A, B, C, D = map(int, input().split())
    ans = libra(A, B, C, D)
    print(ans)


Measured memory_bytes: 2940
A, B, C = map(int, input().split())

if A % 2 == B % 2 == C % 2:
    N = max(A, B, C)
    ans = (N - A) // 2 + (N - B) // 2 + (N - C) // 2
    print(ans)
else:
    if A % 2 == B % 2:
        A += 1
        B += 1
    elif B % 2 == C % 2:
        B += 1
        C += 1
    else:
        C += 1
        A += 1
    N = max(A, B, C)
    ans = 1 + (N - A) // 2 + (N - B) // 2 + (N - C) // 2
    print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
#define PR(x) cout << (x) << "\n"
#define PS(x) cout << (x) << " "
#define PRYES(x) PR((x) ? "Yes" : "No")
const long long INF = numeric_limits<long long>::max();
// SourceTest用出力マクロ
#ifdef SOURCE_TEST
#define SPR(x) PR(x)
#define SPS(x) PS(x)
#else
#define SPR(x) \
    {}
#define SPS(x) \
    {}
#endif
int main() {
    ll N;
    cin >> N;

    ll count   = 0;
    bool isAns = false;
    REP(i, N) {
        ll a, b;
        cin >> a >> b;
        if (a == b) {
            count++;
            isAns |= (count >= 3);
        } else {
            count = 0;
        }
    }

    PR(isAns ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int a,b,c;
	int ans=0;
	cin >>a>>b>>c;
	cout<<solve(a <=c and b>= c)<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back
#define f first
#define s second
#define endl "\n"
#define F(i,n) for(ll i=0;i<n;i++)
#define mem(x,val) memset(x,val,sizeof(x))
#define mod 1000000007
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cerr.tie(NULL)
 
int main()
{
    crap;
    ll T = 1;
    //cin>>T;
    while(T--){
    	ll n,k; cin>>n>>k;
    	vector<ll> a(n); F(i,n) cin>>a[i];
    	// if(k>=n) cout<<0<<endl;
    	// else{
		ll s = 0;
		sort(a.begin(), a.end());
		F(i,n-k){
			s+=a[i];
		}
		cout<<s<<endl;
    	// }
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n;i++){
        cin >> s.at(i);
    }

    cin >> m;
    vector<string> t(m);
    for (int i = 0; i < m; i++){
        cin >> t.at(i);
    }

    int ans = 0;
    for (int i = 0; i < n;i++){
        int buf = 0;
        for (string a:s){
            if(a==s.at(i))buf++;
        }
        for(string b:t){
            if(b==s.at(i)) buf--;
        }
        if(ans<buf)ans = buf;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111




	void solve(){


		ini(n);
		vi morty(n);
		vi morty1(n);
		FOR(i,0,n)in(morty[i],morty1[i]);
		sort(all(morty));
		sort(all(morty1));
		if(n%2){
			out(morty1[n/2]-morty[n/2]+1);
		}
		else{
			out(morty1[n/2]+morty1[n/2-1]-morty[n/2]-morty[n/2-1]+1);
		}


		
	}























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  string S;
  cin >> S;

  int N = len(S);

  int ok = true;
  rep(i, N / 2) {
    if (S[i] != S[N - 1 - i])
      ok = false;
  }

  int M = N / 2;
  repp(i, 0, M - 1) {
    if (S[i] != S[M - 1 - i])
      ok = false;
  }

  repp(i, 0, M - 1) {
    if (S[M + 1 + i] != S[N - 1 - i])
      ok = false;
  }

  if (ok)
    cout << "Yes\n";
  else
    cout << "No\n";
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  double N; cin >> N;
  int a, b, c;
  double tmp = 4 / N;
  bool flag = false;
  for(int i = 1; i <= 10000; ++i) {
    for(int k = 1; k <= 10000; ++k) {
      double A = N * i * k;
      double B = 4 * i * k - N * k - N * i;
      double C = A / B;
      if(floor(C) == C && C > 0) {
        a = i; b = k; c = C;
      }
    }
  }
  cout << a << " " << b << " " << c << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
  using namespace std;
   
  #define ll long long
  #define pb push_back
  #define mp make_pair
  #define ff first
  #define ss second


   
void func(){

ll n,k;
cin>>n>>k;


ll ans = min(n%k,k-n%k);
cout<<ans<<endl;





}
   
   
  int main(){
          ios_base::sync_with_stdio(false);
          cin.tie(0);
          cout.tie(0);
   
     /*   #ifndef ONLINE_JUDGE
        freopen("input.txt", "r" , stdin);
        freopen("output.txt", "w" , stdout);
        #endif*/
   
     ll t=1;
     //cin>>t;
     while(t--)
     func();
   }

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

int main(void){
	char s[262144];
	int i,l,fa = 999999,lz = -1;
	scanf("%s",s);
	l = strlen(s);
	for(i = 0;i < l;i++){
		if(s[i] == 'A' && i < fa){fa = i;}
		if(s[i] == 'Z' && lz < i){lz = i;}
	}
	printf("%d\n",lz-fa+1);
	return 0;
}

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

sumRest = sum([A for A in As[K:] if A > 0])
sumPlus = sumMinus = 0
for A in As[:K]:
    if A > 0:
        sumPlus += A
    else:
        sumMinus += A

ans = 0
for i in range(N - K + 1):
    score = sumRest + max(sumPlus + sumMinus, 0)
    ans = max(ans, score)

    if As[i + K] > 0:
        sumRest -= As[i + K]
        sumPlus += As[i + K]
    else:
        sumMinus += As[i + K]

    if As[i] > 0:
        sumRest += As[i]
        sumPlus -= As[i]
    else:
        sumMinus -= As[i]

print(ans)


Measured memory_bytes: 14572
# -*- coding: utf-8 -*-
# 整数の入力
# from functools import reduce
import sys
from collections import defaultdict

sys.setrecursionlimit(1000000)


def main():
    # n, q
    n, q = map(int, input().split())

    trees = [[] for i in range(n+1)]
    # a, b
    for _ in range(0, n - 1):
        a, b = map(int, input().split())
        trees[a].append(b)
        trees[b].append(a)

    values = [0 for i in range(n+1)]
    # p, x
    for _ in range(0, q):
        p, x = map(int, input().split())
        values[p] += x
    process(1, -1, trees, values)
    print(*values[1:])


def process(i, parent, trees, values):
    for j in trees[i]:
        if j == parent:
            continue
        values[j] += values[i]
        process(j, i, trees, values)


if __name__ == "__main__":
    main()


Measured memory_bytes: 231244
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N = int(input())
    W = list(map(int, input().split()))
    ans = 10 ** 15
    for i in range(1, N):
        a = sum(W[:i])
        b = sum(W[i:])
        ans = min(ans, abs(a - b))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <stdio.h>

#define DEF_ELM_MAX 100

	int R[DEF_ELM_MAX];

void swap(int *x, int *y)
{
	int tmp;
	tmp = *x;
	*x = *y;
	*y = tmp;
	return;
}

int bubbleSort(int *A, int N) // N ??????????´?????????? 0-????????????????????? A
{
	int flag = 1; // ????????£??\????´?????????¨??????
	int i;
	int j;
	int cnt = 0;

	i = 0; // ??????????????¨?????????????????????????????????
	while (flag) {
		flag = 0;
		for ( j = N-1 ; j > i ; j-- ) {
			if (A[j] < A[j-1]) {
				swap(&A[j], &A[j-1]);
				cnt++;
				flag = 1;
			}
		}
		i++;
	}
	return cnt;
}

int main(void)
{
	int N;
	int i;

	int ans;

	scanf("%d", &N);
	for ( i = 0 ; i < N ; i++ ) {
		scanf("%d", &R[i]);
	}

	ans = bubbleSort(R, N);

	for ( i = 0 ; i < N ; i++ ) {
		if (i > 0) {
			printf(" ");
		}
		printf("%d", R[i]);
	}
	printf("\n%d\n", ans);
	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
#define vall(x) (x).begin(), (x).end()
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2> bool chmin(T1 &l, const T2 &r);
template <class T1, class T2> bool chmax(T1 &l, const T2 &r);
template <class T1, class T2> void vadd(vector<T1> &v, T2 x);

#define int long long int

void solve(long long D, long long T, long long S) {
  YesNo(D<= S *T);
}

signed main() {
  long long D;
  scanf("%lld", &D);
  long long T;
  scanf("%lld", &T);
  long long S;
  scanf("%lld", &S);
  solve(D, T, S);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2> bool chmin(T1 &l, const T2 &r) {
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2> bool chmax(T1 &l, const T2 &r) {
  return (l < r) ? (l = r, true) : false;
}

template <class T1, class T2> void vadd(vector<T1> &v, T2 x) {
  for (auto &s : v)
    s += T2(x);
}


Measured memory_bytes: 3760
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
int n,a[233333];
bool ok(int g)
{
	for(int i=1;i<=n;++i)
		if(a[i]==g||a[i]==g-1);else return 0;
	int sg=0;
	for(int i=1;i<=n;++i)
		if(a[i]==g-1) ++sg;
	if(sg>g) return 0;
	int tt=n-sg;
	if(tt&&sg==g) return 0;
	if(tt==1) return 0;
	int tw=g-sg;
	if(tw<=tt/2) return 1;
	return 0;
}
int main()
{
	scanf("%d",&n); int m=0;
	for(int i=1;i<=n;++i)
		scanf("%d",a+i),m=max(m,a[i]);
	if(ok(m)||ok(m+1)) puts("Yes");
	else puts("No");
}


Measured memory_bytes: 640
N = int(input())
t = int(input())
t1 = int(input())
mint = t
if t > t1:
  mint = t1
maxt = t1 -t
  
for i in range(2,N):
  a = int(input())
  if a - mint > maxt:
    maxt = a - mint
  if a < mint:
    mint = a
print(maxt)


Measured memory_bytes: 5612
map$q[$_]+=$q[$N]/@$N,@{/ /,push@
$`,$' for<>;$N=$_}for++$q[1]..<>;${$b=1;$e[$N]=$b+=$_/@@for@@=sort@e[@$N];a}<($~=$q[$N]*($b-1-$@[-1])/($#@||1))or$a=$~while--$N;print$a+$b

Measured memory_bytes: 42368
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000
using ll = long long;
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-12; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);

}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	llint ans = 0, n = 0,  count = 0, sum = 0,old=0;
    llint  a=0,b=0;
	bool check = false;
	string ss, sss;
	vector<llint> array;
	vector<bool> bo;
	vector<llint> counter,rust;
	cin >> ss;
	cout << ss.substr(0, 3) << endl;
	

	please AC;
}


Measured memory_bytes: 3624
#include <iostream>
#include <stdio.h>
using namespace std;

main() {

  double pi, r, are, circ;
  pi = 3.141592653589;
  cin >> r;
  
    are = pi*r*r;
    circ = 2*pi*r;

    printf("%f %f\n", are, circ);

    return 0;

}

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

#define MOD 1000000007
#define MAX 100005

int main(){
    int n,m,b;
    bool k[MAX];
    cin>>n>>m;
    long long ans[MAX];
    ans[0]=1;
    ans[1]=1;
    for(int i=0;i<=n;i++) k[i]=true;
    for(int i=0;i<m;i++){
        cin>>b;
        k[b]=false;
    }
    if(!k[1]) ans[1]=0;
    for(int i=2;i<=n;i++){
        if(k[i]){
            ans[i]=(ans[i-1]+ans[i-2])%MOD;
        }
        else ans[i]=0;
    }
    cout<<ans[n]<<endl;
}

Measured memory_bytes: 1152
import java.util.*;
public class Main {
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	int r = sc.nextInt();
     int ans=1; 
      if (n >=r) {
      for (int i=2;i<=100;i++) {
                  ans++;
        if (Math.pow(r,i)>n) {
          
          break;
        }
      }
      }
      System.out.println(ans);
    }
}

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

inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
	return x * f;
}

const int N = 1e6 + 5;
int a[N];
string s;

int main()
{
	cin >> s;
	int n = s.size();
	for (int i = 1; i <= n; ++i) a[i] = s[n - i] - '0';
	
	for (int i = 1; i <= n; ++i) a[i] *= 9;
	for (int i = 1; i <= n; ++i) a[i + 1] += a[i] / 10, a[i] %= 10;
	if (a[n + 1]) ++n;
	
	int tot = 0;
	for (int i = 1; i <= n; ++i) tot += a[i];
	for (int k = 1, i; ; ++k)
	{
		a[i = 1] += 9;
		tot += 9;
		for (; a[i] >= 10; ++i)
		{
			a[i + 1] += a[i] / 10;
			a[i] %= 10;
			tot -= 9;
		}
		if (tot <= 9 * k && tot % 9 == 0) 
			return printf("%d\n", k), 0;
	}
	
	return 0;
}


Measured memory_bytes: 5804
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vl a(3);
	cin>>a;
	puta(sum(a)-max(a));
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    s = f.read_str()
    l = ['Sunny', 'Cloudy', 'Rainy']
    for i in range(3):
        if l[i] == s:
            return l[(i+1)%3]
    return 0


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


Measured memory_bytes: 35816
s = input()
n = int(input())
for _ in range(n):
    O = list(map(str, input().split()))
    i = int(O[1])
    j = int(O[2])
    if O[0] == 'print':
        print(s[i:j + 1])
    elif O[0] == 'reverse':
        ss = s[i:j + 1]
        s = s[:i] + ss[::-1] + s[j + 1:]
    else:
        p = O[3]
        s = s[:i] + p + s[j + 1:]



Measured memory_bytes: 5612
n=int(input())
list1=[0 for i in range(2)]#list1[0]が最大値 list1[1]が二番めに大きい値
list2=[0]*2#list2[0]が最大値index list2[1]が二番めに大きい値index
count=1
for i in range(n):
    a=int(input())
    if list1[0]<=a:
        list1[1]=list1[0]
        list1[0]=a
        list2[1]=list2[0]
        list2[0]=count
    elif list1[1]<=a:
        list1[1]=a
        list2[1]=count
    count+=1
#print(list1)
#print(list2)
for i in range(1,n+1):
    if i==list2[0]:
        print(list1[1])
    else:
        print(list1[0])

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

long long f_0 (long long A){
    if(A%4==0){
        return A;
    }
    if(A%4==1){
        return 1;
    }
    if(A%4==2){
        return A+1;
    }
    if(A%4==3){
        return 0;
    }
}

int main(){
    long long A, B;
    cin >> A >> B;

    int bit_A[100], bit_B[100];

    for(int i=0; i<100; i++){
        bit_A[i]=0;
        bit_B[i]=0;
    }

    A = f_0(A-1);
    B = f_0(B);
    int k=0;
    while(A>0){
        bit_A[k] = A%2;
        A = A/2;
        k++;
    }
    k=0;
    while(B > 0){
        bit_B[k] = B%2;
        B = B/2;
        k++;
    }
/*
    for(int i=0; i<100; i++){
        cout << bit_A[i];
    }
    cout <<endl;
    for(int i=0; i<100; i++){
        cout << bit_B[i];
    }
        cout << endl;
*/
    long long ans=0;
    for(int i=0; i<100; i++){
        ans += pow(2,i)*(bit_A[i]!=bit_B[i]);
    }
    cout << ans <<endl;
}

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

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000000

using namespace std;
#define prime 1000000007

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";

int ce(int a, int b){
    return (a+b-1)/b;
}

int n, m, k, x;
int p[11], t[11];
vi gr[11];

int main(){
    scanf("%d %d", &n, &m);

    for (int i = 0; i < m; ++i){
        scanf("%d", &k);
        for (int j = 0; j < k; ++j){
            scanf("%d", &x);
            gr[i].pb(x);    
        }
    }

    for (int i = 0; i < m; ++i){
        scanf("%d", &p[i]);
    }

    int mask = 0, ans = 0;
    int yo = pow(2, n);
    while(mask < yo){
        int aux = mask;
        for (int i = 1; i <= n; ++i){
            t[i] = aux%2;
            aux/=2;
        }

        int r = 0;
        for (int i = 0; i < m; ++i){
            int s = 0;
            for(int l : gr[i]){
                if(t[l]) s++;
            }
            if(s%2 == p[i]) r++;
        }

        if(r == m) {
            ans++;
        }

        memset(t, 0, sizeof t);
        mask++;
    }

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

    return 0;       
}

Measured memory_bytes: 512
#include <stdio.h>
 #include <stdbool.h>
 int main()
{
 int i, j, n;
 char mark;
 char marks[4]=
{
'S', 'H', 'C', 'D'
}
;
 int num;
 bool cards[4][13]=
{
false
}
;
 scanf("%d ", &n);
 for(i=0;
i<n;
i++)
{
 scanf("%c %d ", &mark, &num);
 for(j=0;j<4;j++)
{
 if(mark==marks[j])
{
 cards[j][num-1]=true;
 break;
 }
 }
 }
 for(i=0;
i<4;
i++)
{
 for(j=0;
j<13;
j++)
{
 if(!cards[i][j])
{
 printf("%c %d\n", marks[i], j+1);
 }
 }
 }
 return 0;
 }
 


Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

int dp[101][4][4];
int yotei[101];
int N,K;

const int mod=10000;
int dfs(int pos,int o,int tw){
    if(pos==N)return 1;
    if(dp[pos][o][tw]!=-1)return dp[pos][o][tw];
    int res=0;
    if(yotei[pos]!=-1){
        int a=yotei[pos];
        if(a==o&&a==tw)return 0;
        res+=dfs(pos+1,a,o);
        res%=mod;
    }
    else{
        for(int a=0;a<3;a++){
            if(a==o&&a==tw)continue;
            res+=dfs(pos+1,a,o);
            res%=mod;
        }
    }
    return dp[pos][o][tw]=res%mod;
}

int main(){
    cin>>N>>K;
    memset(dp,-1,sizeof(dp));
    memset(yotei,-1,sizeof(yotei));
    for(int i=0;i<K;i++){
        int a,b;
        cin>>a>>b;
        yotei[a-1]=b-1;
    }
    int res=dfs(0,3,3)%mod;
    cout<<res<<endl;

    return 0;
}

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

int main()
{
	//input
	string S; cin >> S;
	
	//compute
	string ans;
	int num1 = atoi(S.substr(0,2).c_str());
	int num2 = atoi(S.substr(2,4).c_str());
	if (1 <= num1 && num1 <= 12){
		if (1 <= num2 && num2 <= 12) {
			ans = "AMBIGUOUS";
		}
		else if (num2 == 0){
			ans = "MMYY";
		}
		else{
			ans = "MMYY";
		}
	}
	else if(num1 == 0){
		if (1 <= num2 && num2 <= 12) {
			ans = "YYMM";
		}
		else{ans = "NA";}
	}
	else{
		if (1 <= num2 && num2 <= 12){
		ans = "YYMM";
		}
		else{
			ans = "NA";
		}
	}
	
	//output
	cout << ans << endl;
} 

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

using namespace std;

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

    long long ans = 0;
    int n;
    cin >> n;

    for (int i = 1; i <= n; i++)
        if (!(i % 3 == 0 || i % 5 == 0))
            ans += i;
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define inf 1<<30
using namespace std;
 
int n,m;
long long G[501][501];
vector<pair<int,int> > V;
 
long long Prim()
{
  priority_queue<pair<int,int> > PQ;
  long long d[501],color[501],parent[501];
  for(int i=0;i<n;i++){
    d[i]=inf;
    color[i]=0;
  }
  d[0]=0;
  parent[0]=0;
  PQ.push(make_pair(0,0));
  color[0]=0;
  while(!PQ.empty()){
    pair<int,int> p=PQ.top();PQ.pop();
    int u=p.s;
    color[u]=2;
 
    if(d[u]<p.f*(-1))continue;
 
    for(int i=0;i<n;i++){
      if(color[i]==2 || G[u][i]==inf)continue;
      if(d[i]>G[u][i]){
    d[i]=G[u][i];
    PQ.push(make_pair(d[i]*(-1),i));
    parent[i]=u;
    color[i]=1;
      }
    }
  }
  if(V.empty()){
    for(int i=1;i<n;i++){
      V.push_back(mp(i,parent[i]));
    }
  }
  long long res=0;
  for(int i=0;i<n;i++)res+=d[i];
  return res;
}  
 
int main()
{
  int x,y,c;
  cin>>n>>m;
  for(int i=0;i<501;i++)for(int j=0;j<501;j++)G[i][j]=inf;
  for(int i=0;i<m;i++){
    cin>>x>>y>>c;
    x--;y--;
    G[x][y]=c;
    G[y][x]=c;
  }
  long long sum=Prim(),sump=0,sumc=0;
  for(int i=0;i<V.size();i++){
    int tmp=G[V[i].f][V[i].s];
    G[V[i].f][V[i].s]=inf;
    G[V[i].s][V[i].f]=inf;
    long long a=Prim();
    if(sum<a){
      sump++;
      sumc+=tmp;
    }
    G[V[i].f][V[i].s]=tmp;
    G[V[i].s][V[i].f]=tmp;
  }
  cout<<sump<<" "<<sumc<<endl;
  return 0;
}


Measured memory_bytes: 5124
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


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

  vi a(5);
  rep(i,5){
    cin>>a[i];
  }

  sort(all(a));
  int ans=inf;

  do{
    int s=0;
    rep(i,5){
      if(i<4)
        s+=((a[i]+9)/10)*10;
      else
        s+=a[i];
    }
    ans=min(ans,s);
  }while(next_permutation(all(a)));

  cout<<ans<<endl;

}

Measured memory_bytes: 256