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

int main(){
    string s;
    cin >> s;
    vector<int> rl;
    vector<int> lr;
    lr.push_back(-1);
    for(int i = 0; i < s.length() - 1; i++){
        if(s[i] == 'R' && s[i + 1] == 'L') rl.push_back(i);
        else if(s[i] == 'L' && s[i + 1] == 'R') lr.push_back(i);
    }
    lr.push_back(s.length() - 1);
    int out[s.length()] = {};
    for(int i = 0; i < rl.size(); i++){
        int l = lr[i];
        int m = rl[i];
        int r = lr[i + 1];
        out[m] = (m - l + 1) / 2 + (r - m) / 2;
        out[m + 1] = (r - l) - out[m];
    }
    for(int i = 0;  i < s.length(); i++){
        cout << out[i] << ' ';
    }
}

Measured memory_bytes: 1532
#include <cstdio>
 #include <cstdlib>
 #include <iostream>
 #include <fstream>
 #include <sstream>
 #include <set>
 #include <map>
 #include <vector>
 #include <list>
 #include <algorithm>
 #include <cstring>
 #include <cmath>
 #include <string>
 #include <stack>
 #include <queue>
 #include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
 #include <cassert>
 #include <iomanip>        //do setprecision
 #include <ctime>
 #include <complex>
 using namespace std;

 #define FOR(i,b,e) for(int i=(b);i<(e);++i)
 #define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
 #define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
 #define REP(x, n) for(int x = 0; x < (n); ++x)

 #define ST first
 #define ND second
 #define PB push_back
 #define PF push_front
 #define MP make_pair
 #define LL long long
 #define ULL unsigned LL
 #define LD long double
 #define pii pair<int,int>
 #define pll pair<LL,LL>

 const double pi = 3.14159265358979323846264;
 const int mod=1000000007;

int main(){
	string ans[2]={"first","second"};
	int n,a[101010]={};
	cin>>n;
	int f=1;
	FOR(i,0,n){
		cin>>a[i];
		if(a[i]%2==1)f=0;
	}
	cout<<ans[f]<<endl;

  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main()
{
  int n, x, i, j, k, count;
  while (true) {
    count = 0;
    scanf("%d %d", &n, &x);
    if (n == 0 && x == 0) break;
    if (n >= 3 && n <= 100) {
      if (x >= 0 && x <= 300) {
        for (i = 1; i <= n; i++) {
          for (j = i + 1; j <= n; j++) {
            for (k = j + 1; k <= n; k++) {
              if (i + j + k == x) count++;
            }
          }
        }
      }
      printf("%d\n", count);
    }
  }
}



Measured memory_bytes: 2708
/*input
5 25000
20 1000
40 1000
50 1000
30 1000
1 1000
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int d, g; cin >> d >> g;
    int best = INF32;
   	vector<int> p(d);
   	vector<int> c(d);
   	for(int i = 0; i < d; i++) cin >> p[i] >> c[i];
   	for(int i = 0; i < (1<<d); i++)
   	{
   		int sum = 0;
   		int cnt = 0;
   		for(int j = 0; j < d; j++) if((i>>j) & 1)
   		{
   			sum += p[j] * (j + 1) * 100 + c[j];
   			cnt += p[j];
   		}
   		if(sum >= g)
   		{
   			best = min(best, cnt);
   			continue;
   		}
   		//g = 2000
   		//sum = 1800
   		for(int j = d - 1; j > -1; j--) if(!((i>>j) & 1))
   		{
   			//j = 0
   			int sum2 = sum;
   			sum += min((g - sum2)/(100 * (j + 1)) + ((g - sum2) % (100 * (j + 1)) != 0), p[j]) * 100 * (j + 1);
   			cnt += min((g - sum2)/(100 * (j + 1)) + ((g - sum2) % (100 * (j + 1)) != 0), p[j]);
   			if(sum >= g)
   			{
   				best = min(best, cnt);
   				break;
   			}
   		}
   	}
   	cout << best;

    return 0;
}

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

int main() {
	int d;
	cin >> d;
	const int n = 26;
	vector<int> c(n);
	vector<vector<int>> s(d, vector<int>(n));
	rep(i, n) cin >> c[i];
	rep(i, d) rep(j, n) cin >> s[i][j];
	vector<int> t(d), last(n);
	// rep(i, d) {
	// 	cin >> t[i];
	// 	t[i]--;
	// }
	
	ll ans = 0;
	rep(i, d) {
		ll mx = -1;
		int now = 0;
		rep(j, n) {
			if(mx < s[i][j]) {
				mx = s[i][j];
				now = j;
			}
		}
		t[i] = now+1;
		ans += s[i][now];
		last[now] = i+1;
		rep(j, n) {
			ans -= c[j] * (i+1-last[j]);
		}
	}
	rep(i, d) printf("%d\n", t[i]);
	return 0;
}

Measured memory_bytes: 3772
#include<bits/stdc++.h>
#define ll long long int
#define CON 100010
//#define MOD 1e9+7
const long long mod=1e9+7;
const int INF=1001001001;
using namespace std;
int main() 
{
	int N;
	cin>>N;
	vector<ll> A(N+1);
	vector<ll> B(N);
	ll sumA,sumB;

	for(int i=0;i<N+1;i++)
	{
		cin>>A[i];
		sumA+=A[i];
	}
	for(int i=0;i<N;i++)
	{
		cin>>B[i];
		sumB+=B[i];
	}
	ll ans=0;
	for(int i=0;i<N;i++)
	{
		if(A[i]<=B[i])
		{
			ans+=A[i];
			B[i]-=A[i];
		}
		else 
		{
			ans+=B[i];
			B[i]=0;
		}
		if(A[i+1]<=B[i])
		{
			ans+=A[i+1];
			A[i+1]=0;
		}
		else
		{
			ans+=B[i];
			A[i+1]-=B[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
n=input()
num=[]
for i in range(len(n)):
    num.append(n[i])
for j in range(len(n)):
    if num[j]=="1":
        num[j]="9"
    elif num[j]=="9":
        num[j]="1"
result=""
for k in range(len(n)):
    result+=num[k]
print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++) cin >> A.at(i);
  vector<ll> memo(N, 0);
  for (int i=0; i<N; i++) {
    memo.at(A.at(i)-1)++;
  }
  ll ans = 0LL;
  for (int i=0; i<N; i++) {
    if (memo.at(i)>=2) ans += memo.at(i)*(memo.at(i)-1)/2;
  }
  for (int i=0; i<N; i++) {
    int same = memo.at(A.at(i)-1);
    if (same<2) {
      cout << ans << endl;
    }
    else if (same==2) {
      cout << ans-same*(same-1)/2 << endl;
    }
    else {
      cout << ans-(same*(same-1)/2-(same-1)*(same-2)/2) << endl;
    }
  }
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define int long long
#define ld long double
#define endl '\n'
const int mod= 1e9+7;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define trace(x) cerr << #x << " is " << x << endl;
#define all(x) x.begin(),x.end()
#define reset(x,val) memset(x,val,sizeof(x))
#define flush fflush(stdout)
#define sz(a) a.size()
#define pii pair<int,int>
using namespace std;
const int N=1e5+5;
int inc[N],dp[N],n,m;
vector<int> g[N];
void smax(int &x,int y)
{
 x=max(x,y);
}
void topo()
{
 queue<int>q;
 for(int i=1;i<=n;i++)
 {
  if(inc[i]==0)
  q.push(i);
 }
 
 while(!q.empty())
 {
  int node=q.front();
  q.pop();
  for(int nx:g[node])
  {
   inc[nx]--;
   if(inc[nx]==0)
   q.push(nx);
   
   smax(dp[nx],1+dp[node]);
   
  }
 }
}
int32_t main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
     int u,v;
     cin>>u>>v;
     g[u].pb(v);
     inc[v]++;
    }
    
    topo();
    int ans=0;
    for(int i=1;i<=n;i++)
    smax(ans,dp[i]);
    cout<<ans<<endl;    
    return 0;
}



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

bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された

    if(n%2 == 0) return false;
    if(n%3 == 0) return false;
    // 2と3の倍数でないので6の倍数ではないことが保証された

    if(n%6 != 1 && n%6 != 5) return false;
    // 6の倍数前後の数(素数かもしれない数)であることが保証された

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i=5;i*i<=n;i+=6){
        if(n%i     == 0) return false; // 6n-1
        if(n%(i+2) == 0) return false; // 6n+1
    }

    return true;
}

int main() 
{
  int a;
  cin >> a;
  while(is_prime(a)==false){
    a++;
  }
  cout << a << endl;
}

Measured memory_bytes: 256
import Control.Monad (replicateM)

solve (a,b) (c,d) [] =
  if a < c && b < d
    then (c - a) * (d - b)
    else 0

solve (a,b) (c,d) ([x,y,a']:xss)
  | a' == 1 = solve (max a x,b) (c,d) xss
  | a' == 2 = solve (a,b) (min c x,d) xss
  | a' == 3 = solve (a,max b y) (c,d) xss
  | a' == 4 = solve (a,b) (c,min d y) xss

main = do
  [w,h,n] <- fmap read <$> words <$> getLine :: IO [Int]
  xss <- fmap (fmap read) <$> fmap words <$> replicateM n getLine :: IO [[Int]]
  putStrLn . show . solve (0,0) (w,h) $ xss


Measured memory_bytes: 1020
#include <iostream>
 
 
void countingSort(int *A, int *B, int k, int n){
    int i;
    int *C;
 
    C = new int[k+1];
    for(i=0;i<k+1;i++){
        C[i] = 0;
    }
     
    for(i=0;i<n;i++){
        C[A[i]]++;
    }
    for(i=1;i<k+1;i++){
        C[i] = C[i] + C[i-1];
    }
     
    for(i=n-1;i>=0;i--){
        B[C[A[i]]-1] = A[i];
        C[A[i]] --;
    }
    delete []C;
}
 
int main(void){
    int i,n,k;
    int *A, *B;
     
    std::cin >> n;
    A = new int[n];
    B = new int[n];
    for(i=0;i<n;i++){
        std::cin >> A[i];
    }
    k = A[0];
    for(i=1;i<n;i++){
        if(A[i]>k){
            k=A[i];
        }
    }
    countingSort(A, B, k, n);
    for(i=0;i<n-1;i++){
        std::cout << B[i] << " ";
    }
    std::cout << B[i] << std::endl;
    delete []A;
    delete []B;
    return 0;
}

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

int main(){
  // 入力
  long long int N, A, B;
  cin >> N >> A >> B;
  
  long long int shou  = N/(A+B);
  long long int amari = N%(A+B);
  
  long long int result = shou*A + min(amari, A); 

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

int main() {
    int l, r, d;
    cin >> l >> r >> d;
    auto cnt = 0;
    for (auto x = l; x <= r; ++x)
        if (x % d == 0)
            cnt++;

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3616
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



int main()
{
	int a,b;
	cin >> a >> b;
	int mx = a + b;
	mx = mx > a - b ? mx : a - b;
	mx = mx > a * b ? mx : a * b;
	cout << mx << endl;
	return 0;
}



Measured memory_bytes: 256
(n,m),*s,p=[list(map(int,t.split()))for t in open(0)]
a=0
for i in range(1<<n):
 c=[0]*m
 for j in range(n*m):c[j%m]^=i>>j//m&(j//m+1in s[j%m][1:])
 a+=all(j==i for i,j in zip(c,p))
print(a)

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

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

    int ans = INT_MAX;
    for (int i = 1; i <= 100; i++) {
        int sum = 0;
        for (int j = 0; j < N; j++) {
            sum += pow(X[j] - i, 2);
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3540
import Control.Monad
import Data.Array
import qualified Data.ByteString.Char8 as BS
main=do
 [h,w,d]<-map (read.BS.unpack).BS.words<$>BS.getLine
 a<-replicateM h (map (read.BS.unpack).BS.words<$>BS.getLine)
 q<-readLn
 lr<-replicateM q (map (read.BS.unpack).BS.words<$>BS.getLine)

 mapM_ print (reverse((\arr->if d*2>=h*w then (e d arr lr 0 []) else (k lr d [] (f (h*w) d arr 1 [] [(1,0)])))(array (1,h*w) (zip (foldr (++) [] a) [(x,y)|x<-[1..h],y<-[1..w]]))))
  where f m d a i l ((x,y):n) |i==d+1    = array (1,d) l
                              |x+d>m     = f m d a (i+1) ((i,(array (1,m) ((x,y):n))):l) [(i+1,0)]
                              |otherwise = f m d a i l ((x+d,y+(g(a!x)(a!(x+d)))):((x,y):n))
        g (a,b) (c,d) = (abs (a-c))+(abs (b-d))
        k [] _ ans _ = ans
        k ([l,r]:lr) d ans pre = k lr d ((i l r (pre!((mod (l-1) d)+1))):ans) pre
        i l r a = (a!r)-(a!l)
        e _ _ [] _ s = s
        e d a ([l,r]:lr) n s =if l==r then (e d a lr 0 (n:s)) else (e d a ([l+d,r]:lr) (n+(g(a!(l+d))(a!l))) s)

Measured memory_bytes: 247932
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int, int>;
typedef vector<int> vi;

int main() {
  ll a;
  double b;
  cin >> a >> b;
  ll int_b = b*100+0.1; // 切り捨てで壊れないよに
  a *= int_b;
  a /= 100;
  printf("%lld\n", a);
  return 0;
}

Measured memory_bytes: 3796
from collections import Counter

n, m = map(int, input().split())
an = list(map(int, input().split()))
ac_ = Counter(an)
ac = {i: ac_[i] if i in ac_ else 0 for i in range(1, n + 1)}
ad = [0] * n
for a, c in ac.items():
    for i in range(max(0, a - c), a):
        ad[i] += 1
ans = ad.count(0)
anss = []

for x, y in (map(int, input().split()) for _ in range(m)):
    ax = an[x - 1]
    xdi = ax - ac[ax]
    if xdi >= 0:
        ad[xdi] -= 1
        if ad[xdi] == 0:
            ans += 1
    ac[ax] -= 1
    ac[y] += 1
    ydi = y - ac[y]
    if ydi >= 0:
        ad[ydi] += 1
        if ad[ydi] == 1:
            ans -= 1
    an[x - 1] = y
    anss.append(ans)
print('\n'.join(map(str, anss)))


Measured memory_bytes: 74716
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;
int main(){
	int a , b , k ; 
	cin >> a >> b >> k ; 
	int x = __gcd(a,b) ; 
	for(int i=x;i>=1;i--){
		if ( x % i == 0 ) {
			k-- ; 
			if ( k == 0 ) {
				cout << i << endl;
				return 0 ; 
			}
		}
	}
    return 0 ;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int n;
  cin >> n;
  int p[n - 1];
  int mx = 0;
  for(int i = 0; n > i; i++){
    cin >> p[i];
    if(mx < p[i]) mx = p[i];
  } 
  for(int i = mx; 1 < i; i--){
    int clear = 0;
    for(int j = 0; n > j; j++){
      if(mx <= p[j]){
        clear++;
      }
    }
    if(mx <= clear){
      break;
    }
    mx--;
  }
  cout << mx << endl;
  return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <cmath>

int main(void){
    int a,b;
    std::cin >> a >> b;
    int counter = 0;
    for(int i = a; i<=b; i++){
        std::string boxa = std::to_string(i);
        std::string boxb = boxa;
        std::reverse(boxa.begin(),boxa.end());
        if(boxa == boxb){
            counter++;
        }
    }
    std::cout << counter;
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long A,V,B,W,T;
    cin>>A>>V>>B>>W>>T;
    if(T*(V-W)>=(abs(A-B))){
        cout<<"YES"<<endl;
        return 0;
    }
    else{
        cout<<"NO"<<endl;
        return 0;
    }
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define MODD 1000000007
using namespace std;
long long fac(int n)
{
	long long ans = 1;
	for (int i = 2; i <= n; i++) {
		ans = (ans * i) % MODD;
	}
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	string s;
	cin >> n >> s;
	int d[200005]; // 0 represents L, 1 represents R
	int l[200005] = {0}, r[200005] = {0}; // size should be 2N
	int len = s.size(); 
	d[0] = 0;
	for (int i = 1; i < len; i++) {
		if (s[i] == s[i - 1])
			d[i] = !d[i - 1];
		else
			d[i] = d[i - 1];
	}
	int cntL = 0, cntR = 0;
	for (int i = 0; i < len; i++) {
		if (d[i] == 0)
			cntL++;
		else
			cntR++;
	}
	long long ans = 1;
	if (cntL != cntR || s[0] == 'W' || s[len - 1] == 'W') {
		ans = 0;	
	} else {
		for (int i = 1; i < len; i++) {
			if (d[i - 1] == 0) {
				l[i] = l[i - 1] + 1;
				r[i] = r[i - 1];
			} else {
				l[i] = l[i - 1];
				r[i] = r[i - 1] + 1;
			}
		}
		for (int i = 0; i < len; i++) {
			if (d[i] == 1) {
				ans = (ans * (l[i] - r[i])) % MODD;
			}
		}
		ans = (ans * fac(n)) % MODD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2964
//============================================================================
// Name        : ku.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include<iostream>
using namespace std;
#include<cstdio>
#include<math.h>
int main(){
	double r,n,m;
	cin>>r;
	n=2*r*M_PI;
	m=r*r*M_PI;
	printf("%.5f %.5f",m,n);
	return 0;
}

Measured memory_bytes: 1240
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define false 0
#define true (!false)

int N;
int A[1000];

int main( int argc, char *argv[] )
{
    int i;
    int denyf = false;

    if( scanf( "%d", &N ) != 1 ) {
        printf( "N read error!\n" );
        exit( -1 );
    }

    for( i=0; i<N; i++ ) {
        if( scanf( "%d", &A[i] ) != 1 ) {
            printf( "A read error!\n" );
            exit( -1 );
        }
    }

    for( i=0; i<N; i++ ) {

        if( A[i] %2 == 0 ) {
            if( A[i] %3 != 0 && A[i] %5 != 0 ) {
                denyf = true;
                break;
            }
        }
    }

    if( denyf ) puts( "DENIED" );
    else        puts( "APPROVED" );
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
#define maxn 100010

int a,b,c,d;

int main()
{
	scanf("%d %d %d %d",&a,&b,&c,&d);
	printf("%lld",max(max(1ll*a*c,1ll*b*d),max(1ll*a*d,1ll*b*c)));
}

Measured memory_bytes: 1736
import java.util.Scanner;

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

        if(a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

    using namespace std;
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        long long val=0;
        int n;
        cin>>n;
        for(int i=1;i<=n;i++){
            if(i%3==0 || i%5==0)
                continue;
            else
                val+=i;
        }
        cout<<val;
        return 0;
    }


Measured memory_bytes: 3596
import java.io.*;
import java.util.*;
import java.math.*;
class Main
{ 
	public static int M = 1000000007;
    public static void main(String[] args)throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        long n = Long.parseLong(br.readLine());
        long g = gcd(2,n);
        out.println((2*n)/g);
        out.flush();
    }
    /** Loops
    *	i: for(int i=0;i<n;i++)
    *	j: for(int j=0;j<n;j++)
    *	k: for(int k=0;k<n;k++)

    *	ArrayList<Integer> arr1 = new ArrayList<>();
    
    * 	HashMap
    *	HashMap<Integer, Integer> hm = new HashMap<>();
    * 	for (Map.Entry<String,String> entry : hm.entrySet()) 
    		out.println(entry.getValue());
    
    *	Count frequencies
    	for(int i=0;i<n;i++)
        {
            Integer c = hm.get(Integer.parseInt(s[i]));
            if(c==null)
                hm.put(Integer.parseInt(s[i]),1);
            else
                hm.put(Integer.parseInt(s[i]),++c);
        }
	**/		
    public static long modularExpo(long x,long n,int M)
	{
		long result=1;
		while(n>0)
		{
		    if(n%2==1)
		        result=(result*x)%M;
		    x=(x*x)%M;
		    n=n/2;
		}	
		return result;												
	}
	//FLT, only when a and M are co-prime
	public static long modInverse(int a,int M)
	{
		long g = gcd(a,M);
		if(g!=1)
			return -1;
	    return modularExpo(a,M-2,M);
	}
	public static long gcd(long a, long b) 
	{
	    if(b==0)
	        return a;
	    else
	        return gcd(b, a % b);
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <list>
using namespace std;
typedef long long ll;

int main() {
    ll N,H,W;
    cin >> N >> H >> W;

    int ct=0,a,b;
    for(int i=0;i<N;i++){
        cin >> a >> b;
        if(a>=H && b>=W) ct++;
    }
    cout << ct << endl;
}

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

#define lli long long int
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

lli dist[600][600];
lli has[600][600];


int main(){

    lli N;
    cin>>N;

    REP(i,1,N+1){
        REP(j,1,N+1){
            has[i][j]=1;
            dist[i][j] = min({i,j,N+1LL-i,N+1LL-j}) - 1;
        }
    }

    lli _=N*N;
    lli ans = 0;
    while(_--){
        lli a;
        cin>>a;
        lli nowI = (a-1)/N+1;
        lli nowJ = (a-1)%N+1;
        ans += dist[nowI][nowJ];

        lli di[4]={-1,0,1,0};
        lli dj[4]={0,1,0,-1};

        queue<pair<lli,lli>> q;
        queue<lli> qd;
        has[nowI][nowJ] = 0;

        q.push({nowI,nowJ});
        qd.push(0);

        while(q.size()){
            pair<lli,lli> topP = q.front();
            lli nowD = qd.front();
            q.pop();
            qd.pop();

            REP(k,0,4){
                pair<lli,lli> nexP = topP;
                nexP.first += di[k];
                nexP.second += dj[k];
                if(dist[nowI][nowJ] + nowD < dist[nexP.first][nexP.second]){
                    dist[nexP.first][nexP.second] = dist[nowI][nowJ]+nowD;
                    q.push(nexP);
                    qd.push(nowD + has[nexP.first][nexP.second]);
                }
            }
        }
    }

    cout<<ans<<endl;

    // Failed to predict input format
    return 0;
}


Measured memory_bytes: 8240
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	vector<vi>c(3, vi(3));
	rep(i, 3) {
		rep(j, 3) {
			cin >> c[i][j];
		}
	}
	deque<int>row, column;
	rep(i, 2) {
		rep(j, 3) {
			row.push_back(c[i][j] - c[i+1][j]);
		}
	}
	rep(i, 2) {
		rep(j, 3) {
			column.push_back(c[j][i] - c[j][i + 1]);
		}
	}
	
	//cout << column.size() << endl;
	bool ans = false;
	if (row[0] == row[1] && row[1] == row[2]) {
		if (row[3] == row[4] && row[4] == row[5]) {
			if (column[0] == column[1] && column[1] == column[2]) {
				if (column[3] == column[4] && column[4] == column[5]) {
					ans = true;
				}
			}
		}
	}
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}



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

int main() {
  int n,m;
  cin >> n >> m;
  vector<P>p(n);
  vector<P>c(m);
  rep(i,n) cin >> p[i].first >> p[i].second;
  rep(i,m) cin >> c[i].first >> c[i].second;
  rep(i,n){
    int ans = 1e9;
    int num;
    rep(j,m){
      int dis = abs(p[i].first-c[j].first)+abs(p[i].second-c[j].second);
      if(dis < ans){
        ans = dis;
        num = j;
      }
    }
    cout << num+1 << endl;
  }
}

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

int H, W;
vector<vector<int>> field;
vector<vector<int>> checked;
long long ans = 0;
long long black_cnt;
long long white_cnt;

int dfs(int h, int w) {
    checked[h][w] = 1;
    if (field[h][w] == 0) white_cnt++;
    else black_cnt++;
    
    int dx[] = {0, 1, 0, -1};
    int dy[] = {1, 0, -1, 0};
    for (int i = 0; i < 4; i++) {
        int next_h = h + dy[i];
        int next_w = w + dx[i];
        if (checked[next_h][next_w] == 0 && field[next_h][next_w] == (field[h][w] ^ 1)) {
            dfs(next_h, next_w);
        }
    }
    return 0;
}

int main(void){
    cin >> H >> W;
    field.resize(H+2, vector<int>(W+2, -1));
    checked.resize(H+2, vector<int>(W+2));
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            char c; cin >> c;
            if (c == '.') field[i][j] = 0;
            else field[i][j] = 1;
        }
    }
    
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (checked[i][j] == 0) {
                black_cnt = 0;
                white_cnt = 0;
                dfs(i, j);
                ans += black_cnt * white_cnt;
            }
        }
    }
    
    cout << ans << endl;
}


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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll a, b, tasu, hiku, kake;
  cin >> a >> b;
  tasu = a + b;
  hiku = a - b;
  kake = a * b;
  cout << max(tasu, max(hiku, kake)) << endl;
}

Measured memory_bytes: 256
#include<string>
#include<sstream>
#include<cstdio>
using namespace std;
int main(){
    int n;
    char s[120];
    for(;;){
        scanf("%d\n",&n);
        if(n==0) break;
        scanf("%s\n",s);
        string ins(s);
        for(int ix=0;ix<n;ix++){
            stringstream next;
            char last=ins[0];
            int cnt=1;
            for(int i=1;i<ins.size();i++){
                if(ins[i]!=last){
                    next<<cnt<<last;
                    cnt=1;
                }else cnt++;
                last=ins[i];
            }
            next<<cnt<<last;
            ins=next.str();
        }
        printf("%s\n",ins.c_str());
    }
}

Measured memory_bytes: 0
import collections

n = int(input())
l = []*n

for x in range(0, n) :
    l.append(input())

l_sorted = sorted(l)
c = collections.Counter(l_sorted)
mc = c.most_common()

pre_v = 0
ans = []
for m in mc :
    k = m[0]
    v = m[1]
    if v < pre_v :
        break
    pre_v = v
    ans.append(k)

ans_sorted = sorted(ans)
for a in ans_sorted :
    print(a)



Measured memory_bytes: 50788
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    map<ll, ll> mp;
    ll sum = 0, ans = 0;
    mp[0]++;
    rep(i,n){
        cin >> a[i];
        sum += a[i];
        ans += mp[sum]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 16992
n=int(input())
A=list(map(int,input().split()))
B=[]

for i in range(n):
    if A[i]%2==0:
        B.append(A[i])

cnt=0
for i in range(len(B)):
    if B[i]%3==0 or B[i]%5==0:
        cnt+=1
if cnt==len(B):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 9112
g = int(input())

grades = []
for i in range(g):
    grade = int(input())
    grades.append(grade)

total = sum(grades)
grades.sort()
grades = [0] + grades
count = 0
for grade in grades:
    if (total - grade) % 10 != 0:
        print(total - grade)
        break
    else:
        count += 1

if count == len(grades):
    print(0)
 

Measured memory_bytes: 9096
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 998244353
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/
ll poww(long long a, long long n, long long m)
{
        long long ans = 1;
        long long mul = a;
        while (n != 0)
        {
                if (n % 2)
                {
                        ans = (ans * mul) % m;
                }
                mul = (mul * mul) % m;
                n /= 2;
        }
        return ans;
}
/* 
Fermat's little theorem: 
1) (a/b)%mod= (a*(poww(b,mod-2,mod)))%mod iff a%b==0
2) (a^b)%mod= (a^(b%(mod-1)))%mod iff mod is prime
*/
const int SZ=2e5+100;
ll factorial[SZ];
ll iv[SZ];
void precompute()
{
	factorial[0]=1;
    iv[0]=1;
	for(int i=1;i<SZ;i++)
	{
		factorial[i]=(factorial[i-1]*i)%MOD;
	   iv[i]=poww(factorial[i],MOD-2,MOD);
    }
}
ll InverseEuler(ll n, ll m)
{
    return poww(n, m - 2, m);
}
ll C(ll n, ll r, ll m)
{

    return (factorial[n] * ((iv[r] * iv[n-r]) % m)) % m;
}

int32_t main()
{
	fastio();
	precompute();
	int n,m,k;
	cin>>n>>m>>k;
	int ans=0;
	for(int i=0;i<=k;i++)
	{
		int components=n-i;
		int cur=C(n-1,i,MOD);
		cur*=m;
		cur%=MOD;
		cur*=poww(m-1,components-1,MOD);
		cur%=MOD;
		ans+=cur;
		ans%=MOD;
	}
	cout<<ans<<endl;
}


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

#define _crt_secure_no_warnings
#define FREEELO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define INF 0x3F3F3F3F
#define MAX 101
#define MOD 1000000007
#define ALPHABET 128
#define loop(i, n) for (int i = 1; i <= (n); i++)
#define loop0(i, n) for (int i = 0; i < (n); i++)
#define sz(x) (int)x.size()
#define all(v) v.begin(), v.end()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll, ll> llll;
typedef pair<int, int> ii;
typedef unordered_map<int, int> umii;
typedef unordered_map<ll, ll> umll;


int main(){
    string s, t; cin >> s >> t;
    int n = sz(s);
    int mn = INF;
    for (int i = 0; i <= n - sz(t); i++) {
        int cnt = 0;
        for (int j = i; j < i + sz(t); j++){
            if (s[j] != t[j - i]){
                cnt++;
            }
        }
        mn = min(mn, cnt);
    }
    cout << mn << endl;
}

Measured memory_bytes: 3164
N,M = map(int,input().split())
PY = []
tmp = []
cheker = []
res = []
for i in range(M):
    tmp = list(map(int,input().split()))
    tmp.append(i)
    PY.append(list(tmp))
    res.append('')

sorted_py = sorted(PY, key=lambda x: x[1])
checker = [0 for i in range(N)]

for i in range(M):
    index = sorted_py[i][0]-1
    checker[index] += 1
    res[sorted_py[i][2]] = str(sorted_py[i][0]).zfill(6) + str(checker[sorted_py[i][0]-1]).zfill(6)

for i in range(M):
    print(res[i])

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

int main()
{
    string n;
    cin >> n;
    
    if (n == "Sunny") {
    cout << "Cloudy" <<endl;
    }
    else if(n == "Rainy"){
    cout << "Sunny" << endl;
    }
    else{
    cout << "Rainy" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Card Game
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0523

"""
import sys


from bisect import bisect_right

def solve(taro, hanako):
    ba = taro.pop(0)
    player = hanako
    while taro and hanako:
        i = bisect_right(player, ba)
        if i != len(player):
            ba = player.pop(i)
        else:
            player = taro if player == hanako else hanako
            ba = player.pop(0)
        player = taro if player == hanako else hanako

    return len(hanako), len(taro)


def main(args):
    while True:
        n = int(input())
        if n == 0:
            break
        taro = sorted([int(input()) for _ in range(n)])
        hanako = sorted(set(range(1, 2*n+1)) - set(taro))
        ans = solve(taro, hanako)
        print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])



Measured memory_bytes: 5672
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}
struct UnionFind {
    VI d;
    UnionFind(int n = 0): d(n,-1) {}
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x,int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};
int deg[100005];
VI to[100005];

struct mint {
  LL x; // typedef long long ll;
  mint(LL x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(LL t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(MOD-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
    if(n == 0) return 1;
    mint x = f(n/2);
    x *= x;
    if(n%2 == 1) x *= 2;
    return x;
}

mint choose(int n,int a) {
    mint x = 1, y = 1;
    rep(i,a) {
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

int main() {
    int n;
    cin >> n;
    VI a(n-1);
    rep(i,n-1) cin >> a[i];
    VI ans(n);
    rep(i,n-1) {
      ans[a[i]-1]++;
    }
    rep(i,n) {
      cout << ans[i] << endl;
    }
}


Measured memory_bytes: 7160
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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;
  vector<ll> a(N);
  rep(i, N) cin >> a[i];
  vector<ll> b(N);
  rep(i, N) cin >> b[i];

  ll ans = 0;
  rep(i, 30) {
    vector<ll> bb(N);
    rep(j, N) {
      bb[j] = b[j] % bit(i + 1);
    }
    sort(all(bb));

    ll cnt = 0;
    rep(k, N) {
      ll A = a[k] % bit(i + 1);
      if (A <= bit(i)) {
        auto l = lower_bound(all(bb), bit(i) - A);
        auto r = lower_bound(all(bb), bit(i + 1) - A);
        cnt += r - l;
      } else {
        auto l = lower_bound(all(bb), bit(i + 1) + bit(i) - A);
        auto r = lower_bound(all(bb), bit(i + 1) - A);
        cnt += l - bb.begin();
        cnt += bb.end() - r;
      }
    }

    if (cnt & 1)
      ans += bit(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4992
#![allow(non_snake_case)]

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

fn main() {
    let R: f64 = read();
    println!("{}", R * 2.0 * std::f64::consts::PI);
}


Measured memory_bytes: 2220
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N; cin >> N;
    vector<int> v_fBits(N, 0);
    for(int n=0; n<N; ++n){
        for(int i=0; i<10; ++i){
            v_fBits[n] <<= 1;
            
            int f; cin >> f;
            if(f==1){ v_fBits[n] += 1; }
        }
    }
    
    vector<vector<int>> vvP(N, vector<int>(11));
    for(int r=0; r<N; ++r){
        for(int c=0; c<11; ++c){
            cin >> vvP[r][c];
        }
    }
    
    int sum=INT_MIN;
    for(int sBits=0; sBits < (1<<10); ++sBits){
        if(__builtin_popcount( sBits ) == 0){ continue; }
        
        int sum_tmp=0ll;
        for(int i=0; i<N; ++i){
            int num = __builtin_popcount( v_fBits[i] & sBits );
            sum_tmp += vvP[i][num];
        }
        
        sum = max(sum, sum_tmp);
    }
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 3596
unittest
{
	assert( [ "6" ].parse.expand.solve == 3 );
	assert( [ "3141" ].parse.expand.solve == 13 );
	assert( [ "314159265358" ].parse.expand.solve == 9 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	return tuple( n );
}

auto solve( long n )
{
	// 最初に割れるだけ割って、割れなくなったら引けるところまで引くことになる。
	// 引き算では割り算の余りが変わることはないので、引き算を繰り返した結果は割り算の余りに等しくなる。途中で割り算が挟まることもない。
	
	// 割り算→引き算の順でやって結果が1になるkを列挙
	bool[ long ] as;
	foreach( k; n.divisors )
	{
		if( k == 1 ) continue;
		auto m = n;
		while( m % k == 0 ) m /= k;
		if( m % k == 1 ) as[ k ] = true;
	}
	
	// 引き算して結果が1になるkを列挙
	foreach( k; ( n - 1 ).divisors )
	{
		if( k == 1 ) continue;
		if( n % k == 1 ) as[ k ] = true;
	}
	return as.length;
}

// 約数列挙
auto divisors( long n )
{
	bool[ long ] ds;
	auto s = cast( long ) n ^^ 0.5L;
	for( auto i = 1L; i <= s; i++ )
	{
		if( n % i != 0 ) continue;
		ds[ i     ] = true;
		ds[ n / i ] = true;
	}
	return ds.keys;
}


Measured memory_bytes: 636
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	while (true){
     		int[]a = new int[2];
    		a[0] = scan.nextInt();
    		String s = scan.next();
    		a[1] = scan.nextInt();
    		if(s.equals("?")){
    			break;
    		}else if(s.equals("+")){
    			System.out.println(a[0]+a[1]);
    		}else if(s.equals("-")){
    			System.out.println(a[0]-a[1]);
    		}else if(s.equals("*")){
    			System.out.println(a[0]*a[1]);
    		}else if(s.equals("/")){
    			System.out.println(a[0]/a[1]);
    		}
    		
    		
    		
    	}
   }
}

Measured memory_bytes: 12000
a,b,c,d=map(int,input().split())
X=c-a
Y=d-b
print('U'*Y+'R'*X+'D'*Y+'L'*(X+1)+'U'*(Y+1)+'R'*(X+1)+'D'+'R'+'D'*(Y+1)+'L'*(X+1)+'U')


Measured memory_bytes: 3060
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))

ret = 0
i = 0
while i < len(a):
    j = i
    while j < n - 1 and a[j] <= a[j+1]:
        j += 1
    h = i
    while h < n - 1 and a[h] >= a[h+1]:
        h += 1
    i = max(h, j) + 1
    ret += 1

print(ret)


Measured memory_bytes: 23124
#include <stdio.h>
int main (void){

  int n = 0 ,a100 = 0,a10 = 0,a1 = 0; 

  scanf("%d", &n);

  a100 = n/100;
  a10 = (n%100)/10;
  a1 = n%10;

  
  
  if(a100 == 1){
    a100 = 9;
  }else if(a100 == 9){
    a100 = 1;
  }
  
  if(a10 == 1){
    a10 = 9;
  }else if(a10 == 9){
    a10 = 1;
  }
  
  if(a1 == 1){
    a1 = 9;
  }else if(a1 == 9){
   a1 = 1;
  }


  
  printf("%d%d%d\n",a100,a10,a1);

  return 0;
}


Measured memory_bytes: 128
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto s = readln.chomp;
  long cnt, res;
  foreach (i; 0..s.length) {
    if (s[i] == 'B') {
      cnt++;
    } else {
      res += cnt;
    }
  }
  res.writeln;
}


Measured memory_bytes: 764
s=input()
n=len(s)
def check(s):
    a=list(set(list(s)))
    b=list("ACGT")
    for i in b:
        if i in a:
            a.remove(i)
    if a==[]:
        return len(s)
    return 0
ans=0
for i in range(n):
    for j in range(n+1):
        ans=max(ans,check(s[i:j]))
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<map>
#include<string>
#include<string.h>
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#include<math.h>
#include<stack>
#include<set>
#define INF 2147483647
#define n 300000
#define loop(i, a, b) for(int i=a; i<=b; i++)
#define mem(arr) memset(arr, 0, sizeof(arr));
using namespace std;
typedef long long lli;
typedef double llf;
typedef pair<int, int> P;
struct edge{
	int to, weight;
};
void solve();
int main()
{
	int times = 1;
//	cin >> times;
	loop(i, 1, times)
	{
		solve();
		cout << '\n';
	}
	return 0;
}
vector<edge> V[n + 50];
long long a, b, c, d, e, f;
int arr[n + 50], arr1[n + 50], arr2[n + 50];
string str, str1, str2;
long long mod = 1e9 + 7;
long long func[1000050];
lli fuck(lli a, lli b)
{
	a %= mod;
	lli temp = a, res = 1;
	while(b)
	{
		if(b % 2) res = (res * temp) % mod;
		temp = (temp * temp) % mod;
		b /= 2;
	}
	return res;
}
void solve()
{
	long long ans = 0;
	func[0] = 1;
	for(int i=1; i<=1000000; i++)
		func[i] = (func[i - 1] * i) % mod;
	cin >> a >> b;
	for(int i=0; 2 * i <= a && i <= b; i++)
	{
		long long one = a - (i * 2);
		long long two = b - i;
		if((two / 2 != one) || two % 2 != 0) continue;
//		cout << one << ' ' << i << '\n';
		long long three = (func[one] * func[i]) % mod;
		long long four  = func[one + i];
		three = fuck(three, mod - 2);
		ans += (four * three) % mod;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 16512