akhauriyash/Code-Regression huggingface dataset:
N = int(input())

btc_jpy_rate = 380000.0
jpy = []
btc = []
for i in range(N):
    amount, currency = map(str,input().split())
    amount = float(amount)
    if currency == 'JPY':
        jpy.append(amount)
    else:
        btc.append(amount)

otoshidama = sum(jpy) + sum(btc) * btc_jpy_rate
print(otoshidama)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <iomanip>//小数精度 	cout << fixed << setprecision(5) << tmp << endl;
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define All(X)      (X).begin(),(X).end()

int n,w;
int dp[101][100001];
int val[101];
int wei[101];
int rec(int i,int j){
	if(dp[i][j] >= 0) return dp[i][j];
	int res;
	if(i==n){
		res = 0;
	}else if(j<wei[i]){
		res = rec(i+1,j);
	}else{
		res = max(rec(i+1,j),rec(i+1,j-wei[i]) + val[i]);
	}
	return dp[i][j] = res;
}

int main(){

	cin >> n >> w;
	REP(i,n) cin >> val[i] >> wei[i];

	memset(dp,-1,sizeof(dp));
	cout << rec(0,w) <<endl;
	return 0;
}

Measured memory_bytes: 40624
N = gets.to_i
lst = gets.split(' ').map(&:to_i).uniq.sort

min = lst.min

if min == 1
  puts 1
  exit
end

loop do
  tmp_size = lst.min
  lst = lst.map do |i|
    if (i % min).zero?
      i
    else
      i % min
    end
  end.uniq.sort
  min = lst.min
  
  break if tmp_size == lst.min
end

puts lst[0]


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

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

    string s, ans = "Yes";
    cin >> s;

    sort(s.begin(), s.end());

    if (s[0] == s[1] && s[2] == s[3] && s[2] != s[1])
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
#include<vector>

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long typeLong;

using namespace std;

const int INF = 0;

int main()
{
	
	//棟・階・部屋番号
	int apartments[4][3][10] = {0};

	int N;
	cin >> N;

	rep(i, N) {
		int b, f, r, v;
		
		cin >> b >> f >> r >> v;
		b--; f--; r--;
		apartments[b][f][r] += v;
	}

	rep(i, 4) {
		rep(j, 3) {
			rep(k, 10) {
				cout << " " << apartments[i][j][k];
			}
			cout << endl;

			if (j == 2 && i != 3) {
				rep(k, 20) { cout << "#"; }
				cout << endl;
			}
			
		}
	}

	return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1);
const ll mod=1e9+7;
typedef long long ll;
int f[65];
int main()
{
    int n;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        ll a;
        scanf("%lld",&a);
        for(ll j=0; j<62; j++)
            if(a&((ll)1<<j))
                f[j]++;
    }
    ll sum=0;
    for(ll i=0; i<62; i++)
    {
        sum+=(((((ll)1<<i)%mod)%mod)*(n-f[i])%mod)*f[i]%mod;
        sum%=mod;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
h,w=map(int,input().split());w+=2
s=["."*w]+["."+input()+"." for _ in[0]*h]+["."*w]
for i in range(1,h+2):
	for j in range(1,w):
		if s[i][j]=="#":
			if "#" not in (s[i-1][j],s[i+1][j],s[i][j-1],s[i][j+1]):
				print("No");exit()
print("Yes")


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){

	int a, b, c, s;
	cin >> a >> b >> c;
	s = a;
	a = b;
	b = s;
	s = a;
	a = c;
	c = s;

	cout << a << " " << b << " " << c;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;
#define PI 3.141592653589793

int main() {
  ll H, W, K, first_line = 0, tmp_num = 0, tmp_loc = 0, cnt = 1;
  bool first = false;
  cin >> H >> W >> K;
  vector<vector<char>> str(H, vector<char>(W));
  vector<vector<int>> cut(H, vector<int>(W));
  vector<pair<int, int>> line_num(H);
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> str.at(i).at(j);
      if (first == false && str.at(i).at(j) == '#') {
        first_line = i;
        first = true;
      }
      if (str.at(i).at(j) == '#') {
        tmp_num++;
        tmp_loc = j;
      }
      if (j == W - 1) {
        line_num.at(i) = make_pair(tmp_num, tmp_loc);
        tmp_num = 0;
      }
    }
  }

  for (int i = first_line; i < H; i++) {
    if (line_num.at(i).first > 0) {
      for (int j = 0; j < W; j++) {
        cut.at(i).at(j) = cnt;
        if (str.at(i).at(j) == '#' && j < line_num.at(i).second) cnt++;
        if (j == W - 1) cnt++;
      }
    }
    else {
      for (int j = 0; j < W; j++) {
        cut.at(i).at(j) = cut.at(i-1).at(j);
      }
    }
  }

  if (first_line > 0) {
    for (int i = 0; i < first_line; i++) {
      for (int j = 0; j < W; j++) {
        cut.at(i).at(j) = cut.at(first_line).at(j);
      }
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << cut.at(i).at(j) << " ";
      if (j == W - 1) cout << endl;
    }
  }

}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pii> vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<pair<ll,ll> > > vvpll;
typedef vector<bool> vb;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef map<ll,ll> mll;

#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) x.begin() , x.end()
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define F first
#define S second
#define left (node << 1)
#define right (node << 1) + 1
// #define mod 998244353
#define mod 1000000007 

#define trace1(x)                       cerr<<#x<<": "<<x<<endl
#define trace2(x, y)                    cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)                 cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(x, y, z , t)             cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#t<<": "<<t<<endl
#define trace5(x, y, z , t , u)         cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#t<<": "<<t<<" | "<<#u<<": "<<u<<endl
#define trace6(x, y, z , t , u , v)     cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#t<<": "<<t<<" | "<<#u<<": "<<u<<" | "<<#v<<": "<<v<<endl

#define repa(i,sta,end,inc) for(int i = sta ; i <= end ; i += inc)
#define repb(i,sta,end,inc) for(int i = sta ; i >= end ; i -= inc)

ll power(ll x , ll y , ll z){ll res = 1;x %= z;while(y){if(y&1){res = res * x % z;}x = x*x % z;y /= 2;}return res%z;}
ll gcd(ll a , ll b){return (b == 0 ? a : gcd(b , a % b));}

void solve(){
    int n , k;
    cin >> n >> k;
    int ans = 0;
    while(n){
        n /= k;
        ans ++;
    }
    cout << ans << endl;
}


int main(){
    FIO;
    int tc = 1;
    // cin >> tc;
    repa ( i , 1 , tc , 1){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,t=0,w=0;
    cin>>n;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a==i+1){
            w++;
            }
        if(a!=i+1 || i==n-1){
            t+=(w+1)/2;
            w=0;
        }
    }
    cout<<t<<endl;
}


Measured memory_bytes: 256
def solve():
    N = int(input())
    dp = [float('inf')] * (N+1)
    dp[0] = 0

    for i in range(1,N+1):
        # 1yen
        dp[i] = min(dp[i], dp[i-1]+1)

        # 6 ** n yen
        n = 1
        while i - pow(6,n) >= 0:
            dp[i] = min(dp[i], dp[i-pow(6,n)]+1)
            n += 1

        # 9 ** n yen
        n = 1
        while i - pow(9,n) >= 0:
            dp[i] = min(dp[i], dp[i-pow(9,n)]+1)
            n += 1
    
    print(dp[-1])

if __name__ == '__main__':
    solve()

Measured memory_bytes: 44240
#include "iostream"
#include "cmath"
using namespace std;
int main()
{
	int x[11], r, d;
	cin >> r >> d >> x[0];
	for (int i = 0; i < 10; i++)
	{
		x[i + 1] = r * x[i] - d;
		cout << x[i + 1] << endl;
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef long long ll;

ll fn(int n){
	if(n == 1)
		return 1;
	return n * fn(n-1);
}

int main(){
	int n;
	cin>>n;
	cout << fn(n) << endl;
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    ll N;
    ll ans = 0;

    cin >> N;

    for(ll i = 1; i < N + 1; i++){
        if(i % 3 != 0 && i % 5 != 0){
            ans += i;
        }
    }

    cout << ans << endl;

    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
#define PI acos(-1.0)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int main()
{
 
    int n, a[100010], i, k, l, r;
    cin>>n>>k;
    vi v;
    for(i=0;i<n;i++)cin>>a[i];
    for(i=0;i<=n-k;i++){
        l=abs(a[i])+abs(a[i]-a[i+(k-1)]);
        r=abs(a[i+(k-1)])+abs(a[i]-a[i+(k-1)]);
        v.pb(l);
        v.pb(r);
    }
    sort(v.begin(),v.end());
    cout<<v[0]<<endl;
    return 0;
}

Measured memory_bytes: 1276
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,ans;
  cin >> n;
  vector<int>a(n);
  for(int i;i<n;i++){
    cin >> a.at(i);
  }
  int p=a.at(0);
  ans=0;
  for(int i;i<n;i++){
    if(p<=a.at(i)){
      ans+=1;
      p=a.at(i);
    }
  }
  cout << ans;
}

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

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

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

const ll MAX = 1e5 + 10;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

string S;
ll dp[MAX][13];

int main(){
    cin >> S;

    dp[0][0] = 1;
    rep(i, S.size()){
        if(S[i] == '?'){
            rep(j, 13){
                rep(k, 10){
                    int num = j * 10 + k;
                    dp[i + 1][num % 13] += dp[i][j];
                    dp[i + 1][num % 13] %= MOD;
                }
            }
        } else {
            rep(j, 13){
                int num = j * 10 + (S[i] - '0');
                dp[i + 1][num % 13] += dp[i][j];
                dp[i + 1][num % 13] %= MOD;
            }
        }
    }

    cout << dp[S.size()][5] << endl;
}

Measured memory_bytes: 10624
#include <iostream>
#include <vector>
//#include <string>
#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main() {
    LL n;
    vector<LL> a;
    cin >> n;
    LL tmp;
    while(n>0){
        n--;
        tmp=n%26;
        n/=26;
        a.push_back(tmp);
    }

    reverse(a.begin(), a.end());
    for(LL i=0; i<a.size(); i++){
        cout << (char)(a[i]+'a');
    }
    cout << endl;

    return 0;
}

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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
//#define int ll
#define swap(x, y)((x)^=(y)^=(x)^=(y))
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define tcase int _; cin>> _; for( ; _; --_)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const double DEG = 180/PI;
const int MOD = 998244353;
int mod(int x, int m){ if(x >= 0) return x % m; if(-x < m) return m-(-x); return mod(x%m, m);}
int gcd (int a, int b) {while(b){a = mod(a, b); swap(a, b);} return a;}
int lcm (int a, int b) {return a / gcd(a, b) * b;}
int fexp(int base, int exp, int m){
	int total = 1;
	while(exp > 0){
		if(exp % 2 == 1){
			total = mod(((mod(total, m)) * (mod(base, m))), m);
			exp--;
		}
		base= mod((mod(base, m) * mod(base, m)), m);
		exp /= 2;
	}
	return mod(total, m);
}

void solve(){
	int n, s;
	cin>> n >> s;

	vi a(n);

	for(int &i: a) cin>> i;

	int dp[n*s + 1];

	memset(dp, 0, sizeof(dp));
	int ans = 0;

	for(int i = 0; i<n; ++i){
		dp[0] = mod(dp[0] + 1, MOD);

		for(int j = s - a[i]; j >=0; --j){
			dp[j + a[i]] = mod(dp[j + a[i]] + dp[j], MOD);
		}
		ans = mod(ans + dp[s], MOD);
	}
	cout<< ans << endl;
}

int32_t main(){
	fastio;
	solve();
	return 0;
}

Measured memory_bytes: 38768
D,G = map(int,list(input().split()))

p_tatal = []
for i in range(D):
    p,c = map(int,list(input().split()))
    p_tatal.append([p,p*(i+1)*100+c])

ans = 10**18
for i in range(2**D):
    binary = bin(i)[2:].zfill(D)
    tatal = 0
    cnt = 0
    for j in range(D):
        if binary[j]=='1':
            tatal += p_tatal[j][1]
            cnt += p_tatal[j][0]
        else:
            not_use = j
#    print(1tatal,cnt)   
    if tatal >= G:
#        print(cnt)
        ans = min(ans,cnt)
    elif tatal < G <=  tatal +(p_tatal[not_use][0]-1)*(not_use+1)*100:
        cnt += -(-(G - tatal)// ((not_use+1)*100))
#        print(cnt)
        ans = min(ans,cnt)
    else:
        continue
        

print(ans)    



Measured memory_bytes: 3064
import sys
from math import log

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def modinv(x, mod):
    a, b = x, mod
    u, v = 1, 0
    while b:
        t = a // b
        a -= t * b; a, b = b, a
        u -= t * v; u, v = v, u
    return u % mod


def solve():
    mod = 10**9 + 7
    n, k = nm()
    a = nl()
    a.sort(key=abs, reverse=True)

    if max(a) <= 0 or n == k:
        if k & 1:
            b = a[-k:]
        else:
            b = a[:k]
        d = 1
        for x in b:
            d = d * x % mod
        print(d)
        return

    d = 1
    for x in a[:k]:
        d = d * x % mod
    g = [x < 0 for x in a]

    if sum(g[:k]) % 2 == 0:
        print(d)
        return

    b = list(map(lambda x:-10000 if x == 0 else log(abs(x)), a))
    mpi = mmi = -1
    Mpi = Mmi = -1
    for i in range(k):
        if a[i] <= 0:
            mmi = i
        if a[i] >= 0:
            mpi = i
    for i in range(n-1, k-1, -1):
        if a[i] <= 0:
            Mmi = i
        if a[i] >= 0:
            Mpi = i
    if (mpi == -1 or Mmi == -1) and (mmi == -1 or Mpi == -1):
        if 0 in a: d = 0
    elif (mpi == -1 or Mmi == -1):
        d = d * a[Mpi] * modinv(a[mmi], mod) % mod
    elif (mmi == -1 or Mpi == -1):
        d = d * a[Mmi] * modinv(a[mpi], mod) % mod
    else:
        if a[Mpi] * a[mpi] >= a[Mmi] * a[mmi]:
            d = d * a[Mpi] * modinv(a[mmi], mod) % mod
        else:
            d = d * a[Mmi] * modinv(a[mpi], mod) % mod
    print(d)

    return

solve()


Measured memory_bytes: 31956
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <string.h>
#include <math.h>
#define pi 3.1415926535

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> x(n), y(n);
	for(int i = 0; i < n; i++){
		cin >> x.at(i);
	}
	for(int i = 0; i < n; i++){
		cin >> y.at(i);
	}
	
	/*pow(数字, 1 / n条痕のn)*/
	double p1 = 0;
	double p2 = 0;
	double p3 = 0;
	double p4 = 0;
	int tmp_p1 = 0;
	double tmp_p2 = 0;
	double tmp_p3 = 0;
	for(int i = 0; i < n; i++){
		tmp_p1 = abs(x.at(i) - y.at(i));
		tmp_p2 += tmp_p1*tmp_p1;
		tmp_p3 += tmp_p1*tmp_p1*tmp_p1;
		p4 = max(p4, (double)tmp_p1);
		p1 += tmp_p1;
	}
	p2 = sqrt(tmp_p2);
	p3 = pow(tmp_p3, 1.0/3.0);
	
	
	printf("%.8lf\n%.8lf\n%.8lf\n%.8lf\n", p1, p2, p3, p4);
}



Measured memory_bytes: 3360
import java.util.Scanner;
public class Main {
    


    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
       
      
        System.out.println(A*B);

        sc.close();

    }
}

Measured memory_bytes: 35672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(long long N, long long X, long long Y){
    vector<ll> counter(N-1,0);
    for (ll i=0;i<N;i++){
        for (ll j=i+1;j<N;j++){
            ll res = min(j-i,1 + abs(X-1-i) + abs(Y-1-j));
            counter[res-1] += 1;
        }
    }
    for (const auto c: counter){
        printf("%lld\n",c);
    }

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    solve(N, X, Y);
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		Y/=1000;
		int a=-1,b=-1,c=-1,flag=0;
		for(int i=0;i<=N;i++) {
			for(int j=0;i+j<=N;j++) {
				int k = N-i-j;
				if(i*10+j*5+k==Y) {
					a=i;
					b=j;
					c=k;
					flag=1;
					break;
				}
			}
			if(flag==1) break;
		}
		System.out.printf("%d %d %d\n",a,b,c);
	}
}

Measured memory_bytes: 23252
n = int(input())
 
x = input().split()
x = [int(_x) for _x in x]
 
_p = sum(x) // n
 
_p_value = sum([(_x - _p) ** 2 for _x in x])
__p_value = sum([(_x - _p + 1) ** 2 for _x in x])
___p_value = sum([(_x - _p - 1) ** 2 for _x in x])
 
print(min(_p_value, min(__p_value, ___p_value)))


Measured memory_bytes: 3064
weekday=["Monday", "Tuesday", "Wednesday", "Thursday",
         "Friday", "Saturday", "Sunday"]

def monthday(month):
    if month in [1,3,5,7,8,10,12]: return 31
    elif month in [4,6,9,11]: return 30
    else: return 29

def days(month, day):
    return sum([monthday(i) for  i in range(1, month)]) + day
   
while True:
    m, d = map(int, raw_input().split())
    if m==0: break
    diff = days(m,d)-1
    print weekday[(diff +3)% 7]

Measured memory_bytes: 4240
#include "algorithm"
#include "cmath"
#include "iostream"
#include "map"
#include "string"
#include "unordered_map"
#include "vector"
constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9;
using namespace std;

int main() {
  double A, B;
  cin >> A >> B;
  cout << (int)ceil((B - 1) / (A - 1));
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,D,Q,K,R,W,H,P,L;
ll ans;
string S,T;
ll y[101010];
ll a[101010];
ll b[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll r[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};
ll sr,sc;
int main() {
    cin>>N>>K;
    cout<<N-K+1;
	return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>


using namespace std;

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

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

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

const ll mod = 1e9 + 7;
const ll inf = 1<<29;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//

int main() {
    _upgrade;

    int n;
    cin >> n;

    int tmp;
    bool flag = true;
    set<int> a;

    for(int i = 0; i < n; i++){
        cin >> tmp;

        if(a.find(tmp) != a.end()){
            flag = false;
        }
        a.insert(tmp);
    }

    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 9600
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C: Shopping Street
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;
const int M = 10;
const int MBITS = 1 << M;
const int INF = 1 << 30;

/* typedef */

/* global variables */

int bnums[MBITS], fbits[MAX_N], ps[MAX_N][M + 1];

/* subroutines */

/* main */

int main() {
  bnums[0] = 0;
  for (int bits = 1, msb = 1; bits < MBITS; bits++) {
    if ((msb << 1) <= bits) msb <<= 1;
    bnums[bits] = bnums[bits ^ msb] + 1;
  }

  int n;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    fbits[i] = 0;
    for (int j = 0, bj = 1; j < M; j++, bj <<= 1) {
      int f;
      scanf("%d", &f);
      if (f) fbits[i] |= bj;
    }
  }

  for (int i = 0; i < n; i++)
    for (int j = 0; j <= M; j++) scanf("%d", &ps[i][j]);

  int maxsum = -INF;
  for (int bits = 1; bits < MBITS; bits++) {
    int sum = 0;
    for (int i = 0; i < n; i++) sum += ps[i][bnums[bits & fbits[i]]];
    if (maxsum < sum) maxsum = sum;
  }
  printf("%d\n", maxsum);

  return 0;
}


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

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

#define dbs cout<<"Debug\n";
#define dbar(arr,n) cout<<"DBAR: "; for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<'\n';

#define fl(i,n) for(ll i=0;i<n;i++)
#define al(z) for(auto it : z)

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1; //cin>>t;
    while(t--)
    {
        ll n,k,res=-1;
        cin>>n;
        vector<vector<ll>>v(n);
        fl(i,n)
        {
            fl(j,3)
            {
                cin>>k;
                v[i].push_back(k);
            }
        }
        ll dp[n][3];
        fl(i,n) fl(j,3) dp[i][j] = 0;
        fl(i,n)
        {
            res = -1;
            if(i==0)
            {
                dp[i][0] = v[i][0];
                dp[i][1] = v[i][1];
                dp[i][2] = v[i][2];
            }
            else
            {
                dp[i][0] = v[i][0] + max(dp[i-1][1], dp[i-1][2]);
                dp[i][1] = v[i][1] + max(dp[i-1][0], dp[i-1][2]);
                dp[i][2] = v[i][2] + max(dp[i-1][0], dp[i-1][1]);
            }
        }
        fl(i,3)
        {
            res = max(res, dp[n-1][0]);
            res = max(res, dp[n-1][1]);
            res = max(res, dp[n-1][2]);
        }
        cout<<res<<endl;
    }
    return 0;
}


Measured memory_bytes: 12712
#include <iostream>
#include <string>
#include <vector>
#include <queue>
using namespace std;

int map[100][100] = {};
int w, h;

void reset(){
	for(int i = 0;i<100;i++){
		for(int j = 0;j<100;j++){
			map[i][j] = 0;
		}
	}
}

int main(){
	while(cin >> w >> h){
		if (!w && !h) break;
		reset();
		for(int i = 0;i<2 * h -1;i++){
			if (i % 2 == 0) {
				for (int j = 0; j < w - 1; j++) {
					cin >> map[i][2 * j + 1];
				}
			}
			else {
				for (int j = 0; j < w; j++) {
					cin >> map[i][2 * j];
				}
			}
		}
		queue<pair<int, int>> que;
		que.push(pair<int, int>(0, 0));
		int n = 2;
		while(que.size()){
			int que_size = que.size();
			for(int x = 0;x<que_size;x++){
				pair<int, int> now = que.front();
				que.pop();
				if( now.first < h-1 && map[now.first * 2 + 1][now.second * 2] == 0 && map[(now.first + 1) * 2][now.second * 2] == 0){
					map[(now.first + 1) * 2][now.second * 2] = n;
					que.push(pair<int, int>(now.first + 1, now.second));
				}
				if (now.first > 0 && map[now.first * 2 - 1][now.second * 2] == 0 && map[(now.first - 1) * 2][now.second * 2] == 0) {
					map[(now.first - 1) * 2][now.second * 2] = n;
					que.push(pair<int, int>(now.first - 1, now.second));
				}
				if (now.second < w-1 && map[now.first * 2][now.second * 2 + 1] == 0 && map[now.first * 2][(now.second + 1) * 2] == 0) {
					map[now.first * 2][(now.second + 1) * 2] = n;
					que.push(pair<int, int>(now.first, now.second + 1));
				}
				if (now.second > 0 && map[now.first * 2][now.second * 2 - 1] == 0 && map[now.first * 2][(now.second - 1) * 2] == 0) {
					map[now.first * 2][(now.second - 1) * 2] = n;
					que.push(pair<int, int>(now.first, now.second - 1));
				}
			}
			n++;
		}
		cout << map[(h-1) * 2][(w-1) * 2] << endl;
	}
	return 0;
}

Measured memory_bytes: 3120
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in));
		String N = BR.readLine();
		if (N.charAt(0) == '7' || N.charAt(1) == '7' || N.charAt(2) == '7') System.out.println("Yes");
		else System.out.println("No");
	}
}


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

def nC2(n):
    return n * (n - 1) // 2

d = {}
for i in a:
    if i in d.keys():
        d[i] += 1
    else:
        d[i] = 1
    
s = sum([nC2(i) for i in d.values()])

for i in a:
    print(s + (1 - d[i]))

Measured memory_bytes: 26140
def main():
    n, k = map(int, input().split())
    s = [int(c) for c in input()]
    bl = []
    # block[0] corresponds to '0'
    if s[0] == 0:
        bl.append(0)
    bl.append(0)
    for i in range(1, n):
        if s[i-1] != s[i]:
            bl.append(i)
    bl.append(n)
    bl.append(n)

    nbl = len(bl)
    m = [bl[i+2*k+1] - bl[i]
         for i in range(nbl - 2*k-1) if i % 2 == 0]
    if len(m) == 0:
        print(n)
    else:
        print(max(m))


main()


Measured memory_bytes: 9368
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */
int b[100];
int main(){
    int n;
    cin >> n;
    rep(i, n-1){
      cin >> b[i];
    }
    b[n-1] = 1 << 30;
    int ans = b[0];
    rep(i, n -1){
        ans += min(b[i], b[i+1]);
    }
    cout << ans << endl;
}



Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using pll = pair<long long, long long>;

int N;
long long D, A;
vector<long long> X, H;

long long solve() {
    // モンスターを X が小さい順に
    vector<int> ids(N);
    for (int i = 0; i < N; ++i) ids[i] = i;
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return X[i] < X[j]; });
    vector<long long> nX(N), nH(N);
    for (int i = 0; i < N; ++i) nX[i] = X[ids[i]], nH[i] = H[ids[i]];
    X = nX, H = nH;

    // imos 法で処理していく
    vector<long long> S(N+1, 0);
    long long res = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] < H[i]) {
            // モンスター i を倒すのに必要な回数
            long long need = (H[i] - S[i] + A - 1) / A;
        
            // X[i] を左端とした爆発が届く範囲を求める
            long long right = X[i] + D * 2;
            int id = upper_bound(X.begin(), X.end(), right) - X.begin();
            
            // imos しながら爆発させる
            S[i] += need * A;
            S[id] -= need * A;
            res += need;
        }

        // imos の累積和をとる操作
        S[i+1] += S[i];
    }
    return res;
}

int main() {
    cin >> N >> D >> A;
    X.resize(N); H.resize(N);
    for (int i = 0; i < N; ++i) cin >> X[i] >> H[i];
    cout << solve() << endl;
}

Measured memory_bytes: 8832
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
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() {
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int> a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    sort(all(a)), sort(all(b));

    bool is_war = true;
    for(int c = a.back()+1; c <= b[0]; c++){
        if(x < c && c < y) is_war = false;
    }
    if(is_war) cout << "War" << ln;
    else cout << "No War" << ln;
}




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

using namespace std;

int main(){
    string str;
    cin >> str;
    char c = str[0];
    int count = 0;
    for(int i=1;i<str.length();i++){
        if(c != str[i]){
            count++;
            c = str[i];
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 512
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
 
 
using namespace std;
void file(){
	#ifndef ONLINE_JUDGE
    	freopen("tst.txt", "r", stdin);
	#endif	
}
int tc;
const int N=3e5+5,M=3e5+5,MOD=1e9+7,OO=1e9;

int a,b;
int main()
{	
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	//file();

 	scanf("%d",&a);
 	
 	for(int i=1;i<10;i++)
 		for(int j=1;j<10;j++)
 			if(i*j == a)return !printf("Yes\n");
 	printf("No\n");
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=10010;
int main()
{
  int n;
  cin>>n;
  int m;
  cin>>m;
  long long answer=0;
  int days[N];
  for(int i = 0 ; i < m ; i++){
    cin>>days[i];
    answer+=days[i];
  }
  if(answer>n){cout<<"-1"; return 0;}

  cout<<n-answer;

  return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
    int l;
    string s;
    cin >> l >> s;
    int size = s.size();
    if(size > l){
        cout << s.substr(0,l) + "..." << endl;
        return 0;
    }
    cout << s;
    return 0;
}
 

Measured memory_bytes: 3592
#include <cstdio>
#include <algorithm>
typedef long long LL;
using namespace std;
const int maxn=1e5+10;

int n,k;
LL ans;
int a[maxn];
LL s[maxn];
LL g[maxn];

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	
	for(int i=1;i<=n;i++)
	{
		s[i]=s[i-1]+(LL)a[i];
		g[i]=g[i-1]+(LL)max(a[i],0);
	}
	
	ans=0;
	for(int i=1;i+k-1<=n;i++)
	    ans=max(ans,max((LL)0,s[i+k-1]-s[i-1])+g[n]-g[i+k-1]+g[i-1]-g[0]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<ll, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef pair<P, int> PP;
int main() {
	ll x, y; cin >> y >> x;
	ll mi = INF;
	if (x - y >= 0) {
		mi = min(mi, x - y);
	}
	if (-x - y + 1 >= 0) {
		mi = min(mi, -x - y + 1);
	}
	if (x + y + 1 >= 0) {
		mi = min(mi, x + y + 1);
	}
	if (-x + y + 2 >= 0) {
		mi = min(mi, -x + y + 2);
	}
	cout << mi << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<iomanip>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
        
    }
    
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n;
string s;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> s;
    int len = s.length();
    for (int i = 0; i < len; i++) {
        s[i] = ((s[i] - 'A') + n)%26 + 'A';
    }
    cout << s << E;
    //system("pause");
    return 0;
}

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

int h,w,n,col[110][110];

int main(){
	cin>>h>>w;
	cin>>n;
	int i=1,j=1,f=1;;
	for (int k=1;k<=n;k++){
		int c;
		cin>>c;
		while (c--){
			col[i][j]=k;
			j+=f;
			if (j<=0 || j>w){
				i++;
				f*=-1;
				if (f==1) j=1;
				else j=w;
			}
		}
	}
	for (i=1;i<=h;i++){
		for (j=1;j<=w;j++){
			cout<<col[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
D = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        D += ((d[i][0] - d[j][0])**2 + (d[i][1] - d[j][1])**2)**(1 / 2)
print(2 * D / n)


Measured memory_bytes: 2940
#include <bits//stdc++.h>
using namespace std;
#define int long long
#define rep(i,n,k) for(int i=n;i<k;i++)
#define P make_pair
#define F first
#define S second
#define M LLONG_MAX
signed main(void){
    int n,m,ans,p,q;
    ans=0;
    string s,s1,s2;
    vector<int> v;
    cin>>n>>m>>p;
    q=min(m-1,p);
    cout<<(n*q)/m-n*(q/m)<<endl;
    
}


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

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

  int ans = 0;
  for(int i = 1;i < n;i++){
    if(a[i-1] == a[i]){
      ans++;
      a[i] = 10001;
    }
  }

  cout << ans << endl;





  return 0;
}

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

#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) for(int i=int(n-1);i>=0;i--)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define D(a) cerr << #a << " = " << a << endl
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
typedef pair<int,int> pii;
typedef long long int ll;
typedef vector<int> vi;
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    
    int a,b,c; cin >> a >> b >> c;
    swap(a,b), swap(a,c);
    cout << a << ' ' << b << ' ' << c << endl;

    return 0;
}


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

constexpr static int MOD = 1000000000 + 7;
constexpr static int inf = INT_MAX / 2;
constexpr static llong INF = 1LL<<31;
constexpr static int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    llong a, b;
    cin >> a >> b;
    if (abs(a - b) <= 1) cout << "Brown";
    else cout << "Alice";
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main
// g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vll = vector<vl>;
using vii = vector<vi>;
using pii = pair<int, int>;

using vc = vector<char>;
using vcc = vector<vc>;
using vb = vector<bool>;
using vbb = vector<vb>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using vd = vector<double>;
using vdd = vector<vd>;

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i, a, b) for(int (i) = a; (i) < (b);(i)++)
#define MAX(a, b) ((a > b) ? a : b)
#define MIN(a, b) ((a > b) ? b : a)

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


const int MOD = 1e9 + 7;

vector<pii> prime_factorization(int n){ // 素因数分解をしたvector<素数, 指数>を返す
  vector<pii> res;
  int tmp, root_n = floor(sqrt(n));
  if(n % 2 == 0){
    tmp = 1;
    n /= 2;
    while(n % 2 == 0){
      n /= 2;
      tmp++;
    }
    res.push_back(make_pair(2, tmp));
  }
  ll i = 3;
  while(i <= root_n && i <= n){
    if(n % i == 0){
      tmp = 1;
      n /= i;
      while(n % i == 0){
        n /= i;
        tmp++;
      }
      res.push_back(make_pair(i, tmp));
    }
    i += 2;
  }
  if(n != 1) res.push_back(make_pair(n, 1));
  return res;
}
vector<pli> prime_factorization(ll n){ // 素因数分解をしたvector<素数, 指数>を返す
  vector<pli> res;
  int tmp, root_n = floor(sqrt(n));
  if(n % 2 == 0){
    tmp = 1;
    n /= 2;
    while(n % 2 == 0){
      n /= 2;
      tmp++;
    }
    res.push_back(make_pair(2, tmp));
  }
  ll i = 3;
  while(i <= root_n && i <= n){
    if(n % i == 0){
      tmp = 1;
      n /= i;
      while(n % i == 0){
        n /= i;
        tmp++;
      }
      res.push_back(make_pair(i, tmp));
    }
    i += 2;
  }
  if(n != 1) res.push_back(make_pair(n, 1));
  return res;
}

// n は 2以上の素数表を返す
vb Primes(int n){
  vector<bool> res(n + 1, true);
  res.at(0) = false; res.at(1) = false;
  for(int i = 2; i <= sqrt(n); i++){
    if(res.at(i)){
      for(int j = 2 * i; j <= n; j += i){
        res.at(j) = false;
      }
    }
  }
  return res;
}
// ===================================================


ll power(ll a, int n){
  if(n == 0) return 1;
  ll prev = power(a, n / 2);
  if((n & 1) == 0) return prev * prev;
  return a * prev * prev;
}

int main(){
  ll n, p, res = 1; cin >> n >> p;
  vector<pli> v = prime_factorization(p);
  for(pli x : v){
    res *= power(x.first, x.second / n);
  }
  cout << res << endl;
  return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;

  vector<vector<int>> MN(M, vector<int>(N, 0));
  for (int i = 0; i < M; i++) {
    int K;
    cin >> K;
    for (int j = 0; j < K; j++) {
      int S;
      cin >> S;
      MN.at(i).at(S - 1) = 1;
    }
  }

  vector<int> P(M);
  for (int i = 0; i < M; i++) cin >> P.at(i);

  int ans = 0;

  for (int i = 0; i < 2 << (N - 1); i++) {
    int X = 1;
    for (int j = 0; j < M; j++) {
      int Y = 0;
      for (int k = 0; k < N; k++) {
        if (i >> k & MN.at(j).at(k)) Y++;
      }
      if (Y % 2 != P.at(j)) X = 0;
    }
    if (X) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
l=[list(input()) for i in range(n)]
s=set()
ans=[]
for i in l:
    for j in i:
        s.add(j)
s=sorted(s)
x=[[] for i in range(len(s))]
for i in range(len(s)):
    for j in range(n):
        x[i].append(l[j].count(s[i]))
for i in range(len(s)):
    ans.append(s[i]*min(x[i]))
print("".join(ans))


Measured memory_bytes: 39152
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	int n = s.size();
	int ans = 0;
	rep(bit, (1 << n - 1)) {
		int now = 0;
		rep(i, n) {
			now *= 10;
			now += s[i] - '0';
			
				if (bit & (1 << i)) {
					ans += now;
					now = 0;
				}
			
		}
		ans += now;
	}
	cout << ans << endl;
	return 0;
}

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

const int INF = 1001001001;

int a[12][12];

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    rep(i,n){
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }

    //bit演算子を利用
    int ans = INF;
    rep(s,1<<n){
        int cost = 0;
        vector<int> d(m);
        rep(i,n){
            //ibit目に1が立っているかを判定
            if(s>>i&1){
                cost += c[i];
                rep(j,m) d[j] += a[i][j];
            }
        }
        bool ok = true;
        rep(j,m) if(d[j] < x) ok = false;
        if(ok) ans = min(ans, cost);
    }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3572
#include<cstdio>
#include<map>
#include<algorithm>
using namespace std;
#define ll long long
inline char tc(void){
	static char fl[10000],*A=fl,*B=fl;
	return A==B&&(B=(A=fl)+fread(fl,1,10000,stdin),A==B)?EOF:*A++;
}
inline int read(void){
	int a=0,f=1;char c;
	while((c=tc())<'0'||c>'9')c=='-'?f=-1:0;
	while(c>='0'&&c<='9')a=a*10+c-'0',c=tc();
	return a*f;
}
map<ll,int>h;
int n;
ll now,ans;
int main(void){
	register int i,x;
	n=read(),h[0]=1;
	for(i=1;i<=n;++i)x=read(),now+=x,ans+=h[now],++h[now];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
#define N 400005
#define ll long long
using namespace std;
int n,m;
int head[N],ver[N],nxt[N],tot;
void add(int a,int b)
{
    tot++;nxt[tot]=head[a];head[a]=tot;ver[tot]=b;return ;
}
int v[N];
int cnt,flag,sz,szz,tp;
void dfs(int x,int c)
{
    cnt++;v[x]=c;
    for(int i=head[x];i;i=nxt[i])
    {
        if(v[ver[i]]==-1)dfs(ver[i],c^1);
        else if(v[ver[i]]!=(c^1))flag=1;
    }
    return ;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        int t1,t2;
        scanf("%d%d",&t1,&t2);
        add(t1,t2);add(t2,t1);
    }
    ll ans=0;memset(v,-1,sizeof(v));
    for(int i=1;i<=n;i++)
    {
         cnt=0;flag=0;
         if(v[i]==-1)dfs(i,0);
         if(cnt)
         {
             if(flag||cnt==1)ans++;
             else ans+=2;
             if(cnt==1)tp++;
             else
             {
                 if(!flag)szz++;
                 else sz++;
             }
         }
    }
   //cout<<tp<<" "<<sz<<" "<<szz<<endl;
    ans=1ll*tp*n+1ll*tp*(n-tp)+1ll*sz*szz*2+1ll*sz*sz+2ll*szz*szz;
    cout<<ans<<endl;
    return 0;
}

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

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define int long long
#define endl '\n'

using namespace std;

const int N = 2e5 + 77;
int A[N];

int32_t main(){
    fast;
    int a  ,b  , c , d ; cin >> a >> b >> c >> d;
    int ans1 = a*c , ans2 = a*d , ans3 = b*c , ans4 = b*d;
    cout << max(max(ans1,ans2),max(ans3,ans4)) << endl;
    return 0;
}

Measured memory_bytes: 3648