akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
int summation(int a){return a < 1 ? 0 : (a * a + a) / 2;}

int n, tmp, res = 0;
string s;
main(){
    INCANT;
    in(n);
    rep(i, n + 1){
        if(summation(i) >= n){
            tmp = i;
            break;
        }
    }
    rev(i, tmp + 1, 1){
        if(res + i <= n){
            print(i);
            res += i;
        }
    }
}


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

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define REP(i, n) for(LL i = 0; i < n; ++i)
#define FOR(i, a, n) for(LL i = a; i < n; ++i)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

//#define int long long

/*************** using variables ***************/
int h, w;
char t[21][21];
/**********************************************/

void dfs(int x, int y){
    if(t[y][x] != '.' && t[y][x] != '@') return;
    t[y][x] = '*';
    if(x+1 < w)  dfs(x+1, y);
    if(x-1 >= 0) dfs(x-1, y);
    if(y+1 < h)  dfs(x, y+1);
    if(y-1 >= 0) dfs(x, y-1);
    return;
}

int solve(){
    int atx = -1, aty = -1;
    REP(i, h){
        if(atx != -1 && aty != -1) break;
        REP(j, w){
            if(t[i][j] == '@'){
                aty = i; atx = j;
                break;
            }
        }
    }
    dfs(atx, aty);
    int ans = 0;
    REP(i, h){
        REP(j, w){
            if(t[i][j] == '*') ans++;
        }
    }
    return ans;
}

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

    while(cin >> w >> h, h + w){
        REP(i, h){
            REP(j, w){
                cin >> t[i][j];
            }
        }
        cout << solve() << endl;
    }
}



Measured memory_bytes: 3156
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int n = sc.nextInt();
			if (n == 0)
				return;
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = sc.nextInt();

			int M = -Integer.MAX_VALUE / 2;
			for (int i = 0; i < n; i++) {
				int sum = 0;
				for (int j = i; j < n; j++) {
					sum += a[j];
					M = Math.max(M, sum);
				}
			}
			System.out.println(M);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 26992
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

int main(){
    int n,k;
    cin >> n >> k;
    if(2*k-1>n){
        cout << -1 << endl;
        return 0;
    }
    if(n%2==0){
        for(int i=0;i<n;i++){
            if(i<n/2){
                cout << k+i << " " << k+n/2+i+n << " " << k+2*n+2*i << endl;
            }else{
                cout << k+i << " " << k-n/2+i+n << " " << k+1+n+2*i << endl;    
            }
        }
    }else{
        for(int i=0;i<n;i++){
            if(i<=n/2){
                cout << k+i << " " << k+n/2+i+n << " " << k+2*n+2*i << endl;
            }else{
                cout << k+i << " " << k-n/2+i+n-1 << " " << k+n+2*i << endl;    
            }
        }
    }
    return 0;
}

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;

  if(A > B){
  	if(A > C){
    	cout << (10*A)+B+C << endl;
    }else{
    	cout << (10*C)+A+B << endl;
    }
  }else{
  	if(B > C){
    	cout << (10*B)+A+C << endl;
    }else{
    	cout << (10*C)+A+B << endl;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp  make_pair
#define pb  push_back
#define INF 1e9+5
void c_p_c(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void solve(){
    int n;
    cin>>n;
    vector<int> dp(3);
    for(int i=0;i<n;i++){
        vector<int> c(3);
        for(int i=0;i<3;i++){
            cin>>c[i];
        }
        vector<int>dp1(3,0);
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(i!=j){
                    dp1[j]=max(dp1[j],c[j]+dp[i]);
                }
            }
        }
        dp=dp1;
    }
    int k=max(dp[0],dp[1]);
    int ans=max(k,dp[2]);
    cout<<ans<<endl;
}
int32_t main(){
    c_p_c();
    int t;
    t=1;
    //cin>>t;
    while(t--){
       solve(); 
    }
	return 0;
}


Measured memory_bytes: 3612
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long startNum = (long)Math.floor(Math.sqrt(N));
    long aite = 1;
    long answer =0;
    boolean prime = true;
    for(long i=startNum;i>0;i--){
      if(N%i==0){
        aite=i;
        prime = false;
        break;
      }
    }
    if(prime){
      answer = N-1;
    }else{
      answer = ((N/aite)-1)+((aite)-1);
    }

    System.out.println(answer);
      
    
  }
  

  
}

Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    char b;
    cin >> b;

    string s = "ATCG";
    string t = "TAGC";

    cout << t[s.find(b)] << endl;

    return 0;
}

Measured memory_bytes: 256
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var H = Console.ReadLine().Split(' ');
            int i, j, output = 0;
            for(i = 0; i < N; i++)
            {
                for (j = 0; j < i; j++)
                {
                    if(int.Parse(H[j]) > int.Parse(H[i]))
                    {
                        break;
                    }
                }
                if(i == j)
                {
                    output++;
                }
            }
            Console.WriteLine(output);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll memo[100001];
ll findans(ll h[],ll i,ll n)
{
    if(i==n-1)
    {
        return 0;
    }
    if(i==n-2)
    {
        return abs(h[i]-h[i+1]);
    }
    if(memo[i]!=-1)
    {
        return memo[i];
    }
    ll ans1=abs(h[i]-h[i+1])+findans(h,i+1,n);
    ll ans2=abs(h[i]-h[i+2])+findans(h,i+2,n);
    return memo[i]=min(ans1,ans2);
}
int main(){
    // Your code here!
    ll n;
    cin>>n;
    ll h[n];
    for(ll i=0;i<n;i++)
    {
        cin>>h[i];
    }
    for(ll i=0;i<=100000;i++)
    {
        memo[i]=-1;
    }
    cout<<findans(h,0,n);
    
    
}


Measured memory_bytes: 9600
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BC
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  [n, x] <- map readInt . BC.words <$> BC.getLine
  ms <- map readInt . BC.lines <$> BC.getContents
  print $ solve n x ms

solve :: Int -> Int -> [Int] -> Int
solve n x ms = n + ((x - s) `div` m)
  where s = sum ms
        m = minimum ms

readInt :: BC.ByteString -> Int
readInt = fst . fromJust . BC.readInt


Measured memory_bytes: 508
n, x = map(int, raw_input().split())
a = map(int, raw_input().split())
a.sort()
ans = s = 0
for i, t in enumerate(a):
    if s > x:
        break
    for j in xrange(i, n):
        if s + a[j] == x:
            ans = i + 1
        if ans < i:
            ans = i
    s += t
print ans


Measured memory_bytes: 2568
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

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

using ll = long long int;
using pll = pair<ll, ll>;

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

    vector<ll> ds(n);
    rep (i, n) { cin >> ds[i]; }

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

    if (ds.size() % 2 != 0)
    {
        cout << 0 << endl;
    }
    else
    {
        const ll mid = ds.size() / 2;

        const ll lhs = ds[mid - 1];
        const ll rhs = ds[mid];

        cout << (rhs - lhs) << endl;
    }

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <stack>
#include <sstream>

using namespace std;

int main() {

	stack<int> st;
	string str, buf;
	getline(cin, str);
	stringstream ss(str);

	while (ss >> buf) {
		if (buf == "+") {
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(a + b);
		} else if (buf == "-") {
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(b - a);
		} else if (buf == "*") {
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(a * b);
		} else {
			st.push(atoi(buf.c_str()));
		}
	}
	cout << st.top() << endl;
	return 0;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >>d;
    cout << max(a * b, c * d) << endl;

    return 0;
}

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

namespace MyProgram{
    class AtCoder{
        static void Main(){
            int n = int.Parse(Console.ReadLine());
            long[] a = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
            var b_index = 2*n;
            var b = new long[b_index];
            for(var i=0;i<b_index;i++)b[i] = -1;
            for(var i=0;i<n;i++){
                if(i%2==1){
                    b[b_index/2+(i+1)/2] = a[i];
                }else{
                    b[b_index/2-i/2] = a[i];
                }
            }
            if(n%2==1){
                for(var i=0;i<b_index;i++){
                    if(b[i]!=-1)Console.Write("{0} ",b[i]);
                }
            }else{
                for(var i=b_index-1;i>=0;i--){
                    if(b[i]!=-1)Console.Write("{0} ",b[i]);
                }
            }
        }
    } 
}

Measured memory_bytes: 39848
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll ans,s1[200005],s2[200005];
int main(){
	scanf("%d",&n);
	s1[0]=s2[0]=0;
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		s1[i]=s1[i-1]^x;
		s2[i]=s2[i-1]+x;
	}
	int l=1;
	for(int r=1;r<=n;r++){
		while((s2[r]-s2[l-1])!=(s1[r]^s1[l-1]))l++;
		ans+=r-l+1;
	}
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 6832
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    vector<ll> a(3);
    for(int i = 0; i < 3; i++) cin >> a[i];

    ll k; cin >> k;
    sort(all(a), greater<ll>());
    rep(i,0,k) a[0] *= 2;
    cout << accumulate(all(a), 0LL) << endl;
}

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

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef set<int> si;
typedef set<ll> sll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;

const double pi = acos(-1.0);
const long long INF = 2e18;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define in insert
#define endl "\n"

#define sqr(a) ((a) * (a))
#define jor(a) !(a&1)// jor means EVEN number
#define bjor(a) (a&1)// bjor means ODD number

#define all(a)  a.begin(), a.end()
#define mem(arr, b) memset(arr, b, sizeof(arr)) //memset only for -1 and 0
//fill(a, a+n, 5) //fill for any value

#define for0(i,b) for(int i=0;i<(b);i++)
#define for1(i,b) for(int i=1;i<=(b);i++)
#define forab(i,a,b) for(int i=(a);i<=(b);i++)
#define forba(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fileRead freopen("input.txt", "r", stdin);
#define fileWrite freopen("output.txt", "w", stdout);

void print(int a[], int n){ // for testing or debugging
    for(int i=0;i<n;i++)cout<<a[i]<<" "; cout<<endl;
}

//-------------------------------------------------------------------\\


int main()
{
    IOS;
    //fileRead
    int tc = 1;
    //cin>>tc;
    while(tc--)
    {
        ll n; cin>>n;
        ll x,t; cin>>x>>t;
        cout<<(n+x-1)/x*t;
    }
}

Measured memory_bytes: 3576
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h> // sqrt
using namespace std;

int main() {
    long H, W;
    cin >> H >> W;
    if (H == 1 || W == 1) {
        cout << 1 << endl;
        return 0;
    }
    long sum = H * W;
    long ans;
    if (sum % 2 == 0) {
        ans = sum / 2;
    }
    else {
        ans = (sum + 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N,X,T=map(int,input().split())

if N%X==0:
    print(N//X*T)

else:
    print((N//X+1)*T)
















    

                
            





    









        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














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

map<long long, int> counter(vector<long long> sequence){
    map<long long, int> freq;
    for (auto s:sequence){
        freq[s]++;
    }
    return freq;
}

int main(){
    int n,m; cin >> n;
    vector<long long> sequence(n);for (int i=0;i<n;i++){cin>>sequence[i];}
    auto freq = counter(sequence);
    cin >> m;
    bool flag = true;
    long long temp;
    for (int i=0;i<m;i++){
        cin >> temp;
        if (freq[temp] == 0){
            flag = false;
        }
        freq[temp]--;
    }
    if (flag){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 15872
#include<cstdio>
#include<string.h>
#include<algorithm>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<string>
#include<sstream>
#include<math.h>
using namespace std;
//char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
	char a[50][50];
	char b[50][50];int n,m;
	int go(int i,int j){int p1=0;int p2=0;
		for(int k=i;k<m+i;k++){
		for(int s=j;s<m+j;s++){
			if(a[k][s]==b[p1][p2]){if(p1==m-1&&p2==m-1){return 1;}else p2++;}
			else return 0;
		}p2=0;p1++;}
	}//go
int main(){
int ct=0;int p2=0;
					cin>>n>>m;memset(a,'\0',sizeof(a));memset(b,'\0',sizeof(b));
					for(int i=0;i<n;i++){
					for(int j=0;j<n;j++){cin>>a[i][j];}}
					for(int i=0;i<m;i++){
					for(int j=0;j<m;j++){cin>>b[i][j];}}
					for(int i=0;i<n;i++){
					for(int j=0;j<n;j++){
							if(go(i,j)){cout<<"Yes"<<endl;ct++;p2++;break;}
					}if(p2==1)break;}
				if(ct==0)cout<<"No"<<endl;
					
					

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> inline bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> inline bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

template<size_t N>
ll invnum(vector<int>&a){
    size_t n{a.size()};
    ll ans=(ll)n*(n-1)/2;
    int v[N+2]={};
    for(auto x:a){
        ++x;
        for(size_t i=x;i;i-=i&-i) ans-=v[i];
        for(size_t i=x;i<=N;i+=i&-i) ++v[i];
    }
    return ans;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=s.length();
    vector<int> v[26],a(n),b;
    bool f{};
    fr(i,n) v[s[i]-'a'].push_back(i);
    fr(i,26){
        if(v[i].size()&1u){
            if(f) return puts("-1"),0;
            f=true;
        }
        fr(j,v[i].size()/2) b.push_back(v[i][j]);
    }
    sort(b.begin(),b.end());
    fr(i,n/2) a[b[i]]=i;
    fr(i,26){
        if(v[i].size()&1u) a[v[i][v[i].size()/2]]=n/2;
        fr(j,v[i].size()/2) a[v[i][v[i].size()-1-j]]=n-1-a[v[i][j]];
    }
    cout<<invnum<200000>(a)<<endl;
}

Measured memory_bytes: 3852
#include <iostream>
#include <vector>
#include <set> 
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    char x;
    cin>>x;
    if(x>='A'&&x<='Z')cout<<"A";
    else cout<<"a";
    return 0;
}

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

using namespace std;

int main() {
  string S;
  cin >> S;
  long ans=0;
  for (int i = 0; i < (1 << (S.size()-1)); i++) {
    string s;
    // cout << "i:" << i << endl;
    for (int j = 0; j < S.size(); j++) {
      s += S.at(j);
      if (1 & (i >> j) || j == (S.size()-1)) {
        ans += stol(s);
        s = "";
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n ,x) for (int i = x; i < (int)(n); ++i)
#define repBack(i, n) for (int i = n; i >= 0; --i)
#define dup(x, y) (((x) + (y)-1) / (y))
using Graph = vector<vector<int>>;

int main() {
    int N, M;
    cin >> N >> M;
    Graph G(N);
    for (int i = 0; i < M; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a;--b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> dist(N, -1);
    queue<int> que;
    dist[0] = 0;
    que.push(0);
    vector<int> P(N,INF);
    while (!que.empty())
    {
        int v = que.front();
        que.pop();
        for (int nv : G[v])
        {
            if (dist[nv] != -1)
                continue;

            dist[nv] = dist[v] + 1;
            P[nv] = v;
            que.push(nv);
        }
    }
    repX(i,N,1){
        if(P[i]==INF){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    repX(i,N,1){
        cout << P[i]+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 10568
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int N,M,X,a,sum1=0,sum2=0;
    cin >> N >> M >> X;
    for(int i=0;i<M;i++){
            cin >> a;
            if(a>X) sum2++;
            else    sum1++;
    }
    cout << min(sum1,sum2) << endl; 
    return 0;
} 

Measured memory_bytes: 256
import math
N,A,B,C,D = (map(int,input().split(" ")))
size = N - 1
diff = A - B
upper = D * size
bottom = C * size

ans = "NO"
for _ in range(N - 1):
    if bottom <= diff <= upper:
        ans = "YES"
        break
    bottom -=(C+D)
    upper -=(C+D)
print(ans)

Measured memory_bytes: 40428
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
if(s.at(0)==s.at(1)||s.at(1)==s.at(2)||s.at(2)==s.at(3)) cout<<"Bad"<<endl;
else cout<<"Good"<<endl; 
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define d1(x) cout<<#x<<" "<<x<<endl;
#define d2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define d2i(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
#define  mat vector<vector<ll>>
#define all(v) v.begin(),v.end()
///////////////////////////////////////////
void solve(){
  ll n;
  cin>>n;
  const ll N=55556;
  bool p[N+1];
  mems(p,true);
  for( ll i=2;i*i<N;i++){
      if(p[i]){
        for(ll j=i*i;j<N;j+=i){
              p[j]=false;
        }
      }
  }
  vll ans;
  fr(i,2,N){
    if(p[i] && i%5==1){
    ans.pb(i);       
    }
    if(ans.size()==n)
    break;
  }
  for(ll &x:ans){
    cout<<x<<" ";
  }

}




int main(){
    ll t=1;
 // cin>>t;
  ll f=1;
    while(f<=t){
      //  cout<<"Case #"<<f<<": ";
        solve();
        cout<<endl;
        f++;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, M, S[2000], T[2000], DP[2001][2001], s[2001][2001];

int main() {
	cin >> N >> M;
	for (int i = 0; i < N; ++i) {
		cin >> S[i];
	}
	for (int i = 0; i < M; ++i) {
		cin >> T[i];
	}
	for (int i = 0; i <= M; ++i) {
		s[0][i] = 1;
	}
	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= M; ++j) {
			s[i][j] = s[i][j - 1];
			if (S[i - 1] == T[j - 1]) {
				DP[i][j] = s[i - 1][j - 1];
				s[i][j] += DP[i][j];
				s[i][j] %= mod;
			}
		}
		for (int j = 0; j <= M; ++j) {
			s[i][j] += s[i - 1][j];
			s[i][j] %= mod;
		}
	}
	cout << s[N][M] << endl;
}

Measured memory_bytes: 31488
A,B,C=gets.split.map &:to_i
s=0
if B<C then
    s+=2*[B,C].min
    B=0
    C-=s/2
    s+=[A,C].min
    C-=[A,C].min
    if C>0 then s+=1 end
else
    s+=B+C
end
p s

Measured memory_bytes: 1788
#!/usr/bin/env python2
"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>

"""
from __future__ import division, print_function

import itertools
import os
import sys
from atexit import register
from io import BytesIO


class dict(dict):
    """dict() -> new empty dictionary"""

    def items(self):
        """D.items() -> a set-like object providing a view on D's items"""
        return dict.iteritems(self)

    def keys(self):
        """D.keys() -> a set-like object providing a view on D's keys"""
        return dict.iterkeys(self)

    def values(self):
        """D.values() -> an object providing a view on D's values"""
        return dict.itervalues(self)


def gcd(x, y):
    """greatest common divisor of x and y"""
    while y:
        x, y = y, x % y
    return x


range = xrange

filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip

sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))

input = lambda: sys.stdin.readline().rstrip('\r\n')

n, m = map(int, input().split())

w, v = [0.0] * n, [0] * n
for i in range(n):
    wi, vi = input().split()
    w[i], v[i] = float(wi), int(vi)

max_val = sum(v)
dp = [[float('inf')] * (max_val + 1) for _ in range(n)]
for i in range(n):
    dp[i][0] = 0.0

dp[0][v[0]] = w[0]
for i in range(1, n):
    for j in range(max_val + 1):
        if v[i] > j:
            dp[i][j] = dp[i - 1][j]
        dp[i][j] = min(dp[i - 1][j - v[i]] + w[i], dp[i - 1][j])

print(int(max(i for i, val in enumerate(dp[-1]) if val <= m)))


Measured memory_bytes: 111468
from collections import defaultdict
N,M = map(int,input().split(' '))

a = []
b = []
c = []
for i in range(1,M+1):
	a_,b_ = map(int,input().split(' '))
	a.append(a_)
	#b.append(b_)
	c_ = list(map(int,input().split(' ')))
	op = 0
	for t in c_:
		op += (1 << (t-1))
	c.append(op)

dic = defaultdict(lambda: sum(a)+1)
dic[0] = 0
for i in range(M):
	val = a[i]
	op = c[i]
	keys = list(dic.keys())
	for k in keys:
		dic[k | op] = min(dic[k|op] , dic[k] + val)

if dic[2**N-1] == sum(a)+1:
	print(-1)
else:
	print(dic[2**N-1])






Measured memory_bytes: 3956
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>

using namespace std;
static const int N = 100;

int main(){
    int n, u, k, v;
    int M[N][N];
    
    cin >> n;
    
    for(int i =0 ; i<n ; i++){
        for(int j =0 ; j<n ; j++){
            M[i][j] = 0;
        }
    }
    
    for(int i =0 ; i<n ; i++){
        cin >> u >> k;
        u--;
        for(int j =0 ; j<k ; j++){
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }
    
    for(int i =0 ; i<n ; i++){
        for(int j =0 ; j<n ; j++){
            if(j){cout << " ";}
            cout << M[i][j];
        }
        cout << endl;
    }
    
    return 0;
    
}


Measured memory_bytes: 3124
h, w = map(int, input().split())
a0 = '.' * w
r0 = [200] * w
for i in range(h):
  a = input()
  r = [i and 200]
  for x, y, z, u in zip(a0, '.' + a, a, r0):
    r.append(min(u + (x + z == '.#'), r[-1] + (y + z == '.#')))
  a0 = a
  r0 = r[1:]
print(r[-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
using namespace std;

ll N;
vector<ll> lcs;
vector<stack<ll>> st;

vector<ll> ans;
vector<vector<ll>> connection;
vector<ll> A;

void dfs(ll now, ll before) {
  ll a = A.at(now);
  ll index = lower_bound(lcs.begin(), lcs.end(), a) - lcs.begin();
  lcs.at(index) = a;
  st.at(index).push(a);
  ans.at(now) = lower_bound(lcs.begin(), lcs.end(), INF) - lcs.begin();
  for (ll i = 0; i < connection.at(now).size(); ++i) {
    ll next = connection.at(now).at(i);
    if (next == before) {
      continue;
    }
    dfs(next, now);
  }
  st.at(index).pop();
  lcs.at(index) = st.at(index).top();
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N;
  lcs = vector<ll>(N, INF);
  ans =  vector<ll>(N);
  st = vector<stack<ll>>(N);
  for (ll i = 0; i < N; ++i) {
    st.at(i).push(INF);
  }
  A = vector<ll>(N);
  connection = vector<vector<ll>>(N);
  for (ll i = 0; i < N; ++i) {
    cin >> A.at(i);
  }
  for (ll i = 0; i < N - 1; ++i) {
    ll u, v;
    cin >> u >> v;
    u -= 1;v -= 1;
    connection.at(u).push_back(v);
    connection.at(v).push_back(u);
  }
  dfs(0, -1);
  for (ll i = 0; i < N; ++i) {
    cout << ans.at(i) << "\n";
  }
}


Measured memory_bytes: 168368
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
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 ll=long long;
 int main(){
 int n;
   cin>>n;
   vector<int> d={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
   cout<<d[n-1]<<endl;
 }


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n, i, r, m, M;
	cin >> n >> m >> r;
	M = r - m;
	if(r < m) m = r;
	for(i = 2; i < n; i++){
		cin >> r;
		if(r-m > M) M = r-m;
		if(r < m) m = r;
	}
	cout << M << endl;
	return 0;
}


Measured memory_bytes: 3072
# -*- coding: utf-8 -*-       

s = input()
sx = s.replace('x','')
IsPossible = True
for i in range(int(len(sx)/2)):
    if(sx[i] != sx[-(i+1)]) : IsPossible = False

ans = 0
if IsPossible:
    l, r = 0, len(s)-1
    while(l<r):
        if(s[l] == s[r]):
            l += 1
            r -= 1
        elif(s[l]=='x'):
            ans += 1
            l += 1
        elif(s[r]=='x'):
            ans += 1
            r -= 1
    print(ans)
else:
    print(-1)


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

///////////////////////////////////////////
const long long int INF = INT64_MAX;
//const long long int INF = 1000000;
const long long int Mod = 1000000007;
using ll = long long int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
///////////////////////////////////////////////////////////////////////////////////

ll a,b,k;
vi v;
int main(){
    cin>>a>>b>>k;
    if(a+2*k>b){
        rep(i,b-a+1){
            v.pb(a+i);
        }
    }else {
        rep(i, k) {
            if (a + i <= b) { v.pb(a + i); }
        }
        for(int i=b;i>b-k;i--){
            v.pb(i);
        }
    }
    sort(all(v));
    rep(i,v.size())cout<<v[i]<<endl;
    return 0;
}

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

int main(){
    string s, t; cin >> s >> t;
    int ans = t.size();
    for (auto i = 0; i <= (int) s.size() - (int)t.size(); i++) {
        int cnt = 0;
        for (auto j = 0; j < (int)t.size(); j++) if(s[i + j] != t[j]) cnt++;
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstring>
using namespace std;

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

const int MAX = 1000001;

int prime[MAX];

int main()
{
    prime[0] = prime[1] = 1;
    rep(i,MAX)if(!prime[i])
        for(int j = i*2;j<MAX;j+= i) prime[j] = 1;

    int a, b, n;
    while(cin >> a >> b >> n && a)
    {
        int cnt = 0;
        int ans = 0;
        REP(MAX)if(!prime[a + b * i])
        {
            cnt++;
            if(cnt == n){ ans = a+ b * i; break;}
        }
        cout << ans << endl;
        


    }

    return 0;
}

Measured memory_bytes: 0
from fractions import gcd
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
A,B = map(int,input().split())
g=gcd(A,B)
c = collections.Counter(prime_factorize(g))
print(len(c.keys())+1)








Measured memory_bytes: 5048
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let nk = readn::<usize>(" ");
    let n = nk[0];
    let k = nk[1];
    let mut treat = vec![0; n];

    for _ in 0..k {
        let _d = read1::<usize>();
        let a = readn::<usize>(" ");
        for &i in a.iter() {
            treat[i-1] += 1;
        }
    }

    let mut ans = n;
    for &i in treat.iter() {
        if i > 0 {
            ans -= 1;
        }
    }

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

Measured memory_bytes: 2064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    ll A, B, K;
    cin >> A >> B >> K;

    if(A >= K){
        cout << A - K << ' ' << B << endl;
    }else if(A + B >= K){
        cout << 0 << ' ' << B - (K - A) << endl;
    }else{
        cout << 0 << ' ' << 0 << endl;
    }

}

Measured memory_bytes: 256
use proconio::input;

#[proconio::fastout]
fn main() {
    input! {
    mut n:u64,
    }
    let mut v: Vec<u8> = Vec::new();
    while n > 0 {
        n-=1;
        v.push((n % 26) as u8 + b'a');
        n /= 26;
    }
    let ans = v.iter().rev().map(|&c| c as char).collect::<String>();
    println!("{}", ans);
}


Measured memory_bytes: 2180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }

ll gcd(ll x, ll y)
{
    ll temp;
    while (y != 0) {
        temp = y;
        y = x % y;
        x = temp;
    }
    return (x);
}


int main() {
  int n; cin >> n;
  int a[n];
  vector<int> v1;
  vector<int> v2;
  int zerocnt = 0;

  FOR(i,0,n-1) cin >> a[i];
  sort(a,a+n);
  
  FOR(i,0,n-1) {
    
    if(a[i]<0){
      v2.PB(a[i]);
    }
    if(a[i]>=0){
      v1.PB(a[i]);
    }
    // if(a[i]==0) ++zerocnt;
  }

  

  // if(SZ(v1)==0 && SZ(v2)==0){
  //   cout << 0 << endl;
  //   FOR(i,0,n-2){
  //     cout << "0 0" << endl;
  //   }
  //   return 0;
  // }
  // else if(SZ(v1)==1 && SZ(v2)==0){
  //   cout << v1[0] << endl;
  //   FOR(i,0,n-2){
  //     cout << v1[0] << " 0" << endl;
  //   }
  //   return 0;
  // }
  // else if(SZ(v2)==1 && SZ(v1)==0){
  //   cout << -v2[0] << endl;
  //   cout << "0 " << v2[0] << endl;
  //   if(n>2){
  //     FOR(i,0,n-3){
  //       cout << -v2[0] << " 0" << endl;
  //     }
  //   }
  //   return 0;
  // }
  if(SZ(v1)==0){
    v1.PB(v2[SZ(v2)-1]);
    v2.pop_back();
  }
  else if(SZ(v2)==0){
    v2.PB(v1[0]);
    v1.erase(v1.begin());
  }

  FOR(i,0,zerocnt-1){
    v1.PB(0);
  }

  int sum = 0;

  FOR(i,0,SZ(v1)-1) {
    // cout << v1[i] << endl;
    sum += v1[i];
  }
  FOR(i,0,SZ(v2)-1) {
    // cout << v2[i] << endl;
    sum -= v2[i];
  }
  cout << sum << endl;

  if(SZ(v1)>1){
    int sizev1 = SZ(v1);
    int sizev2 = SZ(v2);
    FOR(i,1,sizev1-1){
      cout << v2[sizev2-1] << " " << v1[sizev1-i] << endl;
      v2[sizev2-1] -= v1[sizev1-i];
      v1.pop_back();
    }
  }

  int sizev2 = SZ(v2);
  int ref = 1;
  while(!v2.empty()){
    cout << v1[0] << " " << v2[sizev2-ref] << endl;;
    v1[0] -= v2[sizev2-ref];
    v2.pop_back();
    ++ref;
  }

}



Measured memory_bytes: 2808
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
#define FORR(i,n,m) for(ll i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K

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

    ll d,x;
    cin >> d >> x;

    ll sum = 0;
    REP(i,n){
        ll a;
        cin >>a;
        sum += ll(d/a)+1;
        if(d%a == 0){
            sum--;
        }
        //cout << ll(d/a) << endl;
        //cout << sum << endl << endl;
    }
    cout << sum + x << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 100005
#define M 305
#define INF 1000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-14
using namespace std;
int a[N];
vector<int>ans;
const bool cmp(const int &x,const int &y)
{
    return x%2>y%2;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    while(cin>>n>>m)
    {
        ans.clear();
        int x,y;
        x = y = 0;
        FOR(i,1,m)
        {
            cin>>a[i];
            if(a[i]%2)x++;
            else y++;
        }

        if(x>2)printf("Impossible\n");
        else
        {
            sort(a+1,a+m+1,cmp);
            if(m>1)swap(a[2],a[m]);
            FOR(i,1,m)printf("%d ",a[i]);
            printf("\n");
            if(a[1]>1)ans.PB(a[1]-1);
            FOR(i,2,m-1)ans.PB(a[i]);
            if(m>=2)ans.PB(a[m]+1);
            else ans.PB(1);

            printf("%d\n",ans.size());
            for(auto u:ans)printf("%d\n",u);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
#define debug(x) cerr << #x << " : " << x << endl

namespace atcoder {
	void judge_outer(bool judge_exp, string ok = "Yes", string ng = "No") {
		if (judge_exp) {
			cout << ok << endl;
		}
		else {
			cout << ng << endl;
		}
	}

	template<typename T>
	T ncr(T left, T right) {
		right = min(left - right, right);
		T ans = 1;
		for (T i = 1; i <= right; i++) {
			ans = ans * (left - right + i) / i;
		}
		return ans;
	}

	const int LIMIT = 1000000007;
	const int tenfive = 100000;
}

using namespace atcoder;

int main() {
	int a, b;
	cin >> a >> b;
	cout << ((a*b) % 2 == 0 ? "Even" : "Odd") << endl;
}


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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

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

void balance(multiset<int>& l, multiset<int>& r, ll& lsum, ll& rsum) {
	while (l.size() > r.size() + 1) {
		auto it = --l.end();
		int tmp = *it;
		l.erase(it);
		r.insert(tmp);
		lsum -= tmp;
		rsum += tmp;
	}
	while (r.size() > l.size()) {
		auto it = r.begin();
		int tmp = *it;
		r.erase(it);
		l.insert(tmp);
		rsum -= tmp;
		lsum += tmp;
	}
}

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	multiset<int> l, r;
	ll x = 0, y = 0, lsum = 0, rsum = 0;
	int q;
	for (scanf("%d", &q); q > 0; q--) {
		int a, b, c;
		scanf("%d", &a);
		if (a == 1) {
			scanf("%d%d", &b, &c);
			y += c;
			if (b <= x) {
				l.insert(b); lsum += b;
			}
			else {
				r.insert(b); rsum += b;
			}
			balance(l, r, lsum, rsum);
			x = *(l.rbegin());
		}
		else {
			ll ans = sz(l) * x - lsum;
			ans += rsum - sz(r) * x;
			ans += y;
			printf("%lld %lld\n", x, ans);
		}
	}
}


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

int main() {
  long long a, b;
  cin >> a >> b;
  
  long long result;
  if (b >= a) {
    result = a;
  } else {
    result = a - 1;
  }

  cout << result << endl;
  
  return 0;
}

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

class Solve{
    static void Main(string[] args){
        var N = int.Parse(Console.ReadLine());
        var P = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var Q = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int a = 1, b = 1;
        var list = new List<int>(8);
        for (int i = 0; i < N; i++){
            var pi = P[i];
            var count = 0;
            if (list.Any())
                foreach (var s in list){
                    if (s < pi) count++;}
            var x = pi - count;
            a += i == N - 1 ? 0 : (x - 1) * Factorial(N - 1 - i);
            list.Add(pi);}
        list.Clear();
        for (int i = 0; i < N; i++){
            var qi = Q[i];
            var count = 0;
            if (list.Any())
                foreach (var s in list){
                    if (s < qi) count++;}
            var x = qi - count;
            b += i == N - 1 ? 0 : (x - 1) * Factorial(N - 1 - i);
            list.Add(qi);}
        var answer = Math.Abs(a - b);
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}

    public static int Factorial(int n){
        int result = 1;
        for (int i = n; i > 1; i--){
            result *= i;}
        return result;}}

Measured memory_bytes: 28180
#include<iostream> //cinなど
#include<string> //文字列
#include<algorithm> //sort など
#include<math.h> //paw(冪乗など)
#include<set> // 集合
#include<map> //写像
#include<stdio.h> //printf
#include<stack>

using namespace std;
int main(){
   int a,b,c;

   cin >> a >> b >> c;
   set <int> total;
   total.insert(a+b);total.insert(b+c);total.insert(c+a);
  auto min = total.begin();
  cout << *min << endl;

  return 0;
}


Measured memory_bytes: 256
"""二分探索"""

import sys
sys.setrecursionlimit(10**6)

n = int(input())
L = list(map(int, input().split()))

L.sort()
ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        l = j; r = n
        while l+1 < r:
            c = (l+r)//2
            if L[c] < L[i]+L[j]:
                l = c
            else:
                r = c
        ans += l-j
        
print(ans)

Measured memory_bytes: 43516
n = str(input())
N = []
Y = []
for m in n:
    N.append(m)

for i in range(1<<3):
    Y = []
    tot = int(N[0])
    for j in range(3):
        if (i>>j)&1 == 1:
            tot += int(N[j+1])
            Y.append('+')
        else:
            tot -= int(N[j+1])
            Y.append('-')
    if tot == 7:
        ans = N[0]+Y[0]+N[1]+Y[1]+N[2]+Y[2]+N[3]+'=7'
        break
print(ans)
        


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
map<int,pii> now;
int a[3][3];
int n;
bool used[3][3];
int main(){
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++){
            cin>>a[i][j];
            now[a[i][j]]=mp(i,j);
        }
    cin>>n;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        if(now.count(x)){
            used[now[x].fi][now[x].se]=1;
        }
    }
    for(int i=0;i<3;i++)
        if(used[i][0]==1 && used[i][1]==1 && used[i][2]==1){
            printf("Yes\n");
            return 0;
        }
    for(int i=0;i<3;i++)
        if(used[0][i]==1 && used[1][i]==1 && used[2][i]==1){
            printf("Yes\n");
            return 0;
        }
    if(used[0][0] && used[1][1] && used[2][2]){
        printf("Yes\n");
        return 0;
    }
    if(used[0][2] && used[1][1] && used[2][0]){
        printf("Yes\n");
        return 0;
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
//-std=c++11
#define print(x) printf("%.12f",x);
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define repr(i, n) for(int i=n-1;i>=0;i--)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Repr(i,a,b) for(int i=a;i>=b;i--)
#define pii pair < int, int >
#define iter ::iterator
#define forit(a) for(it=a.begin();it!=a.end();it++)
typedef vector<int> vi;
typedef  long long ll;
const int inf = int(1e9);
const int mod = 998244353;
const int N = (int)2e5 + 5;
int cnt;
void solve(){
	string a,b;
	cin>>a>>b;
	rep(i,sz(a)){
		cnt+=a[i]==b[i];
	}
	cout<<cnt;

}


int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  string s;
  cin >> s;
  if(s[0]==s[1] || s[1]==s[2] || s[2]==s[3]){
    cout << "Bad" << endl;
  }
  else{
    cout << "Good" << endl;
  }
  return 0;
}

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

int main() {
    int n; double x[10] = {}, ans = 0;
    string u[10] = {};
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> u[i];
        if (u[i] == "JPY") ans += x[i];
        else ans += x[i] * 380000;
    }
    printf("%.5f\n", ans);
}

Measured memory_bytes: 256