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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define mod 1000000007
#define PI 3.14159265
#define endl '\n'
#define debug(x) cout << #x << " = " << x << endl;
#define MAX 20

inline int add(int a, int b) {a += b; if (a < 0) a += mod; return a;}
inline int sub(int a, int b) {a -= b; if (a < 0) a += mod; return a;}
inline int mul(int a, int b) {return (a * 1ll * b) % mod;}
inline int pwr(int x, ll y) {
    int ans = 1 % mod;
    while (y) {
        if (y & 1) ans = mul(ans, x);
        x = mul(x, x);
        y >>= 1;
    }
    return ans;
}
inline int inv(int a) {return pwr(a, mod - 2);}

string str, ans;
vector <int> vec, cost = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int dgt;
map <string, string> mp;
int req;

void wtf(ll cur) {
    if (cur == 0) {
        if (ans.size() < str.size()) {
            sort(allr(str));
            ans = str;
        }
        else if (ans.size() == str.size()) {
            sort(allr(str));
            ans = max(ans, str);
        }
        return;
    }
    for (int i = 0; i < dgt; i++) {
        if (cur - cost[vec[i]] >= 0) {
            cur -= cost[vec[i]];
            str.insert((int)str.size(), 1, vec[i] + 48);
            wtf(cur);
            cur += cost[vec[i]];
            str.pop_back();
        }
    }
}

string cmpr(string str1, string str2) {
    if (str1.size() > str2.size()) {
        return str1;
    }
    else if (str1.size() < str2.size()) {
        return str2;
    }
    else {
        return max(str1, str2);
    }
}

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

    int n, m;
    cin >> n >> m;
    int ans = 0;
    map <int, int> mp;
    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        int v;
        for (int j = 0; j < k; j++) {
            cin >> v;
            mp[v]++;
        }
    }
    for (auto it : mp) {
        ans += (it.second == n);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int bar[30];
	int w, n;
	int a, b;
	int temp;
	int i;

	for(i=1; i<=30; i++){
		bar[i-1] = i;
	}

	scanf("%d", &w);
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d,%d", &a, &b);
		temp = bar[a-1];
		bar[a-1] = bar[b-1];
		bar[b-1] = temp;
	}
	for(i=0; i<w; i++){
		printf("%d\n", bar[i]);
	}

	return 0;
}

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

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

int main(void){
    int X; cin >> X;
    cout << (X==7||X==5||X==3 ? "YES" : "NO") << endl;
    return 0;
}

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


int main(){
  ll n,d;
  cin >> n >> d;
  d=d*d;
  int ans=0;
  for(int i=0;i<n;++i){
    ll x,y;
    cin >> x >> y;
    ll cal=x*x+y*y;
    if(d>=cal) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<cmath>
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<<#X<<": "<<X<<" ";
#define ARDEB(i,X) cout<<#X<<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(X) {}
#define END {}
#endif
using namespace std;
int main(){
	
	string a,b;
	cin>>a>>b;
	if(a.size()>b.size()){
		cout<<"GREATER"<<endl;
		return 0;
	}
	if(a.size()<b.size()){
		cout<<"LESS"<<endl;
		return 0;
	}
	for(int i=0;i<a.size();i++){
		if(a[i]>b[i]){
			cout<<"GREATER"<<endl;
			return 0;
		}
		if(a[i]<b[i]){
			cout<<"LESS"<<endl;
			return 0;
		}
	}
	cout<<"EQUAL"<<endl;
	return 0;
}

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

const int MAX_N = 110000;

int dp[MAX_N]; 

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

    for (int i = 0; i < MAX_N; ++i) dp[i] = N; 
    dp[0] = 0;

    for (int n = 1; n <= N; ++n) {
        for (int pow6 = 1; pow6 <= n; pow6 *= 6) {
            dp[n] = min(dp[n], dp[n - pow6] + 1);
        }
        for (int pow9 = 1; pow9 <= n; pow9 *= 9) {
            dp[n] = min(dp[n], dp[n - pow9] + 1);
        }
    }

    cout << dp[N] << endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main()
{
    int X, Y;
    int m, n;

    cin >> X >> Y;

    if ((Y - 2 * X) % 2 != 0) {
        cout << "No" << endl;
        return 0;
    }
    n = (Y - 2 * X) / 2;
    if (n < 0) {
        cout << "No" << endl;
        return 0;
    }
    m = X - n;
    if (m < 0) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }
 
typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
set<int> divisor(int N){
  set<int> res;
  for(int i = 1; i * i <= N; i++){
    if(N % i == 0){
      res.insert(i);
      res.insert(N / i);
    }
  }
  return res;
}
 
int main(){
  int N;
  while( cin>>N){
    int a[3];
    REP(i, N) cin>>a[i];
    set<int> div[3];
    REP(i, N) div[i] = divisor(a[i]);
    FORIT(it, div[0]){
      bool ok = true;
      FOR(i, 1, N) if(!div[i].count(*it)) ok = false;
      if(ok) cout<<*it<<endl;
    }
  }
  return 0;
}


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

int main() {
	cin.tie(0)->sync_with_stdio(false);

	int x; cin >> x;
	if (400 <= x && x <= 599)
		cout << 8 << '\n';
	else if (600 <= x && x <= 799)
		cout << 7 << '\n';
	else if (800 <= x && x <= 999)
		cout << 6 << '\n';
	else if (1000 <= x && x <= 1199)
		cout << 5 << '\n';
	else if (1200 <= x && x <= 1399)
		cout << 4 << '\n';
	else if (1400 <= x && x <= 1599)
		cout << 3 << '\n';
	else if (1600 <= x && x <= 1799)
		cout << 2 << '\n';
	else if (1800 <= x && x <= 1999)
		cout << 1 << '\n';
	return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <string.h>

int main(void)
{
	int n = 1;
	int i, j;
	int num;
	int fre[10];
	
	while (scanf("%d", &n), n != 0){
		memset(fre, 0, sizeof(fre));
		while(n--){
			scanf("%d", &num);
			fre[num]++;
		}
		for (i = 0; i < 10; i++){
			if (fre[i] == 0){
				printf("-\n");
			} else {
				for (j = 0; j < fre[i]; j++){
					printf("*");
				}
				puts("");
			}
		}
	}
	
	return (0);
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define N 101
#define M 100001
int n, m;
int f[N][M], s[N][M];
int main() {
    scanf("%d%d", &n, &m);
    f[0][m] = s[0][m] = 1;
    for (int i = 1, x; i <= n; i++) {
        scanf("%d", &x);
        for (int j = 1; j <= m; j++)
            f[i][j] = (s[i - 1][min(m, j + x)] - s[i - 1][j - 1] + mod) % mod;
        s[i][0] = f[i][0] = s[i - 1][x];
        for (int j = 1; j <= m; j++) s[i][j] = (s[i][j - 1] + f[i][j]) % mod;
    }
    printf("%d\n", f[n][0]);
    return 0;
}

Measured memory_bytes: 78720
# import bisect
# from collections import Counter, defaultdict, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    print((n-2)*180)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  
  int n; cin>>n;
  int a[2*n];
  for(int i=0;i<2*n;i++){
    cin>>a[i];
  }
  sort(a,a+2*n);
  int sum=0;
  for(int i=0;i<n;i++){
    sum+=a[i*2];
  }
  cout<<sum<<endl;
  
  return 0;
}


Measured memory_bytes: 256
//https://qiita.com/tanakh/
#[allow(unused_macros)]
macro_rules! input {
	(source = $s:expr, $($r:tt)*) => {
		let mut iter = $s.split_whitespace();
		let mut next = || { iter.next().unwrap() }; 
		input_inner!{next, $($r)*}
	};
	($($r:tt)*) => {

		let stdin = std::io::stdin();
		let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); 
		let mut next = move || -> String{
			bytes
				.by_ref()
				.map(|r|r.unwrap() as char) 
				.skip_while(|c|c.is_whitespace()) 
				.take_while(|c|!c.is_whitespace()) 
				.collect()
			};
	input_inner!{next, $($r)*} 
	};
}

#[allow(unused_macros)]
macro_rules! input_inner { 
	($next:expr) => {}; 
	($next:expr, ) => {};

	($next:expr, $var:ident : $t:tt $($r:tt)*) => { 
		let $var = read_value!($next, $t); 
		input_inner!{$next $($r)*}
	}; 
}
#[allow(unused_macros)]
macro_rules! read_value { 
	($next:expr, ( $($t:tt),* )) => {
		( $(read_value!($next, $t)),* ) 
	};
	
	($next:expr, [ $t:tt ; $len:expr ]) => {
		(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
	};

	($next:expr, chars) => {
		read_value!($next, String).chars().collect::<Vec<char>>()
	};
	
	($next:expr, bytes) => {
		read_value!($next, String).into_bytes()
	};
	
	($next:expr, usize1) => { 
		read_value!($next, usize) - 1
	};

	($next:expr, $t:ty) => {
		$next().parse::<$t>().expect("Parse error")
	};
}

fn main(){
    input!{
        a : i64,
        b : i64,
        c : i64,
    }
    if a + b + 1 >= c {
        println!("{}",b + c);
    } else {
        println!("{}",b + (b + a + 1));
    }
}

Measured memory_bytes: 4352
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }


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

    // ifstream fin(".in");
    // ofstream fout(".in");

i64 x;
cin>>x;
i64 g=__gcd(x,360LL);
g=x*360/g;
cout<<g/x;



    return 0;
  }


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
using namespace std;

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

typedef complex<int> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

int main() {
  int n;
  while(cin >> n,n) {
    set<P> se;
    REP(i,n) {
      int x,y;
      cin >> x >> y;
      se.insert(P(x,y));
    }
    int res = 0;
    FOR(it,se) {
      FOR (jt,se) {
        P v = *it - *jt;
        int s = norm(v);
        if (s <= res) continue;
        if (se.count(*it+v*P(0,1)) && se.count(*jt+v*P(0,1))) 
          res = s;
      }
    }
    cout << res << endl;
  }
}

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

int main(){
  int a, b;
  cin >> a >> b;
  
  if(a - 2 * b > 0){
  	cout << a - 2 * b << endl;
  } else{
    cout << 0 << 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;

int main() {
    int a, b, ans;
    char op;
    cin >> a >> op >> b;
    if(op == '+') ans = a + b;
    else ans = a - b;
    cout << ans << endl;
}

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

const int M=100010;

int n,a[M];

int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1,x=a[1];i<=n;i++,x=a[x])
		if(x==2)
		{
			cout<<i;
			return 0;
		}
	cout<<-1;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int dp[501][501];
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<pair<int, int> > PQ(Q);
    int l, r;
    while (M--) {
        cin >> l >> r;
        dp[l][r]++;
    }
    int p, q;
    for (auto &pq : PQ){
        cin >> p >> q;
        pq = make_pair(p, q);
    }
    for (int i = N; i > 0; i--) {
        dp[i-1][0] += dp[i][0];
        for (int j = 0; j < N; j++) {
            dp[i-1][j+1] += dp[i][j+1];
            dp[i][j+1] += dp[i][j];
        }
    }
    for (auto pq : PQ) {
        printf("%d\n", dp[pq.first][pq.second]);
    }
    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
#define pb push_back
typedef long double ld;
#define fi first
#define se second
#define mp make_pair

vector<vector<pair<ll,ll>>> out(1e5);
vector<vector<ll>> in(1e5);
ll inf=1e18;
ll p=1e9+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
   while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,i,j,t,a,b,temp,m,k,x,y,ctr;
	ld r;
	cin>>r;
	ld ans=(2.0)*(3.14159)*r;
	cout<<fixed<<setprecision(6)<<ans;

	return 0;
	
	
}


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

#define ll long long
#define met(a, x) memset(a,x,sizeof(a))
#define inf 0x3f3f3f3f
#define ull unsigned long long
#define mp make_pair

using namespace std;
const int mod = 998244353;
const int N = 3e5 + 10;
const int M = 1e6 + 10;
ll fac[N], inv[N];

ll ksm(ll a, ll b) {
    ll ans = 1;
    while (b) {
        if (b % 2)
            ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
void init() {
    int i;
    fac[0] = 1;
    for (i = 1; i < N; i++) {
        fac[i] = (fac[i - 1] * i) % mod;
    }
    inv[N - 1] = ksm(fac[N - 1], mod - 2);
    for (i = N - 2; i >= 0; i--) {
        inv[i] = inv[i + 1] * (i + 1) % mod;
    }
}
long long C(ll n,ll m) {
    if (n < m) return 0;
    return fac[n] * inv[m] % mod * inv[n - m] % mod;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, a, b, k;
    cin >> n >> a >> b >> k;
    ll ans = 0;
    init();
    for (ll i = 0; i <= n; i++) {
        if (a * i > k) {
            break;
        }
        if ((k - a * i) % b) {
            continue;
        }
        ll cnt = (k - a * i) / b;
        if (cnt > n) {
            continue;
        }
        ans = (ans + C(n, i) % mod * C(n, cnt) % mod) % mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#n = int(input())
h, w = map(int,input().split())
#ls = list(map(int,input().split()))
#ls = [list(map(int,input().split())) for i in range(n)]
ls = [input() for i in range(h)]
tmp = [i for i in ls if i.count('.') != w]
def t(tmp):
  ls = []
  for i in range(len(tmp[0])):
    ls.append("")
    for j in tmp:
      ls[i] += j[i]
  return ls
tmp = t(tmp)
ls = [i for i in tmp if i.count('.') != len(tmp[0])]
for i in t(ls):
  print(i)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

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

int main(void){
	int cn[4];
	string S;
	cin>>S;
	REP(i,4) cn[i]=0;

	REP(i,(int)S.length()){
		switch(S[i]){
			case 'N':
				cn[0]++;
				break;
			case 'W':
				cn[1]++;
				break;
			case 'S':
				cn[2]++;
				break;
			case 'E':
				cn[3]++;
				break;
		}
	}
	if((cn[0]==0)^(cn[2]==0)) print("No");
	else if((cn[1]==0)^(cn[3]==0)) print("No");
	else print("Yes");
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int A, B, c, d, e;
	cin>>A>>B;
	
	c = A+B;
	d = A-B;
	e = A*B;
	
	if (c>d && c>e)
	{
	    cout<<c<<'\n';
	}
	
	else if (d>c && d>e)
	{
	    cout<<d<<'\n';
	}
	
	else if (e>c && e>d)
	{
	    cout<<e<<'\n';
	}
	
	else if (A==0 && B==0)
	{
	    cout<<"0"<<'\n';
	}
	
	else if (A>0 && B==0)
	{
	    cout<<A<<'\n';
	}
	
	else if (A==0 && B>0)
	{
	    cout<<B<<'\n';
	}
	
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Tsundoku | diff Tsundoku.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Tsundoku.cpp && ./a.out

/*

 6/27/2020

 5:03-5:19, 5:51-6:00 WA
 6:05

 */

const int MAX_N=1e6+1;
LL A[MAX_N],B[MAX_N],K;
int N,M;

void solve_wa() {
  int j=0;
  LL sumb=0;
  while(j+1<M&&sumb+B[j+1]<=K) sumb+=B[j+1],j++;
  int res=j;
  LL suma=0;
  REP(i,N) if(suma+A[i]<=K) {
    suma+=A[i];
    while(j>=0&&suma+sumb>K) sumb-=B[j],--j;
    //dump(i,j,suma,sumb,i+1+j+1);
    assert(suma+sumb<=K);
    SMAX(res,i+1+j+1);
  }
  cout<<res<<endl;
}

void solve() {
  vector<LL> cum(M+1,0);
  REP(i,M)cum[i+1]=cum[i]+B[i];
  LL cur=0;
  //dumpc(cum);
  int res=0;
  REPE(i,N) if(cur<=K) {
    LL rem=K-cur;
    assert(rem>=0);
    int j=upper_bound(ALL(cum),rem)-cum.begin();
    //dump(i,j,cur,rem);
    SMAX(res,i+j-1);
    if(i<N)cur+=A[i];
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>N>>M>>K;
  REP(i,N) cin>>A[i];
  REP(i,M) cin>>B[i];
  solve();

  return 0;
}


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


    class Program {
        static void Main (string[] args) {
            //var strList = new List<string>();
            //int n = int.Parse(Console.ReadLine());
            //string[]　m = Console.ReadLine().Split(" ");
            string S = Console.ReadLine();
            string ans = "";

            if( S == "ABC"){
                ans = "ARC";
            }else{
                ans = "ABC";
            }


            Console.WriteLine(ans);

        }
    }

Measured memory_bytes: 25780
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

  int d[n+1]={};
  d[0]=0;
  for(int i=1;i<=n;i++){
    d[i]=d[i-1]+1;
    for(int j=6;j<=i;j*=6){
      d[i]=min(d[i-j]+1,d[i]);
    }
    for(int j=9;j<=i;j*=9){
      d[i]=min(d[i-j]+1,d[i]);
    }
  }
  cout<<d[n]<<endl;
  return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env python

import math

def query(p, q, ds):
    p_dirs = []
    q_dirs = []
    for d in ds:
        p_dir = 1 if p>0 else -1
        q_dir = 1 if q>0 else -1

        p_dirs.append(p_dir)
        q_dirs.append(q_dir)

        p -= p_dir * d
        q -= q_dir * d

    res = ''
    for pd, qd in zip(p_dirs, q_dirs):
        if pd > 0 and qd > 0:
            res += 'R'
        elif pd > 0 and qd < 0:
            res += 'U'
        elif pd < 0 and qd > 0:
            res += 'D'
        else:
            res += 'L'

    print(res)


def solve():
    n = int(input())
    queries = [tuple(map(int, input().split())) for _ in range(n)]
    m = max(map(lambda x: abs(x[0]) + abs(x[1]), queries))
    a = list(map(lambda x: (abs(x[0]) + abs(x[1])) % 2, queries))
    if len(set(a)) != 1:
        print(-1)
        return
    ps = [t[0]+t[1] for t in queries]
    qs = [t[0]-t[1] for t in queries]

    n_arms = int(math.ceil(math.log2(m)))
    if ps[0] % 2 == 0:
        ds = [2**i for i in reversed(range(n_arms))] + [1]
    else:
        ds = [2**i for i in reversed(range(n_arms))]
    print(len(ds))
    print(' '.join(map(str, ds)))
    for p, q in zip(ps, qs):
        query(p, q, ds)

if __name__ == '__main__':
    solve()


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

int main(){
  int N;
  cin >> N;
  vector<double>v(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());
  double ans = v.at(0) / (pow(2.0, N - 1));
  for (int i = 1; i < N; i++) {
    ans += v.at(i) / (pow(2.0, N - i));
  }
  cout << ans;
}

Measured memory_bytes: 384
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

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

N = INT()
S = input()

ans = 1
for x in Counter(S).values():
    ans *= x + 1
    ans %= mod
print((ans - 1) % mod)

Measured memory_bytes: 10556
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
int check(int x)
{
    int i,j,k=0;
    j=sqrt(x);
    for(i=1;i<=j;i++)
    if(x%i==0)
        k=k+2;
    if(j*j==x)
        k--;
    if(k==8)
        return 1;
    return 0;
}
int main()
{
    int i,j,k,n,s;
    scanf("%d",&n);
    s=0;
    for(i=105;i<=n;i++)
    if(check(i)&&i%2!=0)
        s++;
    printf("%d\n",s);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

int main()
{
  int a, b;
  while (scanf("%d %d", &a, &b) != EOF)
  {
    string aa = "", bb = "";
    for (int i = 0; i < a; i ++)
      bb += b + '0';
    for (int i = 0; i < b; i ++)
      aa += a + '0';
    printf("%s\n", min(aa, bb).c_str());
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(), (x).end())
#define Reverse(x) reverse((x).begin(), (x).end())
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15) //15桁まで表示
#define str string
typedef std::pair<int,int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<ui,ui> puu;
typedef pair<int, int> P;
typedef vector<int> vi;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int floor(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};

int main() {
    int n,i;
    cin >> n>>i;
    cout << n-i+1 << endl;
    
}

Measured memory_bytes: 256
import copy
n=int(input())
num=input().split()
numa=copy.copy(num)
numb=copy.copy(num)

#buble
for i in range(0,n):
	a=0
	for j in range(n-1,i,-1):
		if numa[j][1:]<numa[j-1][1:]:
			a=numa[j]
			numa[j]=numa[j-1]
			numa[j-1]=a
print(' '.join(list(map(str,numa))))
print('Stable')

#select
for i in range(0,n):
	minj=i
	b=0
	for j in range(i,n):
		if numb[j][1:]<numb[minj][1:]:
			minj=j
	b=numb[minj]
	numb[minj]=numb[i]
	numb[i]=b
print(' '.join(list(map(str,numb))))
if numb==numa:
	print('Stable')
else:
	print('Not stable')
		



Measured memory_bytes: 6344
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))

ans = 0
for i in range(N):
    ans = max(ans, sum(A1[0:i+1])+sum(A2[i:N]))

print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main() {
	int n;
	vector<int64_t> a;

	cin >> n;
	a.resize(n * 3);
	for (int i = 0; i < 3*n; i++) {
		cin >> a[i];
	}

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

	int64_t ans = 0;
	for (int i = n; i < 3*n; i += 2)
		ans += a[i];

	cout << ans << endl;
}


Measured memory_bytes: 2560
gp=raw_input()
gp_list=list(gp)

g=0
p=0
score=0

for i in gp_list:
	if i=="g":
		if p<g:
			p+=1
			score+=1
		else:
			g+=1
	else:
		if p<g:
			p+=1
		else:
			g+=1
			score-=1

print score

Measured memory_bytes: 3460
N=int(input())
graph=[[] for i in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
from collections import deque  
def dfs(k):
  visited=[-1 for i in range(N)]
  visited[k]=0
  q=deque([])
  q.append(k)
  while q:
    u=q.popleft()
    for v in graph[u]:
      if visited[v]==-1:
        visited[v]=visited[u]+1
        q.append(v)
  return visited
a=dfs(0)
b=dfs(N-1)
count=0
for i in range(N):
  if a[i]<=b[i]:
    count+=1
if count>N//2:
  print("Fennec")
else:
  print("Snuke")

Measured memory_bytes: 98604
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define MN 200005
#define inf 0x3f3f3f3f
using namespace std;
int n,a[MN],b[MN];long long ans=1e18,sum,ss;
long long check(int x){
	b[1]=x;for(int i=2;i<=n;i++)b[i]=b[i-1]+1;
	long long tmp=0;for(int i=1;i<=n;i++)tmp+=abs(b[i]-a[i]);return tmp;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);int ll=-1e9,rr=1e9;
	while(ll<rr-2){
		int lm=(ll+rr)>>1,rm=lm+1;
		if(check(lm)>check(rm))ll=lm;
		else rr=rm;
	}for(int i=ll;i<=rr;i++)ans=min(ans,check(i));printf("%lld\n",ans);
}

Measured memory_bytes: 1664
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
using namespace std;
typedef pair<string,int> P;
int main(){
  P in;
  vector<P> n;
  while(cin >> in.first >> in.second){
    n.push_back(in);
  }
  sort(n.begin(),n.end());
  
  string tmp="omanko";
  for(int i=0;i<(int)n.size();i++){
    if( tmp != n[i].first ){
      if(i!=0) cout << endl;
      tmp = n[i].first;
      cout << n[i].first << endl;
      cout << n[i].second;
    } else{
      cout << " "<< n[i].second;
    }
  }
  cout << endl;
}

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

int n, p[100010], d[100010];
int getf(int x){
	if(p[x] == x)return x;
	getf(p[x]);
	int parent = p[x];
	p[x] = p[parent];
	d[x] = d[x] + d[parent];
	return p[x];
}

int main(){
	int n, m;
	scanf("%d%d" , &n , &m);
	for(int i = 1 ; i <= n ; i++)
		p[i] = i, d[i] = 0;

	bool invalid = false;

	for(int i = 1 ; i <= m ; i++){
		int l, r, dd;
		scanf("%d%d%d" , &l , &r , &dd);

		if(l == r){
			if(dd == 0)continue;
			else{
				invalid = true;
				continue;
			}
		}

		int pl = getf(l), pr = getf(r);

		if(pl == pr){
			if(d[r] - d[l] == dd){
				continue;
			}
			else{
				invalid = true;
			}
		}
		else{
			p[pr] = pl;
			d[pr] = dd - d[r] + d[l];
		}
	}

	if(invalid){
		puts("No");
		return 0;
	}

	puts("Yes");

	return 0;
}

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

const int m=1000000007;

int main(){
  int n,h;
  cin >> n >> h;
  vi a;
  int mx=0;
  rep(i,n){
    int x,y;
    cin >> x >> y;
    mx=max(mx,x);
    a.push_back(y);
  }
  sort(a.rbegin(),a.rend());
  int cnt=0;
  rep(i,n){
    if(a[i]<=mx){
      break;
    }
    cnt++;
    h-=a[i];
    if(h<=0){cout << cnt; return 0;}
  }
  cnt+=(h-1)/mx+1;
  cout << cnt;
  return 0;
}

Measured memory_bytes: 3880
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

// 入力
int N;
long long a[100010][3]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
long long dp[100010][3];

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

    // 初期化は既に 0 に初期化される
    // 初期条件も既に 0 で OK

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j == k) continue;
                chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
            }
        }
    }

    // 答え
    long long res = 0;
    for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
    cout << res << endl;
}

Measured memory_bytes: 8288
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
int N, K;
int dp[55][55][55 * 55];
 
const int mod = 1e9 + 7;
 
void add(int &a, int b) {
  a += b;
  if(a >= mod) a -= mod;
}
 
int mul(int a, int b) {return a * 1LL * b % mod;}
 
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N >> K;
  dp[0][0][0] = 1;
  for(int i = 1; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      for(int k = 0; k <= N * N; k++) {
        dp[i][j][k] = 0;
        if(k >= 2 * j) add(dp[i][j][k], mul(dp[i - 1][j][k - 2 * j], 2 * j + 1));
        if(k >= 2 * j) add(dp[i][j][k], mul(dp[i - 1][j + 1][k - 2 * j], mul(j + 1, j + 1)));
        if(j > 0 && k >= j) add(dp[i][j][k], dp[i - 1][j - 1][k - 2 * j]);
      }
    }
  }
  cout << dp[N][0][K] << endl;
}


Measured memory_bytes: 33152
#!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def IIR(n): return [II() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
mod = 1000000007

#A
n,a,b = LI()
ans = [min(a,b),max(0,a+b-n)]
print(ans[0],ans[1])
#B

#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


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

int main(){
    int n, ans = 0;
    cin >> n;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    sort(l.begin(), l.end());

    for(int i = n-1; i >= 0; --i){
        for(int j = i-1; j >= 0; --j){
            for(int k = j-1; k >= 0; --k){
                if(l[i] < l[j] + l[k]) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int W,H,x,y;
	double S;
	int a;
	scanf("%d %d %d %d",&W,&H,&x,&y);
	S = (double)W * (double)H /2;
	if((double)W/2==x && (double)H/2==y) a=1;
	else a=0;
	printf("%.6lf %d\n",S,a );
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    string s, t;
    cin >> s >> t;
    
    bool flag;
    for(int i=0;i<N;i++){
        flag = 0;
        for(int j=0;j<N-i;j++){
            if(s[i+j] != t[j])
                flag = 1;
        }
        if(flag == 0){
            cout << (N - i) + 2*i << endl;
            return 0;
        }
    }
    
    cout << 2*N << endl;
    return 0;
}

Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		LL m = -1, d, c, digits = 0, sum = 0;
		cin >> m;
		if (m < 0) return 0;
		for (LL i = 0; i < m; ++i) {
			cin >> d >> c;
			digits += c;
			sum += d * c;
		}
		LL ans = digits - 1 + (sum - 1) / 9;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
n,k,q = map(int, input().split())
a = [int(input()) for _ in range(q)]
point_list  = [k-q] * n 
for i in a:
    point_list[i-1] += 1
for i in point_list:
    if i >0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 10452
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <functional>

using namespace std;

namespace data {}

typedef long long ll;
typedef std::pair<int, int> pii;
typedef unsigned long ul;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int N;
    vector<int> sides {};
    cin >> N;
    for (int i = 0; i < N; ++i) {
        int l;
        cin >> l;
        sides.emplace_back(l);
    }
    auto max_elem = max_element(sides.begin(), sides.end());
    int max_num = *max_elem;

    ll sum = 0;
    sides.erase(max_elem);
    sum = accumulate(sides.begin(), sides.end(), sum);

    if (max_num < sum) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define pll pair<ll,ll>


int main()
{
	ll i,j,k,m;
	long double n;
	long double r = 6.283185307;
	cin>>n;
	n = n*r;
	printf("%Lf",n);
	return 0;



}

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


int box[100][100] = {};
int main(){
        int W,H,N; cin >> W >> H >> N;

        rep(i,N){
                int x,y,a; cin >> x >> y >> a;
                switch(a) {
                case 1: rep(j,x) rep(k,H) box[j][k] = 1; break;
                case 2: REP(j,x,W) rep(k,H) box[j][k] = 1; break;
                case 3: rep(j,W) rep(k,y)  box[j][k] = 1; break;
                case 4: rep(j,W) REP(k,y,H)  box[j][k] = 1; break;
                }
        }
        int sum = 0;
        rep(j,W) rep(k,H) if(box[j][k] == 0) sum++;
        cout << sum << endl;

        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
const int N=1e3+10;
int main(){
    int n,a[N][2],b,e,m,q;
    bool f=true;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i][0]);
    scanf("%d",&q);
    while(q--){
        scanf("%d%d%d",&b,&m,&e);
        for(int i=0;i<n;i++)a[i][f]=a[i][!f];
        for(int i=0;i<e-b;i++)a[b+((i+e-m)%(e-b))][f]=a[i+b][!f];
        f=!f;
    }
    f=!f;
    printf("%d",a[0][f]);
    for(int i=1;i<n;i++)printf(" %d",a[i][f]);
    printf("\n");
}


Measured memory_bytes: 2696
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

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

    map<string,ll> mp;
    string str;
    string al = "abcdefghijklmnopqrstuvwxyz";

    rep(i,n){        
        string str2;
        vector<int> vec(26,0);
        cin >> str;
        rep(j,10){
            vec[(int)(str[j]-'a')]++;
        }

        rep(j,26){
            rep(k,vec[j]){
                str2 += al[j];
            }
        }
        mp[str2]++;
    }
    ll ans = 0;
    for(auto e: mp){
        ans += e.second * (e.second -1)/2;
        //cout << e.first << " " << e.second << endl;
    }
    cout << ans << endl;

    return 0;
}

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

int main()
{
	int ary[4][13] = {0};
	int n;
	char mark;
	int num;

	int i, j;

	cin >> n;

	for (i = 0; i < n; i++) {
		cin >> mark >> num;

		switch(mark) {
			case 'S':
				ary[0][num - 1] = 1;
				break;
			case 'H':
				ary[1][num - 1] = 1;
				break;
			case 'C':
				ary[2][num - 1] = 1;
				break;
			case 'D':
				ary[3][num - 1] = 1;
				break;
		}
	}

	for (i = 0; i < 4; i++) {
		for (j = 0; j < 13; j++) {
			if (ary[i][j] == 0) {
				switch(i) {
					case 0:
						cout << "S " << j + 1 << endl;
						break;
					case 1:
						cout << "H " << j + 1 << endl;
						break;
					case 2:
						cout << "C " << j + 1 << endl;
						break;
					case 3:
						cout << "D " << j + 1 << endl;
						break;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
  int x, y, flag;
  cin >> x >> y;
  flag = 1;
  if(y > 4*x || y < 2*x) flag = 0;
  if(y%2) flag = 0;
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);



int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	ll tmp=(ll)a*b;
	ll tmp2=(ll)(c-(a+b))*(c-(a+b));
	if(c-(a+b)<0) cout<<"No"<<endl;
	else{
	if(tmp2%4==0) tmp2=tmp2/4;
	else tmp2=tmp2/4+1;

	if(tmp<tmp2) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
    }

    
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    int k, t;
    cin >> k >> t;
    VI a(t);
    REP(i,t) cin >> a[i];
    sort(a.begin(),a.end());
    int m = a[t-1];
    if (m <= (k+1)/2)
        cout << 0 << endl;
    else
        cout << 2*m-k-1 << endl;


    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		long N = sc.nextLong(), A = sc.nextLong(), B = sc.nextLong();
		if(A > B) System.out.println(0);
		else if(A == B) System.out.println(1);
		else {
			if(N <= 1) System.out.println(0);
			else System.out.println((N - 2) * (B - A) + 1);
		}
	}
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;
 
#define REP(i, n) for(ll i = 0;i < n;i++)
#define REP1(i, n) for(ll i = 1;i < n;i++)
#define REPR(i, n) for(ll i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
 
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
 
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
 
#define pb(a) push_back(a)
 
int n,m;
vector<int> ki(100000);
vector<int> kz(100000,1);
 
int root(int w){
  int ww=w;
  vector<int> kidmy(10);
  int lfg=0;
  REP(ii,10){ 
    if (ki[ww]==ww){
      break;
    }else{
     kidmy[lfg]=ww;
     lfg++;
     ww=ki[ww];
    }
  }
  
  REP(ii,lfg){
    ki[kidmy[ii]]=ww;
  }
  
  //if (kz[ww]<lfg)kz[ww]=lfg;
  
  return ww;
}
  
 
int main(){
  int ans=0;
  cin >> n >> m;
 
  vector<int> x(m),y(m),z(m);
  REP(i,m) cin>>x[i]>>y[i]>>z[i];
  REP(i,100000)ki[i]=i;
  REP(i,m){//結合させていく
    int pidx=root(x[i]-1);
    int pidy=root(y[i]-1);
    if (pidx!=pidy){
      if (kz[pidy]>kz[pidx]){
        ki[pidx]=pidy;
        kz[pidy]+=kz[pidx];
      }else{
        ki[pidy]=pidx;
        kz[pidx]+=kz[pidy];
      }
    }
  }
  
  
  REP(i,n){
   if (ki[i]==i)ans++;
  }
 
 
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

using ll = long long int;
using namespace std;

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

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

  cerr << "Answer:" << endl;
  cout << ans << endl;

  return 0;
}


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

int main() {
int ans = 0;
int N;
cin >> N;
vector<vector<int>> DP(9, vector<int>(9,0));
int digit = 1;
for (int i = 1; i <= N; i++){
    if (i == pow(10, digit)){
        digit += 1;
    }
    else if(i % 10 != 0){
        int x = i/pow(10, digit-1);
        int y = i % 10;
        DP.at(x-1).at(y-1)++;
    }
}

for (int i = 0; i < 9; i++){
    for (int j = i; j < 9; j++){
        if(i != j)ans = ans + 2 * DP.at(i).at(j) *DP.at(j).at(i);
        else ans = ans + DP.at(i).at(j) * DP.at(j).at(i);
    }
}

cout << ans << endl;
}

Measured memory_bytes: 256
import itertools
N=int(input())
P=tuple([int(i)-1 for i in input().split()])
Q=tuple([int(i)-1 for i in input().split()])
SEQ=sorted(list(itertools.permutations(range(N),N)))
#print(SEQ)

a=-1
b=-1
for i in range(len(SEQ)):
    if SEQ[i]==P:
        a=i
    if SEQ[i]==Q:
        b=i
print(abs(a-b))


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

using namespace std;

int main()
{
  string s;
  cin>>s;
  int ans=s.size();
  for(int i=0;i<26;i++)
  {
    int count=0;
    int nowans=0;
    for(int j=0;j<s.size();j++)
    {
      if(s[j]=='a'+i)
      {
        if(nowans<count)
          nowans=count;
        count=0;
      }
      else
        count++;
    }
    if(nowans<count)
      nowans=count;
    if(ans>nowans)
      ans=nowans;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256