akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define pri(n) printf("%d",n)
#define lpri(n) printf("%lld",n)
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define F first
#define S second
const int mod=1e9+7;

int main()
{
    int t=1;
   // cin>>t;

    while(t--)
    {
        int n;
        cin>>n;

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

        ll ans=0;
        for(int i=1;i<n;i++)
        {
            if(arr[i]<arr[i-1])
            {
                ans+=(arr[i-1]-arr[i]);
                arr[i]=arr[i-1];
            }
        }
        cout<<ans;
    }
}

Measured memory_bytes: 4308
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
using namespace std;

int main(){
  string S ;
  int N, M, len, block = 0, ans = 1, check;
  cin >> S ;
  len = S.size() ;
  block = (len + 1) / 2 ;
  for(int i=0;i<(len/2);i++){
    if(S.at(i) != S.at(len-1-i)){
      ans = 0 ;
      break ;
    }
  }
  for(int i=0;i<(len/4);i++){
    if(S.at(i) != S.at((len/2)-1-i)){
      ans = 0 ;
      break ;
    }
    if(S.at(i+block) != S.at((len/2)-1-i+block)){
      ans = 0 ;
      break ;
    }
  }
  if(ans){
    cout << "Yes" << endl ;
  }  
  else{
    cout << "No" << endl ;
  }  
  return 0 ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int pow(ll x,ll y){
    if(y==0) return 1;
    return y%2==1?x*pow(x,y-1)%1000000007:pow(x*x%1000000007,y/2);
}
int main(){
    ll m,n; cin>>m>>n;
    cout<<pow(m,n)<<endl;
    return 0;
}


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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a + b > c + d){
    cout << "Left" << endl;
  }else if(a + b < c + d){
    cout << "Right" << endl;
  }else{
    cout << "Balanced" <<endl;
  }
}

Measured memory_bytes: 256
import heapq
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
q = []
l0 = [[0,0,0]]
heapq.heappush(q,[(-1)*(a[0]+b[0]+c[0]),[0,0,0]])
for i in range(k):
    l = heapq.heappop(q)
    print((l[0])*(-1))
    i,j,s = l[1]
    if i < x-1:
        if [i+1,j,s] not in l0:
            heapq.heappush(q,[(-1)*(a[i+1]+b[j]+c[s]),[i+1,j,s]])
            l0.append([i+1,j,s])
    if j < y-1:
        if [i,j+1,s] not in l0:
            heapq.heappush(q,[(-1)*(a[i]+b[j+1]+c[s]),[i,j+1,s]])
            l0.append([i,j+1,s])
    if s < z-1:
        if [i,j,s+1] not in l0:
            heapq.heappush(q,[(-1)*(a[i]+b[j]+c[s+1]),[i,j,s+1]])
            l0.append([i,j,s+1])

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

int main() {
  
  int K=0;
  
  cin >> K;
  
  int even = K/2;
  
  if(K%2==0) {
    
    int ans = even*even;
    
    cout << ans << endl;
    
    return 0;
    
  } else {
    
    int ans = even*(even+1);
    
    cout << ans << endl;
    
    return 0;
    
  }
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  int ans = 0;
  REP(i, 4) {
    if (n % 10 == 2) ++ans;
    n /= 10;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    for num in range(1,2000):
        if int(num*0.08) == A and int(num*0.1)==B:
            print(num)
            return
    else:
        print(-1)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n, a, i, j, k, min, max, d;
    char[] ch;
    char tmp;
    String str;

    n = sc.nextInt();
    for(i = 0;i < n;i++){
      str = sc.next();
      a = str.length();
      ch = new char[a];
      for(j = 0;j < a;j++)ch[j] = str.charAt(j);
      for(j = 0;j < a - 1;j++)for(k = 0;k < a - 1 - j;k++){
        if(ch[k] > ch[k + 1]){
          tmp = ch[k]; ch[k] = ch[k + 1]; ch[k + 1] = tmp;
        }
      }

      d = 1; min = 0; max = 0;
      for(j = 0;j < a;j++){
        min += d * (int)(ch[a - 1 - j] - '0');
        max += d * (int)(ch[j] - '0');
        d *= 10;
      }
      out.println(max - min);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 17312
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

#define INF 

using namespace std;

enum Status {Start, Line, End};

class Event {
public:
    int x;
    Status st;
    int ymin, ymax;
    Event(int _x, Status _st, int _ymin, int _ymax) : x(_x), st(_st), ymin(_ymin), ymax(_ymax) {}
    inline bool operator<(const Event& rhs) const
    {
        return x < rhs.x || (x == rhs.x && st < rhs.st) || (x == rhs.x && st == rhs.st && ymin < rhs.ymin);
    }
};

int main()
{
    set<Event> zSet;

    int n;
    cin >> n;
    int x1, y1, x2, y2;
    for (int i = 0; i < n; ++i) {
        cin >> x1 >> y1 >> x2 >> y2;
        if (x1 == x2) {
            if (y1 > y2) {
                swap(y1, y2);
            }
            zSet.insert(Event(x1, Line, y1, y2));
        } else if (y1 == y2) {
            if (x1 > x2) {
                swap(x1, x2);
            }
            zSet.insert(Event(x1, Start, y1, y2));
            zSet.insert(Event(x2, End, y1, y2));
        }
    }

    set<int> zCur;
    int Res = 0;

    for (auto it = zSet.begin(); it != zSet.end(); ++it) {
        Event E = (*it);
        switch (E.st) {
        case Start:
            zCur.insert(E.ymin);
            break;
        case Line:
            Res += distance(zCur.lower_bound(E.ymin), zCur.upper_bound(E.ymax));
            break;
        case End:
            zCur.erase(E.ymin);
            break;
        }
    }

    cout << Res << endl;

    return 0;
}


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

int main()
{
  int N; 
  long long int answer;
  int *A, *B;
  scanf("%d", &N);
  answer = 0;
  A = (int *)malloc(sizeof(int) * N);
  B = (int *)malloc(sizeof(int) * N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    B[i] = A[i];
  }
  
  for (int i = 0; i < N - 1; i++) {
    if(B[i + 1] < B[i])
      B[i + 1] = B[i];
  }
  
  for(int i = 0; i < N; i++)
    answer += B[i] - A[i];
  printf("%lld\n", answer);
  return 0;
}
  

Measured memory_bytes: 3224
#include <cstdio>
#include <vector>
#include <cmath>
using namespace std;

struct point
{
    int a,b;
};

vector<point> v1;
vector<point> v2;
int main()
{
//    int a = -2e8;
  //  printf("%d\n", a);
    int n, m, x, y;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n ; i++)
    {
        scanf("%d%d", &x, &y);
        v1.push_back({x,y});
    }
    for(int i = 0; i < m ; i++)
    {
        scanf("%d%d", &x, &y);
        v2.push_back({x,y});
    }
    int minv2 = 0,minnum; //= abs(v1[0].a - v2[0].a) + abs(v1[0].b - v2[0].b);
    int i,j;
    for(i = 0; i < v1.size(); i++)
    {
        minnum = 3e8;
        for( j = 0; j < v2.size(); j++)
        {
            int t = abs(v1[i].a - v2[j].a) + abs(v1[i].b - v2[j].b);
            if(minnum > t)
            {
                minnum = t;
             //   minv1 = i;
                minv2 = j;
            }
        }
        printf("%d\n", minv2+1);
    }

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  int t = 0;
  for (int i = 0; i < n; i++) {
    t ^= a[i];
  }
  rep(i, n) { cout << (t ^ a[i]) << " "; }
  cout << endl;
}


Measured memory_bytes: 4688
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,mmx,avx,tune=native")
#include "bits/stdc++.h"
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
#define fst first
#define snd second
const int UNDEF = -1;
const int INF=1<<30;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;typedef vector<ll> vll;typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;
#ifdef ONLINE_JUDGE
#define assert(...) /* nothing */
#endif
#define DEBUG_CAT
#ifdef DEBUG_CAT
#define dbg(...)   printf( __VA_ARGS__ )
#else 
#define dbg(...)   /****nothing****/
#endif
int rint();char rch();long long rlong();
// mt19937 rng; rng.seed(std::chrono::high_resolution_clock::now().time_since_epoch().count());
// template<typename T> int bins(vector<T> &v, T key) {int imin=0,imax=v.size();while(imin<imax) {int imid=(imin+imax)>>1;if (v[imid]<key) imin=imid+1;else imax=imid;}return imin;}

int main() 
{
  ios_base::sync_with_stdio(false); cin.tie(0);
  ll a,b,c; cin>>a>>b>>c;
  ll ans=b+min(a+b+1,c);
  cout<<ans<<endl;
}




static char stdinBuffer[1024];
static char* stdinDataEnd = stdinBuffer + sizeof (stdinBuffer);
static const char* stdinPos = stdinDataEnd;

void readAhead(size_t amount)
{
    size_t remaining = stdinDataEnd - stdinPos;
    if (remaining < amount) {
       memmove(stdinBuffer, stdinPos, remaining);
       size_t sz = fread(stdinBuffer + remaining, 1, sizeof (stdinBuffer) - remaining, stdin);
       stdinPos = stdinBuffer;
       stdinDataEnd = stdinBuffer + remaining + sz;
       if (stdinDataEnd != stdinBuffer + sizeof (stdinBuffer))
         *stdinDataEnd = 0;
    }
}

int rint()
{
    readAhead(16);

    int x = 0;
    bool neg = false;
    while(*stdinPos==' '||*stdinPos=='\n') ++stdinPos;
    if (*stdinPos == '-') {
       ++stdinPos;
       neg = true;
    }

    while (*stdinPos >= '0' && *stdinPos <= '9') {
       x *= 10;
       x += *stdinPos - '0';
       ++stdinPos;
    }

    return neg ? -x : x;
}
char rch()
{
    readAhead(16);
    while(*stdinPos==' '||*stdinPos=='\n') ++stdinPos;
    char ans=*stdinPos;
    ++stdinPos;
    return ans;
}
long long rlong()
{
    readAhead(32);

    long long x = 0;
    bool neg = false;
    while(*stdinPos==' '||*stdinPos=='\n') ++stdinPos;
    if (*stdinPos == '-') {
       ++stdinPos;
       neg = true;
    }

    while (*stdinPos >= '0' && *stdinPos <= '9') {
       x *= 10;
       x += *stdinPos - '0';
       ++stdinPos;
    }

    return neg ? -x : x;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
    unsigned long k;
    string s;
    getline(cin, s);
    cin >> k;
    for(int i = 0;i < s.length();++i){
        int c = 'z' - s[i] + 1;
        if(c <= k && s[i] != 'a') {
            k -= c;
            s[i] = 'a';
        }
    }
    s[s.length() - 1] = s[s.length() - 1] + (k % 26);
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 512
L = [[1, 3, 5, 7, 8, 10, 12],[4, 6, 9, 11],[2]]
x, y = map(int,input().split())
ans = False
for i in range(len(L)):
  if x in L[i] and y in L[i]:
    ans = True
if ans:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 61440
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  int dx = abs(tx - sx), dy = abs(ty - sy);

  if(tx - sx >= 0){
    if(ty - sy >= 0){
      REP(i, dx) cout << "R";
      REP(i, dy) cout << "U";
      REP(i, dx) cout << "L";
      REP(i, dy) cout << "D";
      cout << "D";
      REP(i, dx + 1) cout << "R";
      REP(i, dy + 1) cout << "U";
      cout << "LU";
      REP(i, dx + 1) cout << "L";
      REP(i, dy + 1) cout << "D";
      cout << "R";
    }
    else{
      REP(i, dx) cout << "R";
      REP(i, dy) cout << "D";
      REP(i, dx) cout << "L";
      REP(i, dy) cout << "U";
      cout << "U";
      REP(i, dx + 1) cout << "R";
      REP(i, dy + 1) cout << "D";
      cout << "LD";
      REP(i, dx + 1) cout << "L";
      REP(i, dy + 1) cout << "U";
      cout << "R";
    }
  }
  else if(ty - sy >= 0){
    REP(i, dx) cout << "L";
    REP(i, dy) cout << "U";
    REP(i, dx) cout << "R";
    REP(i, dy) cout << "D";
    cout << "D";
    REP(i, dx + 1) cout << "L";
    REP(i, dy + 1) cout << "U";
    cout << "RU";
    REP(i, dx + 1) cout << "R";
    REP(i, dy + 1) cout << "D";
    cout << "L";
  }
  else{
    REP(i, dx) cout << "L";
    REP(i, dy) cout << "D";
    REP(i, dx) cout << "R";
    REP(i, dy) cout << "U";
    cout << "U";
    REP(i, dx + 1) cout << "L";
    REP(i, dy + 1) cout << "D";
    cout << "RD";
    REP(i, dx + 1) cout << "R";
    REP(i, dy + 1) cout << "U";
    cout << "L";
  }

}


Measured memory_bytes: 256
require 'forwardable'

class Heap
	extend Forwardable

	def initialize
		@array = []
		@index = {}
	end

	def add(obj, key)
		@array << [obj, key]
		@index[obj] = @array.size - 1
		lift_up(@array.size - 1)
	end

	def swap(i, j)
		u = @array[i]
		v = @array[j]
		@index[u[0]], @index[v[0]] = j, i
		@array[i], @array[j] = v, u
	end

	def lift_up(i)
		return if i == 0
		j = (i - 1) / 2
		if @array[i][1] < @array[j][1]
			swap(i, j)
			lift_up(j)
		end
	end

	def del_min
		raise "heap is empty!" if empty?
		min = @array[0]
		if size > 1
			swap(0, @array.size-1)
			@array.pop
			lift_down(0)
		else
			@array.pop
		end
		@index.delete(min[0])
		min
	end

	def dec_key(obj, diff)
		i = @index[obj]
		@array[i][1] -= diff
		lift_up(i)
	end

	def inc_key(obj, diff)
		i = @index[obj]
		@array[i][1] += diff
		lift_down(i)
	end

	def update_key(obj, new_key)
		i = @index[obj]
		@array[i][1] = new_key
		lift_up(i)
	end

	def min_obj
		@array[0][0]
	end

	def min_key
		@array[0][1]
	end

	def lift_down(i)
		j = 2 * i + 1
		k = j + 1
		if k >= size
			return if j >= size
			if @array[i][1] > @array[j][1]
				swap(i, j)
				lift_down(j)
			end
		else
			l = (@array[j][1] < @array[k][1] ? j : k)
			if @array[i][1] > @array[l][1]
				swap(i, l)
				lift_down(l)
			end
		end
	end

	def_delegators :@array, :empty?, :size
end

n, q = gets.split.map(&:to_i)
heap = Heap.new
(1..n).each{|i|
	heap.add(i, 10000000*n + i-1)
}

q.times {
	i, d = gets.split.map(&:to_i)
	if d > 0
		heap.dec_key(i, d*n)
	else
		heap.inc_key(i, -d*n)
	end
	puts "#{heap.min_obj} #{-(heap.min_key/n-10000000)}"
}

Measured memory_bytes: 211024
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 1e6 + 5;
 
struct data
{
	int clos, op, bal;
};
 
int n;
string s[N];
int bal[N];
struct data a[N];
 
void work(int idx, string &s)
{
	stack<char> st;
	for(auto &it:s)
	{
		if(it == '(')
			st.push(it);
		else
		{
			if(st.size() && st.top() == '(')
				st.pop();
			else
				st.push(')');
		}
	}
	map<char, int> m;
	while(st.size())
	{
		m[st.top()]++;
		st.pop();
	}
	a[idx].clos = m[')'];
	a[idx].op = m['('];
	a[idx].bal = m['('] - m[')'];
}
 
bool comp(struct data &a, struct data &b)
{
	if(a.clos != b.clos)
		return a.clos < b.clos;
	return a.bal > b.bal;
}
 
int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> s[i];
		work(i, s[i]);
	}
	sort(a + 1, a + n + 1, comp);
	int have = 0;
	priority_queue<pair<int, pair<int, int> > > pq;
	int i = 1, taken = 0;
	while(taken < n)
	{
		while(i <= n)
		{
			if(a[i].clos <= have)
			{
				pq.push({a[i].op, {a[i].bal, a[i].clos}});
				i++;
			}
			else
				break;
		}
		if(pq.size())
		{
			pair<int, pair<int, int> > p = pq.top();
			pq.pop();
			taken++;
			if(p.second.second > have)
			{
				cout << "No";
				return 0;
			}
			have += p.second.first;
		}
		else
		{
			cout << "No";
			return 0;
		}
	}
	if(have != 0)
	{
		cout << "No";
		return 0;
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 82540
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))?"YES":"NO");
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

class Node {
public:
	int color;
	vector<int> next;

	Node() {
		color = 0;
	}
};

class Info {
public:
	int color;
	int next;
	Info() {}
	Info(int c, int n) {
		color = c;
		next = n;
	}
};

vector<Node> node;

signed main() {
	int N;
	cin >> N;
	
	node.resize(N);

	int a, b;
	rep(i, N - 1) {
		cin >> a >> b;
		a--; b--;
		node[a].next.push_back(b);
		node[b].next.push_back(a);
	}

	queue<Info> q;
	q.push(Info(1, 0));
	q.push(Info(-1, N - 1));
	node[0].color = 1;
	node[N - 1].color = -1;
	while (!q.empty()) {
		Info info = q.front(); q.pop();

		for (int next : node[info.next].next) {
			if (node[next].color != 0) continue;
			node[next].color = info.color;
			q.push(Info(info.color, next));
		}
	}

	int cnt1 = 0, cnt2 = 0;
	rep(i, N) {
		if (node[i].color == 1) cnt1++;
		else cnt2++;
	}

	cerr << "cnt1:" << cnt1 << " cnt2:" << cnt2 << endl;

	if (cnt1 > cnt2) {
		cout << "Fennec" << endl;
	} else {
		cout << "Snuke" << endl;
	}

    return 0;
}


Measured memory_bytes: 9344
//Totka hai dosto
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
using ld=long double;
ld pi=acos(-1);
int32_t main()
{
	int a,b;
	cin>>a>>b;
	int h,m;
	cin>>h>>m;
	
	ld angh=m*(pi/(ld)360)+h*(pi/(ld)6);
	ld angm=m*(pi/30);
	
	ld diff=max(angm,angh)-min(angm,angh);
	
	ld ans=b*b+a*a-2*a*b*cos(diff);
	ans=sqrt(ans);
	cout<<fixed<<setprecision(12)<<ans;
	
}

Measured memory_bytes: 4160
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007

void solve()
{
	ll a,b,c;
	cin>>a>>b>>c;
	if(a==b+c or b==c+a or c==a+b)
		cout<<"Yes";
	else
		cout<<"No";
	return;
}

int main()
{
	fast;
	ll q=1;
	// cin>>q;
	while(q--)
		solve();
	return 0;
}



Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    long long n;
    cin >> n;
    if(n%2 == 0){
        cout << n << endl;
    }
    else{
        cout << 2*n << endl;
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


MOD = int(1e09) + 7


def main():
    # sys.stdin = open("sample.txt")
    N, M = Scanner.map_int()

    class Edge():
        def __init__(self, a, b, c):
            self.from_ = a
            self.to_ = b
            self.cost_ = c
    edges = [] * M
    for _ in range(M):
        a, b, c = Scanner.map_int()
        a -= 1
        b -= 1
        edges.append(Edge(a, b, c))
    d = [[int(1e09) for _ in range(N)] for _ in range(N)]
    for e in edges:
        d[e.from_][e.to_] = e.cost_
        d[e.to_][e.from_] = e.cost_
    for i in range(N):
        d[i][i] = 0
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    visited = [False] * M
    for s in range(N):
        for i, e in enumerate(edges):
            if d[s][e.from_] + e.cost_ == d[s][e.to_]:
                visited[i] = True
            if d[s][e.to_] + e.cost_ == d[s][e.from_]:
                visited[i] = True
    print(visited.count(False))


if __name__ == "__main__":
    main()


Measured memory_bytes: 42436
#include <bits/stdc++.h>
#define INF 1001001001001001001
typedef long long ll;
using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		p[i]--;
	}
	vector<int> c(n);
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	ll ans = -INF;
	for (int st = 0; st < n; st++) {
		ll score = 0, sum = 0;
		int pos = st;
		vector<int> s;
		while (1) {
			pos = p[pos];
			s.push_back(c[pos]);
			sum += c[pos];
			if (pos == st) {
				break;
			}
		}
		int sz = s.size();
		if (sz >= k) {
			for (int i = 0; i < k; i++) {
				score += s[i];
				ans = max(ans, score);
			}
		} else {
			for (int i = 0; i < sz; i++) {
				score += s[i];
				ll now = score;
				if (sum > 0) {
					int cnt = (k - i - 1) / sz;
					now += cnt * sum;
				}
				ans = max(ans, now);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int N,Q;
  while(cin>>N>>Q,N+Q){
    int date[200];
    fill(date,date+200,0);
    rep(i,N){
      int m;
      cin>>m;
      rep(j,m){
	int a;
	cin>>a;
	date[a]++;
      }
    }
    int maxi = -1;
    int day = -1;
    rep(i,100){
      if(maxi<date[i]){
	day = i;
	maxi = date[i];
      }
    }
    if(maxi>=Q)cout<<day<<endl;
      else cout<<"0"<<endl;
    }
  }

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

int main() {
  string str = "Hello";

  char c ;
  
  cin >> c ;
  
  if(c == 'a' || c=='i' || c== 'u' || c=='e' ||c=='o'){
   cout << "vowel" << endl; 
  }else{
   cout << "consonant" << endl; 
  }
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>

#define nl "\n"

using namespace std;

double n, d, x;

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

    cout << ceil(n/((2*d)+1));

}

//g++ -std=c++14 comp.cpp -o b; ./b.exe


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

int main()
{
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if ( (i < b && j < a) || (i >= b && j >= a) ) cout << 0;
      else cout << 1;
    }
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 1280
function main()
    N = parse(Int, readline())
    A = []
    for i ∈ 1:N
        a = parse(Int,  readuntil(stdin, " "))
        append!(A, [a])
    end

    sum = 0
    accumulated = 0
    for i ∈ 2:N
        accumulated = mod(accumulated + A[i-1], 7+10^9)
        sum = mod(sum + accumulated * A[i], 7+10^9)
    end

    println(mod(sum, 7+10^9))
end

main()


Measured memory_bytes: 213808
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let S: String = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    };

    let ans = match &*S {
        "Sunny" => "Cloudy",
        "Cloudy" => "Rainy",
        "Rainy" => "Sunny",
        &_ => ""
    };

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[233];
int main()
{
	ios_base::sync_with_stdio(false);
	cin>>n;n*=2;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1);
	int ans=0;
	for(int i=1;i<=n;i+=2)ans+=a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,K;
  cin >> N >> K;
  vector<long long> a(N),b(N);
  vector<pair<long long,long long>> q(N);
  for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
  for(int i=0;i<N;i++){q[i]=make_pair(a[i],b[i]);}
  sort(q.begin(),q.end());
  for(int i=0;i<N;i++){
    K-=q[i].second;
    if(K<=0){cout << q[i].first << endl; return 0;}
  }
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int main() {
    long long a, b, x;
    cin >> a >> b >> x;
    if (x > b && a != 0)
    {
        cout << 0;
        return 0;
    }
    if (x > b && a == 0)
    {
        cout << 1;
        return 0;
    }
    long long k = a / x;
    if (a % x != 0)
        k++;
    long long t = b / x;
    cout << t - k + 1;
}

Measured memory_bytes: 888
/*
勉強させて頂いた解説
https://k-prism.hatenablog.com/entry/2019/07/22/110814
https://img.atcoder.jp/agc036/editorial.pdf
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)

int main(){
    ll s,v=1e9;
    cin>>s;
    ll y=(s+(v-1))/v;
    ll x=v*y-s;
    cout<<"0 0 "<<v<<" 1 "<<x<<" "<<y<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 3576
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define big bignum
#define lowbit(x) (x & -x)
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define R register
#define For(i, j, k) for(R int i = (j), ED = (k); i <= ED; ++i)
#define Rep(i, j, k) for(R int i = (j), ED = (k); i >= ED; --i)
#define Cross(i, j, k) for(R int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
const ll N = 100011;
const ll INF = 5e16;

string S;
ll Tong[133];

namespace IO {

	inline char gc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return (p1 == p2) && (p2 = (p1 = buf) +
			fread (buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
	}

	#define dd ch = getchar()
	inline ll read() {
		R ll x = 0; R int f = 0; R char dd;
		for (; !isdigit (ch); dd) f ^= (ch == '-');
		for (; isdigit (ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write( ll x ) {
		if (x < 0) putchar ('-'), x = -x;
		if (x > 9) write (x / 10); putchar (x % 10 | 48);
	}

	inline void wrn ( ll x ) { write (x); putchar (' '); }

	inline void wln ( ll x ) { write (x); putchar ('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn (x), wln (y); }

}

using IO::wln;
using IO::read;

int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	cin >> S;
	For ( i, 0, 3 ) ++Tong[S[i]];
	For ( i, 'A', 'Z' ) if (Tong[i] && Tong[i] != 2) 
		return puts ("No"), 0;
	return puts ("Yes"), 0;
}

/*

*/






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

typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

// cout<<fixed<<setprecision(10);

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 main(){
    int n; cin >> n;
    string p=""; 
    rep(i, n){
        char c; cin>>c;
        p+=c;
    }
    string q="";
    rep(i, n){
        char c; cin>>c;
        q+=c;
    }
    string str = "";
    rep(i, n){
        string c = std::to_string(i+1);
        str += c;
    }
    int cnt=0, pans=0, qans=0;
    do{
        if(str==p){
            pans=cnt;
        }
        if(str==q){
            qans=cnt;
        }
        cnt++;
    }while(next_permutation(str.begin(), str.end()));
    cout << abs(pans-qans) <<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main() {
	int h,w;
	cin >> h >> w;
	map<char,int> cnt;
	for(int i = 0; i < h; i++) {
		string s;
		cin >> s;
		for(char c : s) cnt[c]++;
	}
	int c1 = 0;
	int c2 = 0;
	for(auto x : cnt) {
		if(x.second % 2) c1 ++;
		c2 += x.second / 4 * 4;
	}
	if(c1 != (h*w)%2 || c2 < (h/2*2)*(w/2*2) ) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 256
I=input
n=int
for i in range(n(input())):
  I();t=[];x=0
  for i,j in zip(map(n,I().split()[::-1]),I()[::-1]):
    for k in t:i^=k*(i^k<i)
    j=n(j);t+=[i*(j^1)];x|=(i>0)&j
  print(x)

Measured memory_bytes: 9068
#include<stdio.h>
int fx(int x){
  if(x%2==0)
    return x/2;
  else
    return 3*x+1;
}
int main(void){
  int s,i,j,ori,A[1000];
  scanf("%d",&s);
  A[0]=s;
  for(i=1;i<1000;i++){
    A[i]=fx(A[i-1]);
  }
 for(i=1;i<1000;i++){
   for(j=0;j<i;j++){
     if(A[i]==A[j]){
       printf("%d",i+1);
       ori=j;
       break;
     }
   }
   if(A[i]==A[ori])
     break;
       }
  return 0;
      }


Measured memory_bytes: 128
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * 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 * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
int main() {
    int n,m;cin >> n >> m;
    vi ans(m);
    rep(i, n) {
        int k;cin >> k;
        rep(j, k) {
            int a;cin  >> a;
            a--;
            ans[a]++;
        }
    }
    int count = 0;
    rep(i, m) if(ans[i]==n) count++;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> a1 = new ArrayList<>();
        List<Integer> a2 = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            a1.add(sc.nextInt());
        }
        for (int i = 0; i < n; i++) {
            a2.add(sc.nextInt());
        }

        int maxCount = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            for (int j = 0; j < n; j++) {
                if (j < i) {
                    count += a1.get(j);
                } else if (j == i) {
                    count += a1.get(j);
                    count += a2.get(j);
                } else {
                    count += a2.get(j);
                }
            }
            if (count > maxCount) {
                maxCount = count;
            }
        }
        System.out.println(maxCount);
    }

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()	
{
	int n,m[20],a[20][20],b[20][20];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>m[i];
		for(int j=0;j<m[i];j++)
		{
			cin>>a[i][j]>>b[i][j];
			a[i][j]--;
		}
	}
	int ans=0;
	for(int bit=0;bit<(1<<n);bit++)
	{	
		bool flag=true;
		int sum=0;
		for(int i=0;i<n;i++)
		{
			if(bit&(1<<i))sum++;
			for(int j=0;j<m[i];j++)
			{
				if(bit&(1<<i))
				{
					if((bit&(1<<a[i][j]))&&b[i][j]==0)flag=false;
					else if(!(bit&(1<<a[i][j]))&&b[i][j]==1)flag=false;
				}
			}
		}
		if(flag)ans=max(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#ifdef LOCAL
    #define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
    #define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
const int MAXN = 1e5 + 10;
int nums[MAXN], dp[MAXN], tree[MAXN];
LL n;
int lowbit(int i) {
    return i&(-i);
}
LL query(int i) {
    LL ret = 0;
    while (i > 0) {
        ret += tree[i];
        i -= lowbit(i);
    }
    return ret;
}
void add(int i) {
    while (i <= n+1) {
        tree[i]++;
        i += lowbit(i);
    }
}
LL solve(LL val) {
    for (int i = 1; i <= n; i++) {
        if (nums[i-1] >= val) dp[i] = 1;
        else dp[i] = -1;
    }
    for (int i = 1; i <= n; i++) {
        dp[i] += dp[i-1];
    }
    map<int, int> rank;
    for (int i = 0; i <= n; i++) {
        rank[dp[i]] = 0;
    }
    int cur = 1;
    for (auto& item : rank) {
        item.second = cur++;
    }
    memset(tree, 0, sizeof(tree));
    LL ret = 0;
    for (int i = 0; i <= n; i++) {
        ret += query(rank[dp[i]]);
        add(rank[dp[i]]);
    }
    return ret;
}



int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout.precision(10); cout << fixed;
#ifdef LOCAL
    freopen("../test.txt", "r", stdin);
    // freopen("../output.txt", "w", stdout);
#endif
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> nums[i];
    }
    if (n == 1) {
        cout << nums[0] << endl;
        return 0;
    }
    LL a = 1, b = 1e9;
    LL tot = n * (n+1) / 2 + 1;

    while (a < b) {
        LL mid = (a+b + 1) >> 1;
        if (solve(mid) >= tot/2) a = mid;
        else b = mid - 1;
    }
    cout << a << endl;


/*---------------------------------------Coding Space End------------------------------------------*/
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
    return 0;
}
/* author:  txingml */
/* picture is from hamayanhamayan(CF handle) */


Measured memory_bytes: 8192
try:
    while True:
        a,b,c,d,e,f=map(float,input().split())
        x=(c*e-f*b)/(a*e-d*b)
        y=(c*d-f*a)/(b*d-e*a)
        if x==0:
            x=0.000
        print(f'{x:5.3f} {y:5.3f}')
except EOFError:
    pass


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int cumsum[500001];
vector<int> idx[1<<20];

ll pow2[500001];
ll cnt0[500001];
ll dp[500000];

void init(){
    pow2[0] = 1;
    for(int i = 1; i <= 500000; i++){
        pow2[i] = pow2[i-1]*2;
        pow2[i]%=MOD;
    }
}

int zeros(int l, int r){
    return cnt0[r+1]-cnt0[l];
}

int main(){
    init();
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        cumsum[i+1] = cumsum[i]^a;
        idx[cumsum[i+1]].push_back(i);
        if(cumsum[i+1] == 0){
            cnt0[i+1] = cnt0[i]+1;
        }else{
            cnt0[i+1] = cnt0[i];
        }
    }
    
    ll ans = 0;
    if(cumsum[N] == 0){
        ans = pow2[cnt0[N]-1];
        for(int i = 1; i < (1<<20); i++){
            for(int j = 0; j < idx[i].size(); j++) dp[j] = 0;
            dp[0] = 1;
            ll add = 0;
            ll sum_dp = 1;
            for(int j = 1; j < idx[i].size(); j++){
                add += sum_dp*zeros(idx[i][j-1], idx[i][j]);
                add %= MOD;
                //add += dp[j-1]*zeros(idx[i][j-1], idx[i][j]);
                //add %= MOD;
                dp[j] = add+1;
                sum_dp += dp[j];
                sum_dp %= MOD;
            }
            for(int j = 0; j < idx[i].size(); j++) {
                ans += dp[j];
                ans %= MOD;
            }
        }
    }else{
        int i = cumsum[N];
    
        dp[0] = 1;
        ll add = 0;
        ll sum_dp = 1;
        for(int j = 1; j < idx[i].size(); j++){
            add += sum_dp*zeros(idx[i][j-1], idx[i][j]);
            add %= MOD;
            //add += dp[j-1]*zeros(idx[i][j-1], idx[i][j]);
            //add %= MOD;
            dp[j] = add+1;
            sum_dp += dp[j];
            sum_dp %= MOD;
        }
        /*
        for(int j = 0; j < idx[i].size(); j++) {
            if(idx[i][j] != N-1) ans += (dp[j]*zeros(idx[i][j], N-1));
            else ans += dp[j];
            ans %= MOD;
        }
        */
       ans = dp[idx[i].size()-1]%MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 46068
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

char lowcmp[26]="abcdefghijklmnopqrstuvwxyz";
char upcmp[26]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int utoi(char C){return C-'A';}
int ntoi(char C){return C-'0';}

int main(void){
    double n,k,ans=0;
    scanf("%lf%lf",&n,&k);
    for (double i=1; i<n+1; i=i+1){
        double tmp=i,count=0;
        while(tmp<k){
            tmp*=2;
            count++;
        }
        ans+=(1/n)*(1/pow(2,count));
    }
    printf("%.13f\n",ans);
    return 0 ;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

bool solve(ll N, const vector<ll> &a) {
    ll S = 0;
    rep(i, N) S += a[i];
    if (S % (N * (N + 1)/2) != 0) return false;
    ll num = S / (N * (N + 1)/2);
    rep(i, N) {
        ll b = a[(i+1)%N] - a[i] - num;
        if (b % N != 0 || b > 0) return false;
    }
    return true;
}


int main() {
    ll N; cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];
    if (solve(N, a)) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <math.h>
#define PI 3.1415926535
int main() {
	double a, b, c,S=0,L=0,LL=0,h=0;
	scanf("%lf %lf %lf", &a, &b, &c);
	S = (1.0/2.0)*a*b*sin((c/180)*PI);
	LL = sqrt((a*a + b*b) - 2.0 * a*b*cos((c/180)*PI));
	h = 2.0 * (1.0 / a)*S;
	L = LL + a + b;
	printf("%f %f %f", S, L, h);



	
	return 0;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    string N;
    cin >> N;
    if (N[0] == '7' || N[1] == '7' || N[2] == '7') { cout << "Yes" << endl; }
    else { cout << "No" << endl; }
}

Measured memory_bytes: 3632
class Combination:
    def __init__(self, n, mod):
        self.n = n
        self.mod = mod
        self.fac = [1 for i in range(self.n + 1)]
        self.finv = [1 for i in range(self.n + 1)]
        for i in range(2, self.n+1):
            self.fac[i] = (self.fac[i - 1] * i) % self.mod
            self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod

    def comb(self, n, m):
        return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod
        
def iparse():
    return list(map(int, input().split()))

def RLE(s):
    res = []
    prev = ""
    cnt = 0
    for e in s:
        if prev == "":
            prev = e
            cnt += 1
        elif prev == e:
            cnt += 1
        else:
            res.append((cnt,prev))
            prev = e
            cnt = 1
    res.append((cnt,prev))
    return res


if __name__ == "__main__":
    n, t = iparse()
    a = iparse()
    a.reverse()
    s = [0 for i in range(n + 1)]
    for i in range(n):
        s[i + 1] = max(s[i], a[i])
    
    res = []
    a.reverse()
    for i in range(n):
        res.append(s[n - 1 - i] - a[i])
    res.sort()
    res.reverse()
    cnt = 1
    prev = res[0]
    for i in range(1,n):
        if prev == res[i]:
            cnt += 1
    print(cnt)
    
        

Measured memory_bytes: 20320
#include "bits/stdc++.h"
using namespace std;
int main() {
	long long A, B, K;
	cin >> A >> B >> K;
	if (K <= A) A -= K;
	else {
		K -= A;
		A = 0;
		if (K <= B) {
			B -= K;
		}
		else B = 0;
	}
	cout << A << ' ' << B << endl;

}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		String t = sc.next();
		for (int i = 0; i < n; i++) {
			boolean flag = true;
			for (int j = 0; i + j < n; j++) {
				if (s.charAt(i + j) != t.charAt(j)) {
					flag = false;
					break;
				}
			}
			if (flag) {
				System.out.println(n + i);
				return;
			}
		}
		System.out.println(n * 2);
	}
}


Measured memory_bytes: 21844