akhauriyash/Code-Regression huggingface dataset:
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(n)]
B = [list(map(int, input().split())) for _ in range(m)]
C = [[] for _ in range(n)]

for i in range(n):
    for j in range(l):
        x = 0
        for k in range(m):
            x += A[i][k] * B[k][j]
        C[i].append(x)

for c in C:
    print(*c)
    

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

using namespace std;

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

    int n;
    cin >> n;

    vector<string> city(n);
    vector<int> score(n), idx(n);

    iota(idx.begin(), idx.end(), 0); // (0, 1, 2, ..., n - 1)
    for (int i = 0; i < n; ++i)
        cin >> city[i] >> score[i];

    // city と score を参照する（[&] で自動変数すべてを参照しても良い）
    sort(idx.begin(), idx.end(), [&city, &score](int i, int j) {
            return (city[i] < city[j])
                || (city[i] == city[j] && score[i] >= score[j]);
        });

    for (int no : idx)
        cout << no + 1 << '\n';

    return 0;
}


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

int main() {
	int n;
	string s;
	cin >> n >> s;
	int c = 0;
	for(int i = 0;i < n - 2;i++)
	{
		if(s.at(i) == 'A' && s.at(i+1) == 'B'&& s.at(i+2) == 'C')
		{
			c++;
		}
	}
	cout << c <<endl;
	return 0;
}


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

int main() {
	string s;
	string ans = "";
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '1')ans += "1";
		else if (s[i] == '0')ans += "0";
		else if (ans != "") {
			string ansnew = "";
			for (int i = 0; i < ans.size() - 1; i++)ansnew += ans[i];
			ans = ansnew;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val n: Int = sc.nextLine.toInt
    val s: List[String] = List.fill(n)(sc.nextLine)
    val m: Int = sc.nextLine.toInt
    val t: List[String] = List.fill(m)(sc.nextLine)
    val blueCount = s.groupBy(identity).mapValues(_.size).withDefaultValue(0)
    val redCount = t.groupBy(identity).mapValues(_.size).withDefaultValue(0)

    println(Array(0, (s ++ t).distinct.map(
      i => blueCount(i) - redCount(i)
    ).max).max)
  }

}


Measured memory_bytes: 27208
import sys 
sys.setrecursionlimit(10**6)
s = input()
def dfs(s):
    while True:
        f = True
        for i in ['erase', 'eraser', 'dream', 'dreamer']:
            if s[-len(i):]==i:
                s = s[:-len(i)]
                if s=='':
                    return True
                f = False
        if f: return False
    
if dfs(s):
    print('YES')
else:
    print('NO')

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

using namespace std;
using ll = long long;

const ll MOD = 1e9 + 7;

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

    ll N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    ll ans = 0, count = 0;
    for (int i = 0; i < N - 1; ++i) {
        for (int j = i + 1; j < N; ++j) {
            if (A[i] > A[j]) ++ans;
        }
    }
    ans = (ans * K) % MOD;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            if (A[i] > A[j]) ++count;
        }
    }
    ans += (count * ((K * (K - 1) / 2) % MOD)) % MOD;
    ans %= MOD;
    cout << ans << '\n';
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int a,b,tmp,gcd;
  scanf("%d%d",&a,&b);
  if(a<b){
    tmp=a;
    a=b;
    b=tmp;
  }
  while(1){
    if(a%b==0)
      break;
    tmp=b;
    b=a%b;
    a=tmp;
  }
  printf("%d\n",b);
  return 0;
}

Measured memory_bytes: 592
#include <iostream>
using namespace std;
typedef long long int ll;

int N,K;
ll DP[105][100005];
ll V[105],W[105];

int main(){
	cin>>N>>K;
	for(int i=0;i<N;i++)
		cin>>W[i+1]>>V[i+1];

	for(int i=1;i<N+1;i++)
		for(int j=1;j<K+1;j++)
			DP[i][j]=max(DP[i-1][j],((j-W[i]>=0)?(DP[i-1][j-W[i]]+V[i]):0));

	cout<<DP[N][K];

}

Measured memory_bytes: 79360
"use strict"
function main(arg) {
    var n = Number(arg.trim().split("\n")[0])
    var a = Math.floor(n / 500)
    n = (n % 500)
    var b = Math.floor(n / 5)
    console.log(a * 1000 + b * 5)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 1000006;
const ll MOD = 1000000007;

string str;

/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> str;

    bool flag = true;
    REP (i, SZ(str)) {
        if (i&1) {
            flag &= str[i] != 'R';
        } else {
            flag &= str[i] != 'L';
        }
    }
    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
const int max_length = 10;
string input_s;
vector<int> input_i;
int size_n;
unsigned long long sum;

void solve(vector<int> &sign){
    unsigned long long tmp_sum = 0;
    unsigned long long tmptmp = 0;
    // printf("vec size=%d, total_size=%d\n", (int)sign.size(), size_n);
    if(sign.size()==size_n-1){
        tmptmp = input_i[0];
        for(int i=0;i<size_n-1;i++){
            // printf("i=%d sign=%d ", i, sign[i]);
            if(sign[i]){
                sum += tmptmp;
                // printf("tmp = %lld ", tmptmp);
                tmptmp = input_i[i+1];
                // if(i == size_n-1){
                //     sum += input_i[size_n-1];
                // }
            }else{
                tmptmp = tmptmp * 10 + input_i[i+1];
            }
        }
        sum += tmptmp;
        // printf("sum=%lld", sum);
        // printf("\n");
    }else{
        sign.push_back(1);
        solve(sign);
        sign.erase(sign.end()-1);

        sign.push_back(0);
        solve(sign);
        sign.erase(sign.end()-1);

        // printf("mid vec size=%d, total_size=%d\n", (int)sign.size(), size_n);

        // printf("after vec size=%d, total_size=%d\n", (int)sign.size(), size_n);

    }
    
}

int main(){
    cin >> input_s;
    size_n = (int)input_s.size();
    input_i.resize(size_n);
    for(int i=0;i<size_n;i++){
        input_i[i] = (int)(input_s[i]) - '0';
    }
    vector<int> sign;

    solve(sign);
    printf("%lld\n", sum);
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  int div_able = -1;
  int a;
  
  for (int i = 0; i < n; i++) {
    cin >> a;
    int div_able_a = 0;
    while (a % 2 == 0) {
      a /= 2;
      div_able_a++;
    }
    
    if (div_able == -1)
      div_able = div_able_a;
    else if (div_able > div_able_a)
      div_able = div_able_a;
  }
  
  cout << div_able << endl;
}

      

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

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 EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n; cin >> n;
	vector<LL> a(3*n+1);
	for (int i = 1; i < 3*n+1; i++) {
		cin >> a[i];
	}

	vector<LL>mi(3*n+1);
	priority_queue<LL, vector<LL>,greater<LL>> q1;
	LL cnt = 0;
	for (int i = 1; i < n + 1; i++) {
		cnt += a[i];
		q1.push(a[i]);
	}

	mi[n] = cnt;

	for (int i = n+1; i <= 2 * n; i++) {
		cnt += a[i];

		q1.push(a[i]);

		cnt -= q1.top();
		q1.pop();

		mi[i] = cnt;
	}

	
	vector<LL>mx(3*n+1);
	priority_queue<LL, vector<LL>> q2;
	cnt = 0;
	for (int i = 3*n; i>=2*n+1; i--) {
		cnt += a[i];
		q2.push(a[i]);
	}

	mx[2*n] = cnt;

	for (int i = 2*n-1; i >=n; i--) {
		cnt += a[i+1];

		q2.push(a[i+1]);

		cnt -= q2.top();
		q2.pop();

		mx[i] = cnt;
	}

	LL ans = mi[n]-mx[n];

	for (int i = n; i <= 2 * n; i++) {
		LL diff = mi[i] - mx[i];

		ans = max(ans, diff);
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 9588
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *

s, t = input(), input()
se = set(s)
for c in t:
    if c not in se:
        print(-1)
        exit()
dic = defaultdict(list)
for i, c in enumerate(s, 1):
    dic[c].append(i)
n = len(s)
i = ans = dic[t[0]][0]
for c in t[1:]:
    dicc = dic[c]
    j = bisect_right(dicc, i)
    if len(dic[c]) <= j:
        ans += n-i+dicc[0]
        i = dicc[0]
    else:
        ans += dicc[j]-i
        i = dicc[j]
print(ans)


Measured memory_bytes: 48620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int a[52][52]={};
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
int h,w;

//color 0=. 1=B -1=W 2=b -2=w 10=*

void paint(int y,int x,int color){
    if((fabs(a[y][x])!=2 && a[y][x]!=0) || a[y][x]==color)return;//
    if(fabs(a[y][x]-color)==4)color = 10;
    a[y][x] = color;
    rep(i,4)paint(y+dy[i],x+dx[i],color);
}

int main(void){
    char tmp;
    while(cin>>w>>h, w|h){
        int cntB=0,cntW=0;
        /*??\???*/
        rep1(y,h){
            rep1(x,w){
                cin>>tmp;
                if(tmp=='.')a[y][x] = 0;
                else if(tmp=='B')a[y][x] = 1;
                else a[y][x] = -1;
            }
        }

        /*?£??¨????*/
        rep(y,h+2)a[y][0]=a[y][w+1] = 100;
        rep(x,w+2)a[0][x]=a[h+1][x] = 100;

        /*????????????*/
        rep1(y,h){
            rep1(x,w){
                if(a[y][x] == 1)      rep(i,4)paint(y+dy[i],x+dx[i],2);
                else if(a[y][x] == -1)rep(i,4)paint(y+dy[i],x+dx[i],-2);
            }
        }

        rep1(y,h){
            rep1(x,w){
                if(a[y][x]==2)cntB++;
                else if(a[y][x]==-2)cntW++;
            }
        }
        cout<<cntB<<" "<<cntW<<endl;
    }

    return 0;
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int R = sc.nextInt();
		int G = sc.nextInt();
		int B = sc.nextInt();
		if((100*R+10*G+B)%4==0)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}


Measured memory_bytes: 22228
import collections as col
n = int(input())
li = list(map(int,input().split()))

li0 = li[::2]
li1 = li[1::2]
c0 = col.Counter(li0)
c1 = col.Counter(li1)
if c0.most_common()[0][0] != c1.most_common()[0][0]:
  print(n-c0.most_common()[0][1]-c1.most_common()[0][1])
else:
  if len(set(li0)) == 1:
    if len(set(li1)) == 1:
      print(n - len(li0))
    else:
      print(n - len(li0) - c1.most_common()[1][1])
  else:
    if len(set(li1)) == 1:
      print(n - len(li1) - c0.most_common()[1][1])
    else:
      if c0.most_common()[1][1] <= c1.most_common()[1][1]:
        print(n - c0.most_common()[0][1]-c1.most_common()[1][1])
      else:
        print(n - c1.most_common()[0][1]-c0.most_common()[1][1])

Measured memory_bytes: 19960
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define ll long long int
int main(void)
{
    ll N, A, B, C;
    ll d, e, ans = 0;
    scanf("%lld", &N);
    A = N / 500;
    B = N - A * 500;
    C = B / 5;
    printf("%lld\n", A * 1000 + C * 5);

    return 0;
}

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

int A,B,T;

int main(){
  cin >> A >> B >> T;
  int res = 1;
  int cookie = 0;
  while(true){
  	if(res*A > T+0.5)break;
    cookie += B;
    res++;
  }
  
  cout << cookie << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long s[50001],t[50001],e[50001];
long long b[10001],ans[10001];
int main(){
	int n,m,top=0;
	cin>>n>>m;
	while(true){
		cin>>s[top]>>t[top]>>e[top];
		if(s[top]==0&&t[top]==0&&e[top]==0)break;
		top++;
	}
	int v;
	cin>>v;
	for(int u=0;u<v;u++){
		for(int i=0;i<n;i++)ans[i]=0;
		for(int i=0;i<m;i++)cin>>b[i];
		for(int set=0;set<top;set++)ans[s[set]-1]+=b[t[set]-1]*e[set];
		cout<<ans[0];
		for(int i=1;i<n;i++)cout<<" "<<ans[i];
		cout<<endl;
	}
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    int temp, res = 0;
    for(int i = 0; i< n ; i++){
        cin >> temp;
        int curr = 0;
        while(temp%2 == 0){
            curr++;
            temp = temp/2;
        }
        res += curr;
    }
    cout<<res<<endl;
    return 0;
    
}






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

#define INF ((int)(1e9))
#define MAX 11

int n, p[MAX],t[MAX];
bool hoge(int a[], int b[]){
	priority_queue<int, vector<int>, greater<int>> Q;
	int num = -1, next = INF;
	for(int i = n-2; i >= 0; i--){
		if(a[i] < a[i+1]){
			num = i;
			break;
		}
	}
	if(num == -1) return false;
	
	for(int i = n-1; i > num; i--){
		if(a[num] < a[i])next = min(a[i],next);
	}
	for(int i = n-1; i >= num; i--){
		if(a[i] != next) Q.push(a[i]);
	}
	
	for(int i = 0; i < num; i++){
		b[i] = a[i];
	}
	
	b[num] = next;
	
	for(int i = num+1; i < n; i++){
		b[i] = Q.top(); Q.pop();
	}
	return true;
}

bool fuga(int a[], int b[]){
	priority_queue<int, vector<int>> Q;
	int num = -1, next = -INF;
	for(int i = n-2; i >= 0; i--){
		if(a[i] > a[i+1]){
			num = i;
			break;
		}
	}
	if(num == -1) return false;
	
	for(int i = n-1; i > num; i--){
		if(a[num] > a[i])next = max(a[i],next);
	}
	for(int i = n-1; i >= num; i--){
		if(a[i] != next) Q.push(a[i]);
	}
	
	for(int i = 0; i < num; i++){
		b[i] = a[i];
	}
	
	b[num] = next;
	
	for(int i = num+1; i < n; i++){
		b[i] = Q.top(); Q.pop();
	}
	return true;
}

void p_array(int a[]){
	for(int i = 0; i < n; i++){
		cout<<(i?" ":"")<<a[i];
	}
	cout<<endl;
}

int main(){
	cin>>n;
	
	for(int i = 0; i < n; i++){
		cin>>p[i];
	}
	if(fuga(p,t)) p_array(t);
	
	p_array(p);
	
	if(hoge(p,t)) p_array(t);
	
	return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
using namespace std;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
	string s;
	cin >> s;
	ll sum = 0;
	for(auto x : s){
		sum += x-'0';
	}
	cout << (sum%9==0 ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
 
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 pair<int, int> PII;
typedef pair<long, long> PLL;
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 SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL 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);
const int INF=INT_MAX;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))



int main(){
	int N,W;
	cin>>N>>W;
	vector<int>w,v;
	vector<int>dp;
	dp.assign(W+2,0);
	REP(i,N){
		int vt,wt;
		cin>>vt>>wt;
		v.PB(vt);w.PB(wt);
	}
	int res=0;
	
	REP(i,N){
		REP(wt,W){
			if(wt+w[i]<=W){
				dp[wt+w[i]]=max(dp[wt+w[i]],dp[wt]+v[i]);
				res=max(res,dp[wt+w[i]]);
			}
		}
	}

	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1260
#include<stdio.h>
#include<math.h>
int main(void){
   int n, count = 0, i, s, key;
   long a;
   while ( scanf("%d", &n) != EOF ) {
   key = 0;
   for ( a = n - 1; a > 1; a-- ) {
      s = 2;
      if ( a == 2 ) {/*printf("sosuu\n")*/ printf("%d ", a);}
      else {
         while ( s < sqrt(a) + 2 ) {
            if ( a % s == 0 ) { key = 1; break;}
            s++;
         }
      }
      if ( s > sqrt(a) + 1) { printf("%d ", a); break; }
   }
   for ( a = n + 1; a < 100000; a++ ) {
      s = 2;
      if ( a == 2 ) {/*printf("sosuu\n")*/ printf("%d\n", a);}
      else {
         while ( s < sqrt(a) + 2 ) {
            if ( a % s == 0 ) { key = 1; break;}
            s++;
         }
      }
      if ( s > sqrt(a) + 1) { printf("%d\n", a); break; }
   }
   }
   return 0;
}

Measured memory_bytes: 1800
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=5010;
ll c[N],p[N],q[N<<1],u[N<<1];
vector<ll>V[N];
bool vis[N];
int main(){
    ll n,k;scanf("%lld %lld",&n,&k);
    for(int i=1;i<=n;i++)scanf("%lld",&p[i]);
    for(int i=1;i<=n;i++)scanf("%lld",&c[i]);
    int now=0;
    for(int i=1;i<=n;i++){
        if(vis[i])continue;
        int x=i;now++;
        while(!vis[x]){
            vis[x]=true;V[now].push_back(c[x]);
            x=p[x];
        }
    }
    ll ans=-2e18;
    for(int i=1;i<=now;i++){
        ll sum=0,sum1=0,k1=k,siz=V[i].size();
        int num=0;
        for(auto it:V[i])q[++num]=it;
        for(auto it:V[i])q[++num]=it;

        for(int j=1;j<=min(siz,k1);j++)
        {
            ll po=0,mx=-2e18,no=0;
            for(int l=1;l<=num;l++)
            {
                no+=q[l];if(l-po>j)no-=q[++po];
                mx=max(mx,no);
            }
            u[j]=mx;
            ans=max(ans,mx);
        }

        for(auto it:V[i])sum+=it;
        ll t=(k1-1)/siz;
        k1-=t*siz;
        if(sum>0)sum1+=t*sum;
        for(int j=1;j<=k1;j++)ans=max(ans,sum1+u[j]);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 4288
#include <bits/stdc++.h>
using namespace std;
int n,cnt1,cnt2,cnt4,x;
int main()
{
    scanf("%d",&n);
    while (n--) {
        scanf("%d",&x);
        if (x%2!=0)
            ++cnt1;
        else if (x%4!=0)
            ++cnt2;
        else
            ++cnt4;
    }
    if (cnt1<=cnt4)
        puts("Yes");
    else if (cnt1>cnt4+1)
        puts("No");
    else if (cnt1==cnt4+1&&!cnt2)
        puts("Yes");
    else
        puts("No");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

	int n, m;
	int fi[1001];
	int dice[1001];
	int s;
	int cnt = 1;

	while (1){

		cin >> n >> m;
		if (n == 0 && m == 0) break;

		for (int i = 1; i <= n; i++){
			cin >> fi[i];
		}
		for (int i = 1; i <= m; i++){
			cin >> dice[i];
		}

		s = 1;
		cnt = 1;
		while (1){
			s += dice[cnt];
			if (s >= n){
				cout << cnt << endl;
				break;
			}
			s += fi[s];
			if (s >= n){
				cout << cnt << endl;
				break;
			}
			cnt++;
		}
	}

	return 0;
}

Measured memory_bytes: 1164
unittest
{
	assert( [ "4 3 2 3", "1 4 1 100", "1 2 1 10", "1 3 20 1" ].parse.expand.solve == "999999999999998\n999999999999989\n999999999999979\n999999999999897" );
	assert( [ "8 12 3 8", "2 8 685087149 857180777", "6 7 298270585 209942236", "2 4 346080035 234079976", "2 5 131857300 22507157", "4 8 30723332 173476334", "2 6 480845267 448565596", "1 4 181424400 548830121", "4 5 57429995 195056405", "7 8 160277628 479932440", "1 6 475692952 203530153", "3 5 336869679 160714712", "2 7 389775999 199123879" ].parse.expand.solve == "999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994" );
}



import std.algorithm;
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 nmst = input.front.split.to!( long[] );
	nmst[ 2 .. $ ] -= 1;
	auto uvabs = new long[ 4 ][ nmst[ 1 ] ];
	foreach( ref uvab; uvabs )
	{
		input.popFront;
		uvab = input.front.split.to!( long[] );
		uvab[ 0 .. 2 ] -= 1;
	}
	return tuple( nmst[ 0 ], nmst[ 2 ], nmst[ 3 ], uvabs );
}

auto solve( long n, long s, long t, long[ 4 ][] uvabs )
{
	// 都市sから各都市へ移動する最小コスト（円）を計算
	auto as = dijkstra!( true )( n, uvabs, 2, s );
	
	// 各都市から都市tへ移動する最小コスト（スヌーク）を計算
	auto bs = dijkstra!( true )( n, uvabs, 3, t );
	
	// 都市sから都市iへ移動して両替後に都市tへ移動する場合の最小コスト（円＋スヌーク）を計算
	auto anss = new long[ n ];
	auto m = long.max;
	foreach_reverse( i, ref ans; anss )
	{
		m = min( m, as[ i ] + bs[ i ] );
		ans = 10L ^^ 15 - m;
	}
	return anss.to!( string[] ).join( "\n" );
}

// 正の重み付きグラフの始点指定最短経路探索（ダイクストラ法）
auto dijkstra( bool undirected = false )( long n, long[ 4 ][] es, long c, long s )
{
	import std.container.binaryheap;
	
	auto ds = new long[ n ];
	ds[] = long.max;
	ds[ s ] = 0;
	auto us = new bool[ n ];
	auto uc = 0L;
	
	auto nss = new Tuple!( long, long )[][ n ];
	foreach( e; es )
	{
		nss[ e[ 0 ] ] ~= tuple( e[ 1 ], e[ c ] );
		static if( undirected ) nss[ e[ 1 ] ] ~= tuple( e[ 0 ], e[ c ] );
	}
	
	auto queue = heapify!( ( a, b ) => b[ 1 ] < a[ 1 ] )( new Tuple!( long, long )[ es.length ], 0 );
	queue.insert( tuple( s, 0L ) );
	while( !queue.empty )
	{
		auto fi = queue.front[ 0 ];
		auto fd = queue.front[ 1 ];
		queue.popFront();
		
		if( us[ fi ] ) continue;
		us[ fi ] = true;
		uc++;
		if( uc == us.length ) break;
		
		foreach( t; nss[ fi ] )
		{
			auto ti = t[ 0 ];
			auto td = fd + t[ 1 ];
			
			if( ds[ ti ] <= td ) continue;
			ds[ ti ] = td;
			queue.insert( tuple( ti, td ) );
		}
	}
	return ds;
}


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

bool isEvenString(std::string s){
  int N = s.size() / 2;
  if(s.substr(0, N) == s.substr(N, N)) return true;
  else return false;
}

int main(){
  std::string s;
  std::cin >> s;
  if(s.size() % 2 == 1) s.pop_back();
  else{
    s.pop_back();
    s.pop_back();
  }
  while(s.size() > 1){
    if(isEvenString(s)) break;
    else{
      s.pop_back();
      s.pop_back();
    }
  }
  std::cout << s.size() << std::endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll M1,M2,D1,D2;
	cin>>M1>>D1>>M2>>D2;
	if(D2==1){
		cout<<1<<endl;
	}else{
		cout<<0<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
 
#define rep(i, n) for(int i = 0; i < (n); ++i)
 
using namespace std;

typedef long long ll;

const ll inf = 1e11;

int n, k;
int a[15];

ll calc(int f){
    int s = 0;
    ll c = 0;
    rep(i, n){
        if(f >> i & 1 && a[i] <= s){
            ++s;
            c += s - a[i];
        }
        else{
            s = max(a[i], s);
        }
    }
    return c;
}

int main(){
    cin >> n >> k;
    rep(i, n){
        cin >> a[i];
    }

    ll ans = inf;
    rep(i, 1 << n){
        int c = 0;
        rep(j, n){
            c += i >> j & 1;
        }
        if(c >= k){
            ans = min(calc(i), ans);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sstream> //C++
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
#include <map> //C++

using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)

//scanf("%d",&x);
//printf("%d",x);
//for(i=0;i<N;i++){  }
//if( == ){  }else{  }
//while( ){  }

/*
int N, i;
int H[100];
scanf("%d", &N);
for (i = 0; i < N; i++) scanf("%s", &H[i]);
*/




int main()
{
	

		int N;
		int s;
		map<int, int> m;
		cin >> N;
		for (int i = 0; i < N-1; ++i) {
			cin >> s;
			m[s]++;
		}
		
		

		for (int i = 1;i<=N; ++i) {

			cout << m[i] << endl;
			
		} // m[入力単語]の最大値をmaxに代入

		
	
		return 0;




	

}




Measured memory_bytes: 12976
import queue
n,m = map(int,input().split())
g = [[] for _ in range(n)]
edge = []
for _ in range(m):
  a,b = map(int,input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)
  edge.append([a-1,b-1])

def bfs(u,v):
  is_visited = [False]*n
  que = queue.Queue()
  is_visited[0] = True
  que.put(0)
  while not que.empty():
    cur = que.get()
    for i in g[cur]:
      if is_visited[i]==True: continue
      if cur==u and i==v: continue
      if cur==v and i==u: continue
      is_visited[i] = True
      que.put(i)
  return all(is_visited)

c = 0
for i,j in edge:
    if not bfs(i,j): 
      c += 1
print(c)
    

Measured memory_bytes: 4080
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#define rep(i,rept) for(long long i = 0; i <(long long)rept;i++)
using namespace std;
int main() {
	int a = 0, b = 0, c = 0, d[100000], e[100000], f = 0, g = 0, h = 0, count = 0,x=0,y=0,z=0;
	char rikka, toka[100000];
	string saya, homu, kyok, mami, mado[50];
	bool gg = false;
	int manji, nk[26] = { false };
	cin >> a>>b>>x>>y;
	for (int i = 0; i < a; i++) {
		cin >> d[i];
	}
	for (int j = 0; j < b; j++) {
		cin >> e[j];
		if (j == 0) {
			count = e[j];
		}
		else {
			count = std::min(count, e[j]);
		}
	}
	for (int k = 0; k < a; k++) {
		if (count <= d[k]) {
			cout << "War" << endl;
			return 0;
		}
	}
	if (x >= count || y < count) {
		cout << "War" << endl;
		return 0;
	}
	cout << "No War" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100
int n,a[N][N],b[N],c[N],d[N],t;
int Q[N*2],head,tail;

void enqueue(int x){
  Q[tail++]=x;
}
int dequeue(){
  int x;
  x=Q[head++];
  return x;
}
int empty(){
  return head==tail;
}
void bfs(int p){
  int i,u,v;
  enqueue(p);
  for(i=0;i<n;i++){
    b[i]=100000;
  }
  b[p]=0;
  while(!empty()){
    u=dequeue();
    for(v=0;v<n;v++){
      if(a[u][v]==0) continue;
      if(b[v]!=100000) continue;
      b[v]=b[u]+1;
      enqueue(v);
    }
  }
    for(i=0;i<n;i++){
    printf("%d %d\n",i+1,((b[i]==100000)?(-1):b[i]));
  }
}

int main(){
  int i,j,u,v,k;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      a[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
     for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      a[u][v]=1;

    }
  }
  bfs(0);
  return 0;
}


Measured memory_bytes: 2028
INPUT = input().split()
r = int(INPUT[0])
D = int(INPUT[1])
X = int(INPUT[2])

XX = []

ans = ""
XX.append(X)

i = 0
while i < 10:
    v = r * XX[i] - D
    XX.append(v)
    ans = ans + str(XX[i + 1]) + '\n'
    i += 1

print(ans)

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

using namespace std;

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

  sort(H.begin(),H.end(),greater<int>());
  long long int count = 0;

  for(int i = K; i < N; i++){
    count += H[i];
  }

  cout << count;

  return 0;
}





Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
using namespace std;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int i,n,a,b,ans=0;
	cin>>n>>a>>b;
	int p[n];
	for(i=0;i<n;i++)cin>>p[i];
	int numa=0,numb=0,numc=0;
	for(i=0;i<n;i++){
		if(p[i]<=a)numa++;
		if(a<p[i]&&p[i]<=b)numb++;
		if(p[i]>b)numc++;
	}
	cout<<min(numa,min(numb,numc))<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
  vector<int> A(3);
  for (int i=0; i<3; i++) cin >> A[i];
  sort(A.begin(),A.end());
  if (A[0]==5&&A[1]==5&&A[2]==7) {
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
}

Measured memory_bytes: 384
#include <cstddef>
#include <complex>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>

using ll = long long;
using ull = unsigned long long;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }

int main()
{
    using namespace std;

    ll n, m;
    cin >> n >> m;

    vec<pair<ll, ll>> v(n);

    for (auto& e : v)
    {
        cin >> e.first >> e.second;
    }

    sort(v.begin(), v.end(), [](pair<ll, ll> a, pair<ll, ll> b){return a.first < b.first;});

    // for (auto & e : v)
    // {
    //     cout << e.first << " " << e.second << endl;
    // }

    ll ans{};
    ll count{};

    for (auto& e : v)
    {
        if (count >= m)
            break;
        
        if (count + e.second < m)
        {
            count += e.second;
            ans += e.first * e.second;
        }
        else
        {
            auto c = m - count;
            count += c;
            ans += e.first * c;
        }
        //cout << count << " " << ans << endl;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::cmp::max;
fn main(){
    input!{
        n:usize,
        an:[i64;n],
        bn:[i64;n],
    }
    let mut ans = 0;
    for j in 0..n {
        ans = max(an.iter().take(j+1).sum::<i64>() + bn.iter().skip(j).sum::<i64>(),ans);
    }
    println!("{}",ans);
}

Measured memory_bytes: 4352
def main():
    from itertools import accumulate as ac
    from bisect import bisect_right as br
    n=int(input())
    a=list(map(int,input().split()))
    b=list(ac([0]+a))
    ans=[]
    for i in range(2,n-1):
        l=b[i]
        r=b[n]
        lc=br(b,l/2)
        rc=br(b,l+(r-l)/2)
        temp_l=[]
        temp_r=[]
        if lc>1:
            temp_l.append([b[lc-1],l-b[lc-1]])
        if lc<i:
            temp_l.append([b[lc],l-b[lc]])
        if rc>i+1:
            temp_r.append([b[rc-1]-l,r-b[rc-1]])
        if rc<n:
            temp_r.append([b[rc]-l,r-b[rc]])
        temp_l.sort(key=lambda x:abs(x[0]-x[1]))
        temp_r.sort(key=lambda x:abs(x[0]-x[1]))
        temp=temp_l[0]+temp_r[0]
        temp.sort()
        ans.append(temp[-1]-temp[0])
    print(min(ans))
main()

Measured memory_bytes: 30500
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin >> a;
  
  int s1, s2, s3 ;
  s1 = a/100;
  s2 = (a % 100) / 10 ;
  s3 = a % 10 ;
  
 cout << s1+s2+s3 << endl ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 25005;
const int MAXK = 405;
const int P = 1e9 + 7;
typedef long long ll;
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int power(int x, int y) {
	if (y == 0) return 1;
	int tmp = power(x, y / 2);
	if (y % 2 == 0) return 1ll * tmp * tmp % P;
	else return 1ll * tmp * tmp % P * x % P;
}
void update(int &x, int y) {
	x += y;
	if (x >= P) x -= P;
}
int n, k, m, a[MAXN];
int solveb() {
	static int f[MAXN][MAXK], g[MAXN][MAXK], cnt[MAXK];
	int l = m, r = m;
	memset(cnt, 0, sizeof(cnt));
	for (int i = 1; i <= m; i++)
		if (++cnt[a[i]] == 2) {
			l = i - 1;
			break;
		}
	memset(cnt, 0, sizeof(cnt));
	for (int i = m; i >= 1; i--)
		if (++cnt[a[i]] == 2) {
			r = m - i;
			break;
		}
	f[0][l] = g[0][r] = 1;
	for (int i = 1; i <= n; i++) {
		int sf = 0, sg = 0;
		for (int j = k; j >= 1; j--) {
			if (j != k) update(sf, f[i - 1][j]);
			if (j != k) update(sg, g[i - 1][j]);
			f[i][j] = sf, update(f[i][j], 1ll * f[i - 1][j - 1] * (k - j + 1) % P);
			g[i][j] = sg, update(g[i][j], 1ll * g[i - 1][j - 1] * (k - j + 1) % P);
		}
		update(f[i][k], 1ll * f[i - 1][k]* k % P);
		update(g[i][k], 1ll * g[i - 1][k]* k % P);
	}
	int ans = 0;
	for (int l = 0, r = n - m; r >= 0; l++, r--) {
		int sf = 0, sg = 0;
		for (int i = 1; i <= k - 1; i++) {
			update(sf, f[l][i]);
			update(sg, g[r][i]);
		}
		update(ans, 1ll * sf * g[r][k] % P);
		update(ans, 1ll * sg * f[l][k] % P);
		update(ans, 1ll * f[l][k] * g[r][k] % P);
	}
	return ans;
}
int solveu() {
	static int f[MAXN][MAXK];
	for (int i = 1; i <= k - 1; i++)
		f[0][i] = 1;
	for (int i = 1; i <= n; i++) {
		int sf = 0;
		for (int j = 1; j <= k - 1; j++) {
			update(sf, f[i - 1][j]), f[i][j] = sf;
			update(f[i][j], 1ll * f[i - 1][j + 1] * (k - j) % P);
		}
		f[i][k] = 1ll * f[i - 1][k] * k % P;
	}
	int ans = solveb(), fac = 1;
	for (int i = 1; i <= k - m; i++)
		fac = 1ll * fac * i % P;
	for (int l = 0, r = n - m; r >= 0; l++, r--)
	for (int i = 1, j = k - m - i; j >= 1; i++, j--)
		if (i <= l && j <= r) update(ans, 1ll * fac * f[l - i][k - 1] % P * f[r - j][j + m] % P);
	return ans;
}
bool Unique() {
	static int cnt[MAXK];
	for (int i = 1; i <= m; i++)
		cnt[a[i]]++;
	for (int i = 1; i <= k; i++)
		if (cnt[i] >= 2) return false;
	return true;
}
bool contain() {
	static int cnt[MAXK], l = 1;
	for (int i = 1; i <= m; i++) {
		if (++cnt[a[i]] == 2) {
			while (cnt[a[i]] == 2) cnt[a[l++]]--;
		}
		if (i - l + 1 == k) return true;
	}
	return false;
}
int main() {
	read(n), read(k), read(m);
	for (int i = 1; i <= m; i++)
		read(a[i]);
	if (contain()) writeln(1ll * (n - m + 1) * power(k, n - m) % P);
	else if (Unique()) writeln(solveu());
	else writeln(solveb());
	return 0;
}

Measured memory_bytes: 118912
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    if((a+b)%2==0){
      System.out.println((a+b)/2);
    }
    else{
      System.out.println("IMPOSSIBLE");
    }
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    string s;
    cin >> s;
    int n = s.size();
    ll mod = 1e9 + 7;
    vector<ll> dp3(n+1, 1);
    for(int i = 1; i <= n; i++) {
        dp3[i] = (dp3[i-1] * 3) % mod;
        //cout << "dp3" << i << " = " << dp3[i] << endl;
    }
    reverse(s.begin(), s.end());
    ll ans = 1;
    for(int i = 0; i < n; i++) {
        if (s[i] == '1') {
            ans = ((ans * 2) + dp3[i]) % mod;
        }
    }
    cout << ans << endl;

    return 0;
}




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


int min(int a, int b){
  if(a>b) return b ;
  else return a ;
}

int main(){
  int N , i ,sum=0;
  cin >> N ;
  int A[N],B[N-1] ;
  
  for(i=0;i<N-1;i++){
    cin >> B[i] ;
  }
  
  A[0] = B[0] ;
  A[N-1] = B[N-2] ;
  
  for(i=1;i<N-1;i++){
    A[i] = min(B[i-1],B[i]) ;
  }
  
  for(i=0;i<N;i++){
    sum += A[i];
  }
  
  cout << sum ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[100005],f[100005],k;
int mini(int d){
    int res=INT_MAX;
    for(int i=d-1;i>=0;--i){
        res=min(f[i]+abs(a[i]-a[d]),res);
        if(d-i==k){
            break;
        }
    }
    return res;
}
int main(){
    cin >> n >> k;
    for(int i=0;i<n;++i){
        cin >> a[i];
    }
    f[0]=0;
    for(int i=1;i<n;++i){
        f[i]=mini(i);
    }
    cout << f[n-1];
    return 0;
}

Measured memory_bytes: 1024
#![allow(dead_code)]
macro_rules! debug {
    ($($arg:tt)*) => (if cfg!(debug_assertions) {print!("[DEBUG] "); println!($($arg)*)});
}

fn f(b: i64, n: i64) -> i64 {
    return if n < b {
        n
    } else {
        f(b, n / b) + n % b
    };
}

fn main() {
    let mut rd = reader::Reader::new();

    let x: i64 = rd.next();
    let y: i64 = rd.next();

    println!("{}", if (x - y).abs() > 1 { "Alice" } else { "Brown" });
}

mod reader {
    use std::fmt::Debug;
    use std::str::FromStr;
    use std::collections::VecDeque;
    use std::io::{self, Read};

    fn _read_line() -> String {
        let mut buf = String::new();
        let _ = io::stdin().read_to_string(&mut buf);
        buf
    }

    fn _read_vec_deque_string() -> VecDeque<String> {
        _read_line()
            .split_whitespace()
            .map(|s| s.to_string())
            .collect()
    }

    pub struct Reader {
        buf: VecDeque<String>,
    }

    impl Reader {
        pub fn new() -> Reader {
            Reader { buf: VecDeque::new() }
        }

        fn update_buf(&mut self) {
            if self.buf.is_empty() {
                self.buf = _read_vec_deque_string();
            }
        }

        pub fn next<T>(&mut self) -> T
            where
                T: FromStr,
                T::Err: Debug,
        {
            self.update_buf();
            self.buf.pop_front().unwrap().parse::<T>().unwrap()
        }

        pub fn next_n<T>(&mut self, n: usize) -> Vec<T>
            where
                T: FromStr,
                T::Err: Debug,
        {
            let mut vec: Vec<T> = Vec::with_capacity(n);

            for _ in 0..n {
                vec.push(self.next());
            }
            vec
        }
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,n) for(int i = 0; i , (n); ++i)
using ll = long long;
using namespace std;
int sum(int n) {
    if (n == 0) {
        return 0;
    }

    int s = sum(n - 1);
    return s + n;
}
int main() {
    char s;
    cin >> s;

    if (isupper(s))
    {
        cout << "A" << endl;
    }
    else
    {
        cout << "a" << endl;
    }

    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)



struct modCalc{
	int mod;
	int n;
	vector<int> fact,invfact;
	modCalc(){};

	modCalc(int _mod,int _n){
		mod=_mod,n=_n;
		fact.resize(n+1,1);
		invfact.resize(n+1,1);

		for(int i=0;i<n;i++)fact[i+1]=fact[i]*(i+1)%mod;
		invfact[n]=modinv(fact[n]);
		for(int i=n;i>1;i--)invfact[i-1]=invfact[i]*i%mod;
	};

	int modpow(int x,int n){
		int ret=1;
		while(n>0){
			if(n&1)(ret*=x)%=mod;
			(x*=x)%=mod;
			n>>=1;
		}
		return ret;
	}
	int modinv(int x){
		return modpow(x,mod-2);
	}
	int nCm(int x,int y){
		if(y==0)return 1;
		else return fact[x]*invfact[y]%mod*invfact[x-y]%mod;
	}
	int nPm(int x,int y=-1){
		if(y==-1)y=x;
		return fact[x]*invfact[x-y]%mod;
	}
};


signed main() {
	int q;cin>>q;
	vector<int>x(q),d(q),n(q);
	rep(i,q)cin>>x[i]>>d[i]>>n[i];
	int mod=1e6+3;
	modCalc mc(mod,mod-1);
	
	rep(i,q){
	int x0=x[i],d0=d[i],n0=n[i];
	if(x0==0){cout<<0<<endl;continue;}
	if(d0==0){cout<<mc.modpow(x0,n0)<<endl;continue;}
	if(n0==1){cout<<x0<<endl;continue;}

	int dn=mc.modpow(d0,n0);
	int xd=mc.modinv(d0)*x0%mod;
	if(xd+n0-1>=mod){cout<<0<<endl;continue;}
	int ret=mc.nPm(xd+n0-1,n0)*dn%mod;	
	cout<<ret<<endl;
	}
	

}


Measured memory_bytes: 20608
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#if defined(_MSC_VER)
#pragma warning(disable : 4996)  // VSでscanfを使う．
#endif

signed main() {
  map<char, int> m;
  string s;
  cin >> s;
  for (int i = 0; i < 4; i++) {
    m[s[i]]++;
  }

  for (auto it = m.begin(); it != m.end(); it++) {
    if (it->second != 2) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;
template<typename T> void print(T t) {cout << t << endl;}
;
int main() {
	int N, a, over3200 = 0;
	cin >> N;
	bool col[8] = {};
	for (int i = 0; i < N; i++) {
		cin >> a;
		if (a / 400 <= 7) {
			col[a / 400] = true;
		}
		else {
			over3200++;
		}
	}

	int under3200 = 0;
	for (int i = 0; i < 8; i++) {
		if (col[i]) under3200++;
	}

	cout << max(under3200, 1) << " " << under3200 + over3200 << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

// Binary Indexed Tree (Fenwick Tree)
// https://youtu.be/lyHk98daDJo?t=7960
template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};


int main(){
  int n, q;
  cin >> n >> q;
  vector<int> c(n);
  vector<int> ps(n, -1);
  vector<vector<P> > pn(n);
  vector<int> counted(n, -1);
  rep(i, n){
    cin >> c[i];
    c[i]--;
    if(counted[c[i]]!=-1){
      ps[i]=counted[c[i]];
    }
    counted[c[i]]=i;
  }
  rep(i, q){
    int l, r;
    cin >> l >> r;
    l--; r--;
    pn[r].emplace_back(l, i);
  }
  BIT<int> d(n);
  vector<int> ans(q);
  rep(i, n){
    int y=ps[i];
    if(y!=-1){
      d.add(y, 1);
    }
    for(P p: pn[i]){
      int index=p.second, pnl=p.first;
      ans[index]=i-pnl+1-(d.sum(n-1)-d.sum(pnl-1));
    }
  }
  rep(i, q){
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 35112
S = [s for s in input()]

stack1 = []
stack2 = []

for i in range(len(S)):
    if S[i] == '\\':
        stack1.append(i)
    elif S[i] == '/':
        if len(stack1) != 0:
            pos = stack1.pop()
            area = i - pos
            while len(stack2) != 0:
                pair = stack2.pop()
                if pos < pair[0]:
                    area += pair[1]
                else:
                    stack2.append(pair)
                    break
            stack2.append((pos, area))

print(sum([s[1] for s in stack2]))
print(len(stack2), *[s[1] for s in stack2])


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

// main.cpp

int main() {
  std::int_fast64_t a, b;
  std::cin >> a >> b;
  std::string s;
  std::cin >> s;

  for (std::int_fast64_t i = 0; i < a; ++i) {
    if (!('0' <= s[i] && s[i] <= '9')) goto FAILED;
  }
  if (s[a] != '-') goto FAILED;
  for (std::int_fast64_t i = a + 1; i < a + b + 1; ++i) {
    if (!('0' <= s[i] && s[i] <= '9')) goto FAILED;
  }
  std::cout << "Yes" << std::endl;
  return 0;

FAILED:
  std::cout << "No" << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
//#include <vector>
#include <algorithm>
//#include <functional>


int main(){
    int32_t N;
    std::cin >> N;
    int64_t res = 0;
    if(N < 10){
        res = N;
    }
    else{
        if(N < 100){
            res = 9;
        }
        else if(N >= 100 && N < 1000){
            res = (N - 90);
        }
        else{ //N>= 1000
            if(N < 10000){
                res = 909;
            }
            else if(N >= 10000 && N < 100000){
                res = N - 9090;
            }
            else{
                res = 90909;
                //std::cout << "unexpected input" << std::endl;
            }
        }
    }
    std::cout << res;

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from itertools import accumulate


def read():
    N = int(input().strip())
    A = []
    for i in range(N):
        a = int(input().strip())
        A.append(a)
    return N, A


def solve(N, A):
    L = list(accumulate(A, max))
    R = list(accumulate(A[::-1], max))[::-1]
    for i in range(N):
        ans = 0
        if i > 0:
            ans = max(ans, L[i-1])
        if i < N-1:
            ans = max(ans, R[i+1])
        print(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 15808
#
import sys
import math
import numpy as np
import itertools

# いくつか入力
n,h,w = (int(i) for i in input().split())  

# n行複数列の数をリストに
ab = [[int(i) for i in input().split()] for i in range(n)] 

answer = 0

for i in range(n):
    if(h <= ab[i][0] and w <= ab[i][1]):
        answer += 1

print(answer)




Measured memory_bytes: 21320
N = int(input())
T = list(map(int, input().split()))
M = int(input())
PX = [tuple(map(int, input().split())) for _ in range(M)]

temp = sum(T)

for i, (p, x) in enumerate(PX):
    ans = temp - T[p - 1] + x
    print(ans)

Measured memory_bytes: 3060