akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define mi -1000
#define ma 1000
using namespace std;

void solve()
{
    ll n;
    cin >> n;
    for (ll i = mi; i < ma; i++)
    {
        for (ll j = mi; j < ma; j++)
        {
            if (pow(i, 5) - pow(j, 5) == n)
            {
                cout << i << " " << j << endl;
                return;
            }
        }
    }
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 3988
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator> 

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


template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){
    if(!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}
//---------


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //CLion Standard Input
//    ifstream in("/Users/ryo/Dropbox/competition/CompetionIDE/in.txt");
//    cin.rdbuf(in.rdbuf());

    string ss;
    cin >> ss;
    ll ans = 0;
    rep(i, 1, ss.size()){
        if(!(ss[i-1] == ss[i])) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string S;
	cin>>S;
	int ans=0;
	int i;
	for (i=0;i<S.length();i++){
		switch(S[i]){
			case '+':
				ans++;
				break;
			case '-':
				ans--;
				break;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

#define rep(i, n) for (ll i=0;i<(n); i++)

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;



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

  priority_queue< ll, vector<ll>, greater<ll> > q;

  //vector<ll> a(n);

  vector<pi> bc(m);
  
  ll bb, cc, b, c;
  ll tmp, u;
  
  rep(i, n) {
    cin >> tmp;
    q.push(tmp);
  }

  pi p;
  rep(i, m) {
    cin >> bb;
    cin >> cc;
    p = make_pair(bb, cc);
    bc.at(i) = p;
  }

  sort(bc.begin(), bc.begin());
  
  
  while (bc.size()>0) {
    b = bc.at(bc.size()-1).first;
    c = bc.at(bc.size()-1).second;
    
    while (b>0){
      u = q.top();
      if (u<c) {
	q.pop();
	q.push(c);
	b--;
      }
      else {
	b = 0;
	//q.push(u);
      }
    }
    bc.pop_back();
  }  

  ll ans = 0;
  rep(i, n) {
    ans += q.top();
    q.pop();
  }  
    
  cout << ans << endl;

  
  
}


Measured memory_bytes: 2936
#include "bits/stdc++.h"
using namespace std;

// コンテスト中のみ
//#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;
const ll INF = 1LL << 60;

ll K;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> K;
	ll now = 7;
	for (ll i = 1; i <= 1000010; i++) {
		if (now % K == 0) {
			cout << i << endl; return 0;
		}
		now *= 10; now += 7;
		now %= K;
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>

using namespace std;

int main () {

	int b1,b2,b3;
	cin >> b1 >> b2 >> b3;

	if ((b1 == 1 && b2 == 1)||b3 == 1) {
		cout << "Open" << endl;
	}
	else {
		cout << "Close" << endl;
	}

	return 0;
}

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

int main() {
  int N; cin >> N;
  string s; cin >> s;
  int r = 0, b = 0;
  for (auto c : s) {
    if (c == 'R') ++r;
    else ++b;
  }
  if (r > b) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>
#include <bitset>
#include <fstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

#define INF 1000000007ll
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )
#define SIZE 0

bool ask (ll n) {
   printf("? %lld\n", n);
   fflush(stdout);
   char res;
   cin >> res;
   return (res == 'Y');
}

int main() {
   ll n = 1, dig = 0;
   for (int i = 1 ; i <= 10 ; ++i) {
      bool res = ask(n);
      if (!res) {
         dig = i - 1;
         break;
      }
      n *= 10ll;
   }
   if (dig == 0) {
      n = 9; dig = 1;
      for (int i = 1 ; i <= 10 ; ++i) {
         bool res = ask(n);
         if (res) {
            printf("! %lld\n", dig);
            fflush(stdout);
            return 0;
         }
         n *= 10ll;
         dig *= 10;
         n += 9;
      }
      printf("! 1\n");
      fflush(stdout);
      return 0;
   }
   ll pw = pow(10, dig), num = 0;
   for (int i = dig ; i > 0 ; --i) {
      ll e = 10, s = 0;
      if (i == 1) e = 9;
      while (e - s > 1) {
         ll m = (e + s) / 2;
         ll mm = num + m * pw;
         if (ask(mm)) e = m;
         else s = m;
      } 
      if (i != 1) num += s * pow(10, i);
      else num += e * pow(10, i);
      pw /= 10;
   }
   cout << "! " << num / 10 << endl;
   return 0;
}

Measured memory_bytes: 596
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    a = list(map(int,input().split()))
    x = sum(a)/N - sum(a)//N
    if  0 <= x < 0.5:
        ch = sum(a)//N
    else:
        ch = -(-sum(a)//N)
        
    ans = 0
    for i in range(N):
        ans += (ch-a[i]) ** 2
        
    print(ans)
        
if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
# import numpy as np
# import scipy
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])
    
def main():
    ans=0
    x,y=inpm()
    if x == 1:
        ans+=300000
    elif x==2:
        ans+=200000
    elif x==3:
        ans+=100000
    if y == 1:
        ans+=300000
    elif y==2:
        ans+=200000
    elif y==3:
        ans+=100000
    if x==1 and y==1:
        ans+=400000
    print(ans)


if __name__ == "__main__":
    main()

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

const int MAX_N = 10e5;
int H, N;
int A[MAX_N];

void Main() {
  cin >> H >> N;

  ll sum = 0;
  rep(i, N) {
    cin >> A[i];
    sum += A[i];
  }

  if (sum >= H) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

int main() {
  Main();
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int main(void){
    int n;
    string s;
    std::cin >> n >> s;
    int k = 1;
    rep(i, n - 1){
        if(s.at(i) != s.at(i + 1)){
            k++;
        }
    }
    std::cout << k << std::endl;
}


Measured memory_bytes: 512
import sys
input = sys.stdin.readline

n = int(input())

if n % 2 != 0:
    print(0)
    sys.exit(0)

ans = 0
base = 1
while True:
    base *= 5
    even = base * 2
    if n < even:
        break
    ans += n // even

print(ans)


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  string s;
  cin >> s;
  string ans;
  if(s == "Sunny")
    ans = "Cloudy";
  else if(s == "Cloudy")
    ans = "Rainy";
  else
    ans = "Sunny";

  cout << ans << endl;
  
  
}


Measured memory_bytes: 256
A,B=map(int,input().split())
S=list(input())
count=0
for n in range(A):
  if S[n]!='-':
    count+=1
  else:
    break
if S[A]=='-':
  count+=1
for n in range(A+1,A+B+1):
  if S[n]!='-':
    count+=1
  else:
    break
if count==A+B+1:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
#define all(v) v.begin(), v.end()

int main(){
  ll K,T,m=0;
  cin >> K >> T;
  vector<ll> A(T);
  rep(i,T){
    cin >> A.at(i);
    m=max(m,A.at(i));
  }
  if(m<=(K+1)/2){
    cout << 0 << endl;
    return 0;
  }
  cout << (m-(K+1)/2)*2-1 << endl;
}
      

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

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

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
ll mypow(ll a, ll n) {
	if (n == 0)return 1;
	ll d = mypow(a, n / 2);
	if (n & 1)return a * d%MOD*d%MOD;
	return d * d%MOD;
}
vl fact,inv;

ll comb(ll n, ll r) {
	return fact[n] * inv[r] % MOD*inv[n - r] % MOD;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	fact.resize(n + 1);
	inv.resize(n + 1);
	fact[0] = 1;
	inv[0] = 1;
	REP(i, n) {
		fact[i + 1] = fact[i] * (i + 1);
		fact[i + 1] %= MOD;
		inv[i + 1] = mypow(fact[i + 1], MOD - 2);
	}
	ll ans = 0;
	vl cnt(n);

	FOR(i, (n + 1) / 2, n) {
		cnt[i] = fact[i] * fact[n - 1 - i] % MOD*comb(i - 1, n - 1 - i) % MOD;
	}
	FOR(i, (n + 1) / 2, n) {
		ans += i*(cnt[i] - cnt[i - 1]+MOD)%MOD;
		ans %= MOD;
	}
	cout << ans << endl;
}


Measured memory_bytes: 23680
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    s = list(input())

    is_bad = False
    for i in range(len(s) - 1):
        if int(s[i]) == int(s[i+1]):
            is_bad = True
            break

    print("Bad" if is_bad == True else "Good")


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct TEMP_OMAZINAI_ { TEMP_OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } TEMP__omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
ll my_gcd(ll a, ll b) { return b ? my_gcd(b, a%b) : a; };
void TEMP_INPUT_IMPL_() {};
template <class T, class... Args> void TEMP_INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; TEMP_INPUT_IMPL_(args...); }
void TEMP_OUTPUT_IMPL_() {};
template <class T, class... Args> void TEMP_OUTPUT_IMPL_(T dest, Args... args) { cout << dest << (sizeof...(Args) ? " " : ""); TEMP_OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; TEMP_INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define unique_v(v) v.erase(std::unique(v.begin(), v.end()), v.end()) //必ずソート後に実行
#define out(...) (TEMP_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))

// ^^^ Template ^^^ //


int main() {
	in(int, N);
	int t = 0;
	while (N--) {
		in(ll, a);
		t ^= (a & 1);
	}
	YESNO(!t);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    sc.close();
    if (a >= 10 || b >= 10) {
      System.out.println(-1);
    } else {
      System.out.println(a * b);
    }
  }
}

Measured memory_bytes: 23636
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

class Main {
static class Amap {
char[][] field;

Amap(int h, int w) {
  this.field = new char[h + 2][w + 2];
  Arrays.fill(field[0], SF);
  Arrays.fill(field[h + 1], SF);
  for (char[] line : field) {
	line[0] = SF;
	line[w + 1] = SF;
  }
}

void setField(int x, int y, char c) {
  if (dMap.containsValue(c)) c = GF;
  field[y][x] = c;
}

char getField(int[] xy) {
  return field[xy[Y]][xy[X]];
}

}

static class Tank {
Amap  map;
int[] posi = new int[2];
char  d;

Tank(Amap map) {
  this.map = map;
}

void move(char order) {
  this.d = dMap.get(order);
  int[] movePoint = move(new int[] { posi[X], posi[Y] });
  if (map.getField(movePoint) == GF) {
	posi = movePoint;
  }
}

int[] move(int[] posi) {
  if (d == '^') {
	posi[Y]--;
  } else if (d == 'v') {
	posi[Y]++;
  } else if (d == '<') {
	posi[X]--;
  } else if (d == '>') {
	posi[X]++;
  }
  return posi;
}

void order(char o) {
  if (dMap.containsKey(o)) {
	move(o);
  } else {
	shot();
  }
}

void setPosi(int x, int y, char d) {
  posi[X] = x;
  posi[Y] = y;
  this.d = d;
}

void shot() {
  int[] beam = { posi[X], posi[Y] };
  boolean isStop = false;
  while (!isStop) {
	char cf = map.getField(beam);
	switch (cf) {
	case RF:
	  map.setField(beam[X], beam[Y], GF);
	case SF:
	  isStop = true;
	  break;
	default:
	  move(beam);
	  break;
	}
  }
}
}

static final int                 X  = 0;
static final int                 Y  = 1;
private static final char        GF = '.';
private static final char        SF = '#';
private static final char        RF = '*';
private static final char        WF = '-';
private static final char        UT = '^';
private static final char        DT = 'v';
private static final char        RT = '>';
private static final char        LT = '<';

static Map<Character, Character> dMap;

static {
  dMap = new HashMap<Character, Character>();
  dMap.put('R', RT);
  dMap.put('L', LT);
  dMap.put('U', UT);
  dMap.put('D', DT);
}

public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  Amap map;
  Tank tank;
  while (in.hasNext()) {
	int t = in.nextInt();
	for (int dataSet = 0; dataSet < t; dataSet++) {
	  final int h = in.nextInt();
	  final int w = in.nextInt();
	  tank = new Tank(map = new Amap(h, w));
	  for (int y = 1; y <= h; y++) {
		String line = in.next();
		for (int x = 1; x <= w; x++) {
		  char field = line.charAt(x - 1);
		  if (dMap.containsValue(field)) {
			tank.setPosi(x, y, field);
			field = GF;
		  }
		  map.setField(x, y, field);

		}
	  }
	  int len = in.nextInt();
	  String orders = in.next();
	  for (int n = 0; n < len; n++) {
		final char order = orders.charAt(n);
		tank.order(order);
	  }
	  int[] posi = new int[2];
	  for (int y = 1; y <= h; y++) {
		posi[Y] = y;
		for (int x = 1; x <= w; x++) {
		  posi[X] = x;
		  if (tank.posi[X] == x && tank.posi[Y] == y) {
			System.out.print(tank.d);
		  } else {
			System.out.print(map.getField(posi));
		  }
		}
		System.out.println();
	  }
	  if (dataSet < t - 1) {
		System.out.println();
	  }
	}
  }
}
}

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

typedef long long ll;
using namespace std;

const ll MOD = 1e9+7;
const ll INF = 1e18+7;

int main(){
	vector<int> a(3), b(3);
	vector<int> cou(4, 0);
	for(int i = 0; i < 3; ++i){
		cin >> a[i] >> b[i];
		--a[i];
		--b[i];
		++cou[a[i]];
		++cou[b[i]];
	}
	cout << (*min_element(cou.begin(), cou.end()) != 0 && *max_element(cou.begin(), cou.end()) == 2 ? "YES" : "NO") << endl;
}


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

typedef long long ll;

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

    ll total = 0;
    bool zeroExist = false;
    int count = 0;
    int minNum = INT_MAX;
    for(int i=0;i<n;i++)
    {
        if(a[i]==0)
            zeroExist = true;

        if(a[i]<0)
            count++;
        total += abs(a[i]);
        minNum = min(minNum,abs(a[i]));
    }

    if(zeroExist || count%2==0)
        cout << total << "\n";
    else
        cout << (total - 2*minNum) << "\n";

    return 0;
}


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

int A[100'000];

int partition(int p, int r){
   int x=A[r];
   int i=p-1;
   for(int j=p; j<r; j++){
      if(A[j]<=x){
         i++;
         int tmp=A[i]; A[i]=A[j]; A[j]=tmp;
      }
   }
   int tmp=A[i+1]; A[i+1]=A[r]; A[r]=tmp;
   return i+1;
}

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

   int q=partition(0, n-1);

   for(int i=0; i<n; i++){
      if(i) cout << " ";
      if(i == q) cout << "[";
      cout << A[i];
      if(i == q) cout << "]";
   }
   cout << endl;
}


Measured memory_bytes: 3408
import sys,queue,math,copy,itertools,bisect,collections
MOD = 10**9 + 7
S = sys.stdin.readline().rstrip()
dp = [[0] * 13 for _ in range(len(S)+1)]
dp[0][0] = 1

for i in range(1,len(S)+1):
    x = S[i-1]
    if x == '?':
        for j in range(10):
            for k in range(13):
                dp[i][(k * 10 + j) % 13] += dp[i - 1][k]
    else:
        for k in range(13):
            dp[i][(k * 10 + int(x)) % 13] += dp[i - 1][k]
    for j in range(13):
        dp[i][j] %= MOD

print (dp[-1][5])


Measured memory_bytes: 63960
#include<bits/stdc++.h>
   using namespace std;
   int main()
   {
   ios::sync_with_stdio(0);
   cin.tie(0);
   int n;
   cin>>n;
   long  arr[n];
   
   long sum=0;
   for(int i=0;i<n;i++)
   {
   cin>>arr[i];
   sum^=arr[i];
   }
   
   for(int i=0;i<n;i++)
   {
       long  x=sum^arr[i];
       cout<<x<<endl;
   }
   return 0;
   }

Measured memory_bytes: 5144
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {

    int N;
    String[] S;

    private void solve() {
        N = nextInt();
        S = new String[N];

        long m = 0;
        long a = 0;
        long r = 0;
        long c = 0;
        long h = 0;

        for(int i = 0;i < N;i++) {
            S[i] = next();

            switch(S[i].charAt(0)) {
                case 'M':
                    m++;
                    break;
                case 'A':
                    a++;
                    break;
                case 'R':
                    r++;
                    break;
                case 'C':
                    c++;
                    break;
                case 'H':
                    h++;
                    break;
                default:
                    break;

            }
        }

        long ans = 0;
        ans += m * a * r;
        ans += m * a * c;
        ans += m * a * h;
        ans += m * r * c;
        ans += m * r * h;
        ans += m * c * h;
        ans += a * r * c;
        ans += a * r * h;
        ans += a * c * h;
        ans += r * c * h;

        out.println(ans);
    }
    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 35080
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
  
int main() {
  int n;cin>>n;
   vector<int> a(n);
   for(int i=0;i<n;i++){
   	cin>>a.at(i);
   }
   for(int i=n-1;i>=0;i--){
   	cout<<a.at(i);
    if(i!=0){
    cout<<" ";
    }
   }
  cout<<endl;
}


Measured memory_bytes: 3108
from math import gcd

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            if i == j and j == k:
                ans += i
            elif i == 1 or j == 1 or k == 1:
                ans += 1
            else:
                ans += gcd(gcd(i , j), k)

print(ans)

Measured memory_bytes: 68016
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
a = LIST()

if min(a) >= 0:
	print(N-1)
	for i in range(1, N):
		print(i, i+1)
elif max(a) <= 0:
	print(N-1)
	for i in range(N, 1, -1):
		print(i, i-1)
else:
	print(2*N-1)
	if abs(min(a)) < abs(max(a)):  # max(a)を加える
		idx = a.index(max(a))+1
		for i in range(1, N+1):
			print(idx, i)
			a[i-1] += a[idx-1]
		for i in range(1, N):
			print(i, i+1)
	else:
		idx = a.index(min(a))+1
		for i in range(1, N+1):
			print(idx, i)
			a[i-1] += a[idx-1]
		for i in range(N, 1, -1):
			print(i, i-1)


Measured memory_bytes: 4032
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){

	int n;
	
	cin>>n;
	
	while(n--){
		
		string ord, mes;
		
		cin>>ord>>mes;
		reverse(ord.begin(), ord.end());
		int m=mes.size();
		
		for(int i=0; i<ord.size(); ++i){
			
			char c=ord[i];
			
			if(c=='J'){
				rotate(mes.begin(), mes.end()-1, mes.end());
			}
			else if(c=='C'){
				rotate(mes.begin(), mes.begin()+1, mes.end());
			}
			else if(c=='E'){
				
				if(m%2==1)
					mes = mes.substr(m/2+1) + mes[m/2] + mes.substr(0,m/2);
				else
					mes = mes.substr(m/2) + mes.substr(0,m/2);
			}
			else if(c=='A'){	
				reverse(mes.begin(), mes.end());
			}
			else if(c=='M'){
				
				for(int i=0; i<m; ++i){
					if('0'<=mes[i] && mes[i]<='9')
						mes[i] = mes[i]=='9'?'0':(mes[i]+1);
				}
			}
			else if(c=='P'){
				
				for(int i=0; i<m; ++i){
					if('0'<=mes[i] && mes[i]<='9')
						mes[i] = mes[i]=='0'?'9':(mes[i]-1);
				}
			}
		}
		
		cout << mes << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1224
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int n,pre[maxn],suf[maxn];
char s[maxn];

int main()
{
	n=read(); scanf("%s",s+1);
	int ans=inf;
	for(int i=1;i<=n;i++) pre[i]=pre[i-1]+(s[i]=='W');
	for(int i=n;i>=1;i--) suf[i]=suf[i+1]+(s[i]=='E');
	for(int i=1;i<=n;i++) ans=min(ans,pre[i-1]+suf[i+1]); cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5760
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
using namespace std;
#define sorted(a) sort(a.begin(), a.end());
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long unsigned int ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int N, K;
  cin >> N >> K;
  vector<int> H(N, 0);
  for (int i = 0; i < N; ++i) {
    cin >> H[i];
  }

  vector<ll> dp(N, 1000000000);
  dp[0] = 0;
  for (int i = 1; i < N; ++i) {
    int k = max(0, i - K);
    for (int j = k; j < i; ++j) {
      dp[i] = min(dp[i], abs(H[i] - H[j]) + dp[j]);
    }
  }
  cout << dp[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

const int m = 40000;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++)
    {
        a[i] = m * (i + 1);
        b[i] = m * (n - i - 1) + 1;
    }
    for (int i = 0; i < n; i++)
    {
        a[p[i] - 1] += i;
    }
    for (auto ans : a)
    {
        cout << ans << ' ';
    }
    cout << endl;
    for (auto ans : b)
    {
        cout << ans << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 896
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<pair<double, int>,pair<int, int> > P;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

struct Edge{
  int to,d,c;
  Edge(int to, int d, int c):to(to),d(d),c(c){}
};

int N,M;
vector<Edge>G[32];
double dist[32][32][32];

void dijkstra(int s){
  rep(i,32) rep(j,32) rep(k,32)dist[i][j][k] = INF;
  priority_queue<P, vector<P>, greater<P> >q;
  dist[0][s][31] = 0.0;
  q.push(MP(MP(0.0, 0),MP(s, 31)));
  
  while(!q.empty()){
    P p = q.top(); q.pop();
    int d = p.first.first, speed = p.first.second, cur = p.second.first, prev = p.second.second;
    if(dist[speed][cur][prev] < d) continue;
    //    cout << speed << " " << cur << " " << dist[speed][cur][prev] << endl;
    for(int d=-1;d<=1;d++){
      int sp = speed+d;
      if(sp <= 0 || sp > 30) continue;
      rep(i,G[cur].size()){
	Edge e = G[cur][i];
	if(e.to == prev) continue;
	//	cout << dist[speed][cur][prev] << " " << (double)e.d/(double)sp << endl;
	if(sp <= e.c && dist[sp][e.to][cur] > dist[speed][cur][prev] + (double)e.d/(double)sp){
	  dist[sp][e.to][cur] = dist[speed][cur][prev] + (double)e.d/(double)sp;
	  //	  cout << dist[sp][e.to][cur] << endl;
	  q.push(make_pair(make_pair(dist[sp][e.to][cur], sp), make_pair(e.to, cur)));
	}
      }
    }
  }
}

int main(){
  while(scanf("%d%d",&N,&M) && N||M){
    rep(i,32) G[i].clear();
    int s, g;
    scanf("%d%d",&s,&g); s--; g--;
    rep(i,M){
      int x,y,d,c;
      scanf("%d%d%d%d",&x,&y,&d,&c); x--;y--;
      G[x].push_back(Edge(y,d,c));
      G[y].push_back(Edge(x,d,c));
    }

    dijkstra(s);

    /*    rep(i, 10){
      rep(j,N) cout << (dist[i][j]==INF?-1:dist[i][j]) << " ";
      cout << endl;
      }*/
    double res = INF;
    rep(i,32) res = min(res, dist[1][g][i]);
    //    rep(i,10) cout << dist[i][g] << " "; cout << endl;
    if(res>INF-1) puts("unreachable");
    else printf("%.12lf\n", res);
  }
  return 0;
}

Measured memory_bytes: 1960
#include <bits/stdc++.h>
using namespace std;
map<int,int>mp;
int main(){
	//freopen("readin.txt","r",stdin);
	int n;
	scanf("%d",&n);
	while(n--){
		int a;
		scanf("%d",&a);
		mp[a]++;
	}
	int ans = 0,count = 0;
	int one = -1,two = -1;
	for(map<int,int>::iterator i = mp.begin();i != mp.end();i++){
		if(i->second >= 2)one = i->first;
	}
	if(one == -1)return puts("0"),0;
	mp[one]-=2;
	for(map<int,int>::iterator i = mp.begin();i != mp.end();i++){
		if(i->second >= 2)two = i->first;
	}
	if(two == -1)return puts("0"),0;
	cout << (long long)one*two << endl;
}

Measured memory_bytes: 4992
N, H = [int(_) for _ in input().split()]
katana = [[int(_) for _ in input().split()] for _ in range(N)]

katana.sort(key=lambda x:x[1], reverse=True)
a_max_katana = max(katana)

a_max = a_max_katana[0]
a_max_b = a_max_katana[1]
katana.pop(katana.index(a_max_katana))

count = 0

for katana_use in katana:
    if katana_use[1] > a_max:
        H -= katana_use[1]
        count += 1
        if H > a_max_b:
            continue
        else:
            count += 1
            break
    else:
        count += (H - a_max_b) // a_max + bool((H - a_max_b) % a_max) + 1
        break

else:
    count += (H - a_max_b) // a_max + bool((H - a_max_b) % a_max) + 1

print(count)



Measured memory_bytes: 22736
import math

N = int(input())
W = []

inp = input().split(" ")

for w in range(N):
    W.append(int(inp[w]))

sub = 10**10

for t in range(N):
    low = 0
    high = 0

    for now in range(N):
        if(now>t):
            high += W[now]
        else:
            low += W[now]

    sub = min(sub,math.fabs(high-low))


print(int(sub))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n, t[51];
string s[51], x;
int main(){
    cin>>n;
    REP(i, 0, n) cin>>s[i]>>t[i];
    cin>>x;

    ll sum=0;
    bool sleep=false;
    REP(i, 0, n){
        if(sleep) sum+=t[i];

        if(s[i]==x) sleep=true;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        return;
    }

    public static string Solve()
    {
        int ans = 0;
        string S = Read();
        for (int i = 0; i < S.Length; i++)
        {
            if(i%2==0)
            {
                if(S[i]-'0'==0)
                {
                    ans++;
                }
            }
            else
            {
                if (S[i] - '1' == 0)
                {
                    ans++;
                }
            }
        }
        ans = Math.Min(ans, S.Length - ans);
        return ans.ToString();
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


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

int main()
{
  int H,W,h,w,black=0;
  scanf("%d%d%d%d",&H,&W,&h,&w);
  
  black+=h*W;
  black+=H*w;
  black-=h*w;
  
  printf("%d\n",((H*W)-black));
  
  return 0;
}

Measured memory_bytes: 256
N, C = map(int, input().split())
D = [list(map(int, input().split())) for _ in range(C)]
c_map = [list(map(int, input().split())) for _ in range(N)]
count = [[0]*C for _ in range(3)]
for i in range(N):
    for j in range(N):
        c = c_map[i][j]
        amari = (i+j)%3
        count[amari][c-1]+=1
ans = float('inf')
for i in range(C):
    for j in range(C):
        for k in range(C):
            tmp = 0
            if i == k or j == k or i==j:
                continue
            else:
                for l in range(C):
                    tmp+=count[0][l]*D[l][i]
                    tmp+=count[1][l]*D[l][j]
                    tmp+=count[2][l]*D[l][k]
            ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 45532
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int N=2e5+10;
const ll P=1e9+7;
vector<int>g[N];
struct node{ll z0,z1,z2;};
vector<node>dp[N];
int num[N],cnt;
ll pwr(ll x,ll y){
	ll z=1;
	for(;y;y>>=1){
		if(y&1)z=z*x%P;
		x=x*x%P;
	}
	return z;
}
node add(node u,node v){
    node w;
    w.z0=u.z0*v.z0%P;
    w.z1=(u.z0*v.z1%P+u.z1*v.z0%P)%P;
    w.z2=(u.z0*v.z2%P+u.z1*v.z1%P+u.z1*v.z2%P+u.z2*v.z0%P+u.z2*v.z1%P+u.z2*v.z2%P)%P;
    return w;
}
inline void merge(int &x,int y){
    if(dp[x].size()<dp[y].size())swap(x,y);
    for(int i=0;i<dp[y].size();i++)
        dp[x][dp[x].size()-i-1]=add(dp[x][dp[x].size()-i-1],dp[y][dp[y].size()-i-1]);
}
int dep[N],siz[N];
int main(){
    int n;
	scanf("%d",&n);
    ++n;//<- n=n+1
    for(int k=2;k<=n;++k){
        int x;
		scanf("%d",&x);
        ++x;
        g[x].pb(k);
    }
	siz[dep[1]]=1;
	for(int x=1;x<=n;++x){
		for(int i=g[x].size()-1;~i;--i){
			int k=g[x][i];
			dep[k]=dep[x]+1;
			++siz[dep[k]];
		}
	}
    for(int i=n;i;--i){
        if(g[i].empty())
            num[i]=++cnt;
        else{
            num[i]=num[g[i][0]];
            int mx=0;
            for(int j=1;j<g[i].size();++j){
                mx=max(mx,(int)min(dp[num[i]].size(),dp[num[g[i][j]]].size()));//找次大值
                merge(num[i],num[g[i][j]]);
            }
            for(int j=dp[num[i]].size()-mx;j<dp[num[i]].size();j++){
                dp[num[i]][j].z0=(dp[num[i]][j].z0+dp[num[i]][j].z2)%P;
                dp[num[i]][j].z2=0;
            }
        }
        dp[num[i]].pb((node){1,1,0});
    }
    ll ans=0;
    for(int i=0;i<dp[num[1]].size();++i)
		(ans+=dp[num[1]][i].z1*pwr(2,n-siz[dp[num[1]].size()-i-1]))%=P;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 25840
n = int(input())
a = list(map(int, input().split()))

odd = 0
even = 0
four = 0
for i in a:
    if i % 4 == 0:
        four += 1
    elif i % 2 == 0:
        even += 1
    else:
        odd += 1

if four >= odd or four == odd-1 and even == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 62576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define len(arr) (int)(sizeof(arr)/sizeof((arr)[0]))
#define Sort(arr) sort(arr,arr+len(arr))
#define For(i,s,n) for(int i=s;i<n;i++)	
#define Rep(i,n) for(int i=0;i<n;i++)
#define Per(i,n) for(int i=n;i>=0;i--)
#define All(x) (x).begin(),(x).end()
#define in(arr,n) Rep(i,n) cin >> arr[i];
#define in2(arr1,arr2,n) Rep(i,n) cin >> arr1[i] >> arr2[i];
#define in3(arr1,arr2,arr3,n) Rep(i,n) cin >> arr1[i] >> arr2[i] >> arr3[i];
#define LL_MAX 9223372036854775807
#define LL_MIN -9223372036854775808
#define MOD 1000000007
#define MOD9 1000000009

//{ ライブラリ

// 標準出力の高速化
#define endl "\n"

// 出力
template<typename Type>
void print(Type a[],int n){
	Rep(i,n) cout << a[i] << endl;
}
template<typename Type1,typename Type2>
void print(Type1 a[],Type2 b[],int n){
	Rep(i,n) cout << a[i] << " " << b[i] << endl;
}
template<typename Type1,typename Type2,typename Type3>
void print(Type1 a[],Type2 b[],Type3 c[],int n){
	Rep(i,n) cout << a[i] << " " << b[i] << " " << c[i] << endl;
}

// 配列の最大値
template<typename Type>
Type max(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=max(ret,a[i]);
	return ret;
}

// 配列の最小値
template<typename Type>
Type min(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=min(ret,a[i]);
	return ret;
}

// 最大公約数
template<typename Type>
Type gcd(Type a,Type b){return(b==0)?a:gcd(b,a%b);}
template<typename Type>
Type gcd(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=gcd(ret,a[i]);
	return ret;
}

// 最小公倍数
template<typename Type>
Type lcm(Type a,Type b){return (a/gcd(a,b))*b;}
template<typename Type>
Type lcm(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=lcm(ret,a[i]);
	return ret;
}

// aを元にしてペアでソート
template<typename Type1,typename Type2>
void PairSort(Type1 a[],Type2 b[],int left,int right){
	int i=left,j=right;
	Type1 p=a[(left+right)/2];
	while(true){
		while(a[i]<p) i++;
		while(p<a[j]) j--;
		if(i>=j) break;
		swap(a[i],a[j]);
		swap(b[i],b[j]);
		i++;j--;
	}
	if(left<i-1) PairSort(a,b,left,i-1);
	if(j+1<right) PairSort(a,b,j+1,right);
}
template<typename Type1,typename Type2,typename Type3>
void PairSort(Type1 a[],Type2 b[],Type3 c[],int left,int right){
	int i=left,j=right;
	Type1 p=a[(left+right)/2];
	while(true){
		while(a[i]<p) i++;
		while(p<a[j]) j--;
		if(i>=j) break;
		swap(a[i],a[j]);
		swap(b[i],b[j]);
		swap(c[i],c[j]);
		i++;j--;
	}
	if(left<i-1) PairSort(a,b,c,left,i-1);
	if(j+1<right) PairSort(a,b,c,j+1,right);
}

// 配列を逆順にする
template<typename Type>
void Reverse(Type a[],int n){Rep(i,n/2) swap(a[i],a[n-i-1]);}

// 文字列を逆順にする
// reverse(All(str));

//}

int main(){
	int a;
	string s;
	cin >> a >> s;
	
	if(a>=3200) cout << s;
	else cout << "red";
}

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

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

    int now_price;
    if (2*c - a - b <= 0){
        if (x > y and a < 2*c) now_price = 2*c*y + (x-y)*a;
        else if (x > y) now_price = 2*c*x;
        else if (x <= y and b < 2*c) now_price = 2*c*x + (y-x)*b;
        else now_price = 2*c*y;
    }else{
        now_price = a*x + b*y;
    }
    cout << now_price << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N;
vector<int> A;


int main(){
  cin>>N;
  A.resize(N);
  for(int i=0;i<N;i++) cin>>A[i];

  vector<int> B;
  B.resize(N);
  B[0]=A[0];
  for(int i=1;i<N;i++) B[i]=B[i-1]^A[i];
  
  vector<ll> dp((1<<20),1ll),sum((1<<20),0ll);
  vector<ll> zero((1<<20),0ll);

  int z=0;
  for(int i=0;i<N;i++){
      if(B[i]==0) z++;
      else{
          dp[B[i]]=(dp[B[i]]+sum[B[i]]*(z-zero[B[i]])%MOD)%MOD;
          dp[B[i]]=(dp[B[i]]+MOD)%MOD;
          sum[B[i]]=(sum[B[i]]+dp[B[i]])%MOD;
          zero[B[i]]=z;
      }
  }

  if(B.back()!=0) cout<<dp[B.back()]<<endl;
  else{
      ll ans=1;
      for(int i=1;i<z;i++) ans=ans*2%MOD;
      for(int i=0;i<(1<<20);i++) ans=(ans+sum[i])%MOD;
      
      cout<<ans<<endl;
  }


  return 0;
}


Measured memory_bytes: 28800
#include <bits/stdc++.h>
using namespace std;
long int H;

int main(){
    cin >> H;
    long int attack_count = 0;
    int count = 0;

    while( H > 0){
        attack_count += pow(2,count);
        count++;
        H = H/2;
    }
    cout << attack_count <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int num[3];
int main(){
    while(cin>>s){
        memset(num,0,sizeof(num));
        for(int i=0;s[i];++i)
            ++num[s[i]-'a'];
        int len=s.length();
        int a=0;
        for(int i=0;i<3;++i) a+=num[i]!=0;
        sort(num,num+3);
        if(a==1) {
            if(len==1) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }else if(a==2){
            if(num[2]==1 && num[1]==1) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }else if(a==3){
            if(num[2]==num[1]+1 && num[1]==num[0]+1) cout<<"NO"<<endl;
            else if(num[2]<=num[1]+1 && num[1]<=num[0]+1) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 512
N=int(input())
A=list(map(int, input().split()))
x=[0 for _ in range(N)]
for i in range(N):
    if i%2==0:
        x[0]+=A[i]
    else:
        x[0]-=A[i]
x[0]=x[0]//2
for i in range(1, N):
    x[i]=-x[i-1]+A[i-1]
print(" ".join(map(str, map(lambda t:t*2, x))))

Measured memory_bytes: 85092
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;



public class Main {

	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		HashMap<Integer, ArrayList<Integer>> graph = new HashMap<>();
		HashMap<Integer, Integer> val = new HashMap<>();
		HashMap<Integer, Integer> ans = new HashMap<>();
		for (int i=1;i<=n;i++) {
			graph.put(i, new ArrayList<Integer>());
			val.put(i, 0);
		}
		
		for (int i=0;i<n-1;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			graph.get(a).add(b);
			graph.get(b).add(a);
		}
		
		for (int i=0;i<q;i++) {
			int p = sc.nextInt();
			int x = sc.nextInt();
			val.put(p,val.get(p)+x);
		}
		dfs (graph, val, ans, 1, 0);
		
		String[] str = new String[n];
		for (int i=0;i<n;i++) {
			str[i]=ans.get(i+1).toString();
		}
		System.out.println(String.join(" ", str));
		
	}
	
	static void dfs (HashMap<Integer, ArrayList<Integer>> graph, HashMap<Integer, Integer> val,
			HashMap<Integer, Integer> ans, int pos, int tmpVal) {
		tmpVal += val.get(pos);
		ans.put(pos, tmpVal);
		for (Integer intg : graph.get(pos)) {
			if (!ans.containsKey(intg)) {
				dfs (graph, val, ans, intg, tmpVal);
			}
		}
	}
	
}







Measured memory_bytes: 250628
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X, Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%(m))
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int N;
string S;

int main() {
    cin >> N;
    cin >> S;

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if ("ABC" == S.substr(i, 3)) ++ans;
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int A,B,X;
  cin >>A >>B >>X;
  if(A>X){
    cout <<"NO" <<endl;
    return 0;
  }
  else{
    if(A+B<X){
      cout <<"NO" <<endl;
      return 0;
    }
  }
  cout <<"YES" <<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

/*
  https://oeis.org/A003631
  "Primes congruent to 2 or 3 modulo 5"

  http://mathworld.wolfram.com/Wall-Sun-SunPrime.html
  "Wall-Sun-SunPrime"

  数論を理解したい。
 */

 
int fibmod(int*a,int*b,int n,int p){
  int x,y,tx,ty,F0,F1,tF0,tF1;
  y=0;
  x=F0=F1=1;
  --n;
  while(n){
    if(n&1){
      tx = x;
      ty = y;
      x  = (F1*tx+F0*ty)%p;
      y  = (F0*tx+(F1-F0)*ty)%p;
    }
    n>>=1;

    tF1=F1%p;
    tF0=F0%p;
    F1 = tF1 * tF1 %p + tF0 * tF0  %p;
    F0 = tF1 * tF0 %p + tF0 * (tF1-tF0) %p;
  }

  *a=x;
  *b=y;
  return 0;
}


int main(){
  int i,j,a,b,N;

  scanf("%d",&N);
  for(i=3;N;i+=10){
    fibmod(&a,&b,i,i);
    if(a*b%i==i-1){
      printf("%d ",i);
      --N;
    }
  }
}

Measured memory_bytes: 128
s = input()
k = int(input())
ans = ""
for i in s:
    if k >= (123 - ord(i)) % 26:
        k -= (123 - ord(i)) % 26
        ans += "a"
    else:
        ans += i
print(ans[:-1] + chr((ord(ans[-1]) - 97 + k) % 26 + 97))

Measured memory_bytes: 9384
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for (int i = 0; i < n; i++) {
			int k = sc.nextInt();
			for (int j = 0; j < k; j++) {
				int a = sc.nextInt();
				if (map.containsKey(a)) {
					int val = map.get(a);
					val++;
					map.put(a, val);
				} else {
					map.put(a, 1);
				}
			}
		}
		sc.close();

		int ans = 0;
		for (int val : map.values()) {
			if (val == n) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23516
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  int count = 0;
  int a;
  for (int i=0;i<n; i++) {
    cin >>a;
    if(a % 2) 
      count++;
  }
  
  if (count % 2) {
    cout<<"NO";
  } else {
    cout<<"YES";
  }
 return 0;
}

Measured memory_bytes: 3584