akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<set>
#define take_input freopen("input.txt", "r", stdin)
#define ll long long int 
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fi first
#define se second
using namespace std;
#define mod 1000000007

// ll res(ll n, vector<ll> v){
// 	if(n<=0){
// 		return 0;
// 	}
// 	vector<ll> dp(n+1);
// 	dp[1] = 1;
// 	if(dp[n] != 0){
// 		return dp[n]%mod;
// 	}
// 	for(ll i=0; i<v.size(); i++){
// 		dp[n] += (res(n-v[i], v))%mod;
// 	}
// 	return dp[n]%mod;
// }

// int main(){
// 	take_input;
// 	ll n,k;
// 	cin >> n >> k;
// 	set<ll> s;
// 	for(ll i=0; i<k; i++ ){
// 		ll n1,n2;
// 		cin >> n1 >> n2;
// 		s.insert(n1);
// 		s.insert(n2);
// 	}
// 	vector<ll> v;
// 	auto it = s.begin();
// 	while (it != s.end())
// 	{
// 	    v.pb(*it);
// 	    it++;
// 	}
// 	vector<ll> dp(n, 0);
// 	dp[1] = 1;
// 	cout << res(n, v) << "\n";
// }




ll power(ll x, ll n){
	ll res = 1;
	while(n){
		if(n%2) res = ((res%mod)*(x%mod))%mod;
		x = ((x%mod)*(x%mod))%mod;
		n /= 2;
	}
	return res;
}

int main(){
	ll n;
	cin >> n;
	ll res = (power(10, n)-2*power(9, n)+power(8,n)+2*mod)%mod;
	printf("%lld\n", res);
}
	





Measured memory_bytes: 3224
from math import sqrt
N = int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

if N == 1:
    ans = 0
else:
    A = factorization(N)
    B = []
    for a in A:
        B.append(a[1])
        ans = 0
    for b in B:
        n = int((-1 + sqrt(8*b + 1)) / 2)
        ans += n
print(ans)        

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

//---

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

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N, M; cin >> N >> M;
    vector<pair<int,int>> vAB(N);
    for(int i=0; i<N; ++i){
        cin >> vAB[i].first >> vAB[i].second;
    }
    sort(vAB.begin(), vAB.end());
    
    int64 sum=0;
    int num=0;
    for(int i=0; i<N; ++i){
        if( num+vAB[i].second <= M ){
            num += vAB[i].second;
            sum += (int64)vAB[i].first * (int64)vAB[i].second;
        }else{
            int add_num = M - num; if(add_num<=0){ break; }
            num += add_num;
            sum += (int64)vAB[i].first * (int64)add_num;
        }
    }
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	string str1,str2;
	cin>>str1>>str2;
	ll n=str1.length();
	ll m=str2.length();
	ll dp[n+1][m+1];
	for(ll i=0;i<=n;i++)
	{
		for(ll j=0;j<=m;j++)
		{
			if(i==0||j==0)
			dp[i][j]=0;
			else
			{
			if(str1[i-1]==str2[j-1])
			dp[i][j]=dp[i-1][j-1]+1;
			else
			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	}
	ll len;
	len=dp[n][m];
	string str;
	str.resize(len);
	ll i=str1.length();
	ll j=str2.length();
	while(i>0 and j>0)
	{
		if(str1[i-1]==str2[j-1])
		{
			str[len-1]=str1[i-1];
			len--;
			i--;
			j--;
		}
		else
		{
			if(dp[i-1][j]>dp[i][j-1])i--;
			else
			j--;
		}
	}
	cout<<str<<"\n";
	return 0;
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;

int main() {
	int h,w,k;
	cin >> h >> w >> k;
	vector<string> map(h);
	rep(i, h) cin >> map[i];

	int ans = 0;
	rep(bit, 1 << (h + w)) {
		vector<string> m(h);
		m = map;
		rep(i, h) {
			if (bit >> i & 1) {
				rep(j, w) {
					m[i][j] = ';';
				}
			}
		}
		rep(i, w) {
			if (bit >> (i + h) & 1) {
				rep(j, h) {
					m[j][i] = ';';
				}
			}
		}
		int cnt = 0;
		rep(i, h)rep(j, w) {
			if (m[i][j] == '#') cnt++;
		}
		
		if (cnt == k) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3604
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    string s;
    cin >> s;
    while(1) {
        s = s.substr(0, s.length()-1);
        bool ok = true;
        if ( s.length() % 2 != 0 ) continue;
        rep(j, s.length()/2) {
            if ( s[j] != s[s.length()/2+j] ) {
                ok = false;
                break;
            }
        }
        if ( ok ) {
            cout << s.length() << endl;
            return 0;
        }
    }
    return 0;
}


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

using std::pair;
using std::vector;
using std::string;

typedef long long ll;
typedef pair<int, int> pii;

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

const int N = 3000;
const int mo = 1e9 + 7;
const int inv2 = (mo + 1) >> 1;

int fpm(int x, int y) {
    int res = 1;
    for(; y > 0; y >>= 1) {
        if(y & 1)
            res = 1ll * res * x % mo;
        x = 1ll * x * x % mo;
    }
    return res;
}

void merge(int &a, int &b) {
    int x = a = 1ll * a * inv2 % mo;
    int y = b = 1ll * b * inv2 % mo;
    a = (a + y) % mo;
    b = (b + x) % mo;
}

int n, q;
int a[N + 5];
int dp[N + 5][N + 5];

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    read(n), read(q);
    for(int i = 1; i <= n; ++i) read(a[i]);
    for(int i = 1; i <= n; ++i) 
        for(int j = 1; j <= n; ++j) if(a[i] > a[j]) { dp[i][j] = 1; }

    for(int i = 1; i <= q; ++i) {
        static int x, y;
        read(x), read(y);
        if(x == y) continue;

        for(int j = 1; j <= n; ++j) if((j ^ y) && (j ^ x)) {
            merge(dp[x][j], dp[y][j]);
            merge(dp[j][x], dp[j][y]);
        }
        merge(dp[x][y], dp[y][x]);
    }

    int ans = 0;
    for(int i = 1; i <= n; ++i) 
        for(int j = i + 1; j <= n; ++j)
            ans = (ans + dp[i][j]) % mo;

    ans = 1ll * ans * fpm(2, q) % mo;
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 35456
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int testCases = s.nextInt();
        int count;
        s.nextLine();
        int ac = 0, wa = 0, tle = 0, re = 0; 
        while(testCases-->0) {
            String res = s.nextLine();
            if(res.equals("AC")) ac++;
            if(res.equals("WA")) wa++;
            if(res.equals("TLE")) tle++;
            if(res.equals("RE")) re++;
        }
        System.out.println("AC x "+ac);
        System.out.println("WA x "+wa);
        System.out.println("TLE x "+tle);
        System.out.println("RE x "+re);
    }
}


Measured memory_bytes: 60784
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return 1;} return 0;}

int main(){
  int N, W;
  cin >> N >> W;
  vector<int> weight(N + 1), value(N + 1);
  for(int i= 1; i <= N; i++){
    cin >> weight[i] >> value[i];
  }
  vector<vector<int64_t>> dp(N + 1, vector<int64_t> (W + 1, 0));
  for(int i = 1; i <= N; i++){
    for(int sum_w = 0; sum_w <= W; sum_w++){
      if(sum_w - weight[i] >= 0){
        chmax(dp[i][sum_w], dp[i - 1][sum_w - weight[i]] + value[i]);
      }
      chmax(dp[i][sum_w], dp[i - 1][sum_w]);
    }
  }
  cout << dp[N][W] << endl;
}
  

Measured memory_bytes: 80256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
using namespace std;

void solve(){
  int n; cin >> n;
  set<int> st;
  for(int i = 0; i < n; i++){
    int d; cin >> d;
    st.insert(d);
  }
  cout << st.size() << endl;
  return;
}

int main(){
  solve();
  return 0;
}


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

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<pair<int, int>> students(n);
    for (int i = 0; i < n; i++) {
        cin >> students[i].first;
        students[i].second = i;
    }
    sort(students.begin(), students.end());
    for (int i = 0; i < n; i++) {
        cout << students[i].second + 1 << " ";
    }
    return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>
int t, n, p[1000001]; long long s[1000002];
int main() {
	for (int i = 0; i <= 1000000; i++) p[i] = i;
	for (int i = 2; i <= 1000000; i++) {
		if (p[i] == i) {
			for (int j = i; j <= 1000000; j += i) p[j] = p[j] / i * (i - 1);
		}
	}
	for (int i = 0; i <= 1000000; i++) {
		s[i + 1] = s[i] + p[i];
	}
	scanf("%d", &t);
	for (int i = 0; i < t; i++) {
		scanf("%d", &n);
		printf("%lld\n", s[n + 1] + 1);
	}
	return 0;
}

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

int main(int argc, char const *argv[])
{
	string s;
	cin>>s;
	int cnt[3]={};
	for (int i = 0; i < s.size(); ++i)
	{
		++cnt[s[i]-'a'];
	}
	if (max({cnt[0],cnt[1],cnt[2]})-min({cnt[0],cnt[1],cnt[2]})<=1)
	{
		cout<<"YES\n";
	}
	else
	{
		cout<<"NO\n";
	}
	return 0;
}


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

typedef long long ll;

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

    cin >> a >> b;

    int res = 0;
    while ((res * 8 / 100 < a) || (res / 10) < b) {
        ++res;
    }
    if (res * 8 / 100 != a || res / 10 != b)
        cout << -1 << endl;
    else
        cout << res << endl;

    return 0;
}



Measured memory_bytes: 256
def ip():
    return int(input())
    
def ipp():
    return map(int,input().split())
    
def sar():
    return list(ipp())
    
def pars(a):
    print(''.join(list(map(str, a))))
    print('\r')
    
def parl(a):
    print('\r'.join(list(map(str, a))))
    print('\r')
    
#template ends   

if __name__=='__main__':
    T=1
    #T=int(input().strip())
    for _ in range(T):
        s = input()
        k = ip()
        for i in range(0,len(s),k):
            print(s[i], end="")

Measured memory_bytes: 3188
Scanf.sscanf (read_line ()) "%d %d" (fun a b ->
    let f = function
        | 1 -> 300000
        | 2 -> 200000
        | 3 -> 100000
        | _ -> 0
    in
    let r = f a + f b + (if a * b = 1 then 400000 else 0) in
    Printf.printf "%d\n" r)

Measured memory_bytes: 384
#include <iostream>
#include <math.h>
using namespace std;

int main(){
	
	int n,a,b,c;
	cin>>n;
		
	for(int i=0;i<n;i++){
		cin>>a>>b>>c;
		if(a*a==b*b+c*c||b*b==c*c+a*a||c*c==a*a+b*b)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> dct;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define pi 3.14159265

bool compare(pll a, pll b){
    return a.first*b.second<a.second*b.first;
}

const ll mod = 1e9+7;
const ll inf = ll(1e18);

ll modexp(ll x,ll n){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%mod,n/2);
    return (x*modexp((x*x)%mod,n/2))%mod;
}

int main(){
    //clock_t tm = clock();
    fastio;
    int n,m;
    cin>>n>>m;
    if(n<=m){
        f(i,0,m)
            cout<<n;
    }
    else{
        f(i,0,n)
            cout<<m;
    }
    cout<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

Measured memory_bytes: 256
def solve():
    s = list(input())
    a = s.count("a")
    b = s.count("b")
    c = s.count("c")
    hoge = [a, b, c]
    for i in range(2):
        if abs(hoge[i] - hoge[i+1]) > 1 or abs(hoge[0] - hoge[2]) > 1:
            print("NO")
            break
    else:
        print("YES")
    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 3956
import math
n,m = map(int,input().split())
count = 0
if n >= 2:
    count +=  math.factorial(n) // (math.factorial(n-2) * math.factorial(2))
if m >= 2:
    count +=  math.factorial(m) // (math.factorial(m-2) * math.factorial(2))
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int w = 0;
    int r = 0;
    for(int i=0;i<n;i++)if(s[i] == 'W')w++;
    r = n - w;
    // 左にRを敷き詰める場合にかかるコストは
    int rc = r;
    for(int i=0;i<r;i++)if(s[i] == 'R')rc--;
    cout << min(rc,w) << endl;
}

Measured memory_bytes: 3756
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
// const long long MOD = (ll)1e6+3;
const long long MAX = (ll)1e5+10;



int main(void) {
    ll H,N;
    cin>>H>>N;
    vector<ll> A(N);
    rep(i,0,N) cin>>A[i];
    ll sum = 0;
    rep(i,0,N) sum += A[i];
    if (H<=sum) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

   return 0;
}

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

int main() {
    int h, w; cin >>h >>w;
    vector<vector<char>> s(h, vector<char>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> s[i][j];
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j]=='.') {
                int b = 0;
                if (i>0   && j>0  ) {if(s[i-1][j-1]=='#') b++;}
                if (i>0           ) {if(s[i-1][j]  =='#') b++;}
                if (i>0   && j<w-1) {if(s[i-1][j+1]=='#') b++;}
                if (         j>0  ) {if(s[i][j-1]  =='#') b++;}
                if (         j<w-1) {if(s[i][j+1]  =='#') b++;}
                if (i<h-1 && j>0  ) {if(s[i+1][j-1]=='#') b++;}
                if (i<h-1         ) {if(s[i+1][j]  =='#') b++;}
                if (i<h-1 && j<w-1) {if(s[i+1][j+1]=='#') b++;}
                s[i][j] = b+'0';
            }
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << s[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MAX=1000000007;

  
signed main() {
    int n;
    cin>>n;
    int h[n];
    for(int i=0;i<n;i++)cin>>h[i];
    int ans=1;
    for(int i=n-2;i>=0;i--){
      if(h[i]>h[i+1]){
        if(h[i]==h[i+1]+1)h[i]--;
        else ans=0;
      }
    }
    if(ans==1)cout<<"Yes";
    else cout<<"No";
    return 0;
}


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

// #define multitest 1
#ifdef WIN32
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.first << ", " << p.second << ']';
	return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
	std::cerr << name << " { ";
	for (const auto &v : arg)
		cerr << v << ' ';
	cerr << " }\n";
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;
auto TimeStart = chrono::steady_clock::now();

const int nax = 2e5 + 10;
vector<int> Unlock[nax];
int cost[nax];
ll dp[1 << 12][1000 + 10];
int n, m, a, b, c;

ll solve(int mask, int index)
{
	if (index == m)
	{
		// mask = __builtinpopcount(mask);
		if (mask == ((1 << n) - 1))
			return 0;
		else
			return INT_MAX;
	}
	if (mask == ((1 << n) - 1))
		return 0;
	ll ret = dp[mask][index];
	if (ret >= 0)
		return ret;
	ret = 0;
	ret = solve(mask, index + 1);
	ll nmask = mask;
	for (auto u : Unlock[index])
		nmask |= (1 << u);
	ret = min(ret, cost[index] + solve(nmask, index + 1));
	dp[mask][index] = ret;
	return ret;
}

void solve()
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		cin >> a >> b;
		cost[i] = a;
		for (int j = 0; j < b; ++j)
		{
			cin >> c;
			Unlock[i].pb(c - 1);
		}
	}
	memset(dp, -1, sizeof(dp));
	cout << (solve(0, 0) >= INT_MAX ? -1 : solve(0, 0)) << '\n';
}

int main()
{
#ifndef WIN32
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
#ifdef WIN32
	cerr << "\n\nTime elapsed: " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " seconds.\n";
	flush(cout);
#endif
	return 0;
}

Measured memory_bytes: 38272
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535
vector<int> par;
int parent(int x)
{
	if (x != par[x])
	{
		par[x] = parent(par[x]);
	}

	return par[x];
}

int main()
{
	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
	int n, m;
	cin >> n >> m;
	par.resize(n + 1, 0);
	for (int i = 0; i <= n; i++)
		par[i] = i;
	while (m--)
	{
		int a, b;
		cin >> a >> b;
		int x = parent(a);
		int y = parent(b);
		if (x > y)
		{
			par[x] = y;
		}
		else if (y > x)
		{
			par[x] = y;
		}
	}
	int arr[n + 1] = {0};
	for (int i = 1; i <= n; i++)
	{
		int x = parent(i);
		//cout << x << endl;
		arr[x]++;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
		ans = max(ans, arr[i]);
	cout << ans;
	return 0;
}



Measured memory_bytes: 7848
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

#define INF (1000000000000000)
#define MAX_V 110000

struct edge{
	int to;
	long long int cost;
};

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

vector<edge> G[MAX_V];
long long int d[MAX_V];

// ?????????O(|E|log|V|)

void shortest_path(int s, int V){ // V???????????°
	
	priority_queue<P, vector<P>, greater<P> > que;
	
	for(int i = 0; i < V; i++){
		d[i] = INF;
	}
	d[s] = 0;
	
	que.push(P(0, s));
	
	while(!que.empty()){
		
		P p = que.top();
		que.pop();
		
		int v = p.second;
		
		if(d[v] < p.first){
			continue;
		}
		
		for(int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if(d[e.to] > e.cost + d[v]){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		} // ????????????????°???????????????´??°
	}
}

vector<P> v;

int main(){
	
	int N, M;
	long long int C;
	
	cin >> N >> M >> C;
	
	for(int i = 0; i < M; i++){
		edge e1, e2;
		long long int from, to, cost;
		cin >> from >> to >> cost;
		from--;
		to--;
		e1.to = to;
		e2.to = from;
		e1.cost = e2.cost = cost;
		G[from].push_back(e1);
		G[to].push_back(e2);
	}
	
	shortest_path(0, N);
	
	long long int sum = 0;
	
	for(int i = 0; i < N; i++){
		for(int j = 0; j < G[i].size(); j++){
			if(i > G[i][j].to){
				continue;
			}
			P p;
			if(d[i] < d[G[i][j].to]){
				p.first = d[G[i][j].to];
			}else{
				p.first = d[i];
			}
			p.second = G[i][j].cost;
			sum += p.second;
			v.push_back(p);
		}
	}
	
	sort(v.begin(), v.end());
	
	long long int ans = sum;
	long long int sum2 = 0;
	
	for(int i = 0; i < v.size(); i++){
		sum2 += v[i].second;
		ans = min(ans, sum - sum2 + C * v[i].first);
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 20780
#include<bits/stdc++.h>
using namespace std;
#define f(i,n) for(int i=0;i<n;i++)
#define M (i*10+q[j])
#define pa pair<int,int>
/*#define F first
#define S second*/
typedef long long ll;
#define X first
#define Y second

int main()
{
    string s;
    cin>>s;
    list<char>b;
    for(int i=0; i<4; i++)
        b.push_back(s[i]);
    b.remove(s[0]);
    if(b.size()!=2||b.front()!=b.back())
    {
        cout<<"No";
        return 0;
    }
    cout<<"Yes";
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int>power(3*N);
  for(int i=0; i<3*N; i++)cin >> power[i];
  
  sort(power.begin(),power.end());
  long long total = 0;

  for (int i=N; i<3*N; i+=2){
       total += power[i];
  }

  cout << total << endl;
}

Measured memory_bytes: 1408
#include <stdio.h>
#define H 250
int main(){

  int i,size,a[H];

  scanf("%d",&size);
  for(i=1;i<=size;i++)
    scanf("%d",&a[i]);

  for(i=1;i<=size;i++)
    {
      printf("node %d: key = %d, ",i,a[i]);

      if( i/2 >= 1 )printf("parent key = %d, ",a[i/2]);

      if( i*2 <= size)printf("left key = %d, ",a[i*2]);

      if( i*2+1 <= size)printf("right key = %d, ",a[i*2+1]);

      puts("");
    }

  return 0;
}
  

Measured memory_bytes: 2656
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,a,b;
  cin>>n>>a>>b;
    if((n%(a+b))<=a){
      cout<<(n/(a+b))*a+(n%(a+b))<<endl;
    }
    else if(a<=(n%(a+b)) && (n%(a+b))<=(a+b)){
      cout<<((n/(a+b))+1)*a<<endl;
    }
  return 0;
}             

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
unsigned long long tomod = 1000000007, dp[4][4][4], tmp[4][4][4];
unsigned long long ans(int len){
	for(int i = 0;i < 4;++i){
		for(int j = 0;j < 4;++j){
			for(int k = 0;k < 4;++k){
				if(i == 0 and j == 1 and k == 2)continue;
				if(i == 1 and j == 0 and k == 2)continue;
				if(i == 0 and j == 2 and k == 1)continue;
				dp[i][j][k] = 1;
			}
		}
	}
	unsigned res = 0;
	for(int t = 4;t <= len;++t){
		for(int i = 0;i < 4;++i){
			for(int j = 0;j < 4;++j){
				for(int k = 0;k < 4;++k){
					for(int l = 0;l < 4;++l){
						if((i == 0 || j == 0) and k == 1 and l == 2)continue;
						if(i == 0 and j == 2 and k == 1)continue;//
						if(j == 1 and k == 0 and l == 2)continue;
						if(i == 0 and j == 1 and(k == 2 || l == 2))continue;//
						if(j == 0 and k == 2 and l == 1)continue;
						if(i == 0 and j == 1 and k == 2)continue;//
						if(j == 0 and k == 1 and l == 2)continue;
						tmp[j][k][l] = (tmp[j][k][l] + dp[i][j][k]) % tomod;
					}
				}
			}
		}
		memmove(dp, tmp, sizeof(tmp));
		memset(tmp, 0, sizeof(tmp));
	}
	for(int i = 0;i < 4;++i){
		for(int j = 0;j < 4;++j){
			for(int k = 0;k < 4;++k){
				res = (res + dp[i][j][k]) % tomod;
			}
		}
	}
	return res;
}
int main(){
	int len;
	cin >> len;
	cout << ans(len);
}


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

int main(){
    string S, T;
    cin >> S >> T;

    int ans = T.size();

    for (int start = 0; start <= S.size()-T.size(); start++)
    {
        int d = 0;
        for (int i=0; i < T.size(); i++)
        {
            if (T[i] != S[start+i]){
                d++;
            }
        }
        ans = min(ans, d);
    }
        cout << ans << endl;
}

Measured memory_bytes: 3604
#include <array>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iostream>
#include <string>

int blocks[300];
int8_t strike_range[300][300];
int score_in_range[300][300];

const int8_t STRIKE_RANGE_UNDEF = 0;
const int8_t STRIKE_RANGE_NO = 1;
const int8_t STRIKE_RANGE_YES = 2;

bool can_strike(int x, int y) {
	return std::abs(blocks[x] - blocks[y]) <= 1;
}

int8_t search_range(int start, int end) {
	if (start >= end) return STRIKE_RANGE_UNDEF;
	if ((end - start + 1) % 2 != 0) return STRIKE_RANGE_NO;

	int8_t* p = &strike_range[start][end];
	if (*p != STRIKE_RANGE_UNDEF) return *p;

	if (start + 1 == end)
		return *p = can_strike(start, end) ? STRIKE_RANGE_YES : STRIKE_RANGE_NO;

	for (int i = start + 1; i < end - 1; i++) {
		if (search_range(start, i) == STRIKE_RANGE_YES
			&& search_range(i + 1, end) == STRIKE_RANGE_YES)
		{
			return *p = STRIKE_RANGE_YES;
		}
	}

	auto result = search_range(start + 1, end - 1);
	return *p = result == STRIKE_RANGE_YES && can_strike(start, end)
		? STRIKE_RANGE_YES : STRIKE_RANGE_NO;
}

int main()
{
	while (true) {
		int n;
		std::cin >> n;

		if (n == 0) return 0;

		for (int i = 0; i < n; i++) {
			int w;
			std::cin >> w;
			blocks[i] = w;
		}

		std::memset(strike_range, 0, sizeof(strike_range));

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				score_in_range[i][j] = search_range(i, j) == STRIKE_RANGE_YES ? j - i + 1 : 0;
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = i; j < n; j++) {
				for (int k = i; k < j; k++) {
					score_in_range[i][j] = std::max(
						score_in_range[i][j],
						score_in_range[i][k] + score_in_range[k + 1][j]
					);
				}
			}
		}

		std::cout << score_in_range[0][n - 1] << std::endl;
	}
}

Measured memory_bytes: 3520
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int N,T,A,ANS;
  double ans;
  cin>>N>>T>>A;
  int H[N];
  for(int i=0;i<N;i++){
    cin>>H[i];
    if(i==0){
      ans=abs(T-H[i]*0.006-A);
      ANS=i;
    }
    else{
      if(ans==max(abs(T-H[i]*0.006-A),ans)) ANS=i;
      ans=min(abs(T-H[i]*0.006-A),ans);
    }
  }
  cout<<ANS+1<<endl;
}



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

ll n;

inline ll read(){
	ll s = 0, w = 1;
	char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
	return s * w;
}

inline void work(){
	n = read();
	printf("%f\n", 2 * n * 3.14159265358979);
}

int main(){
	work();
	return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    int a;
    int b;
    cin >> a >> b;
    vector<string> z(a);

    for (int i = 0; i < b+2; i++) {
        cout << '#';
    }
    cout << endl;
    for (int i = 0; i < a; i++) {
        cin >> z.at(i);
            cout << '#' << z.at(i) << '#' << endl;
    }
    for (int i = 0; i < b + 2; i++) {
        cout << '#';
    }
    cout << endl;
}

Measured memory_bytes: 384
L,R = map(int,input().split())

mod = 10**9+7

def f(L,R):
    if L>R : return 0
    R = bin(R)[2:]
    N = len(R)
    ret = f(L,int("0"+"1"*(N-1),2))
    L = bin(L)[2:]
    if len(L) != N : L = "1"+"0"*(N-1)
    for i in range(N):
        if R[i] == "0" : continue
        R2 = R[:i] + "0" + "?"*(N-i-1)
        if i==0: R2 = R
        for j in range(N):
            if L[j] == "1" and j!=0 : continue
            L2 = L[:j] + "1" + "?"*(N-j-1)
            if j==0 : L2 = L
            tmp = 1
            for r,l in zip(R2,L2):
                if r=="0" and l=="1" : tmp *= 0 ; break
                elif r=="?" and l=="?" : tmp = tmp*3%mod
                elif r=="?" and l=="0" : tmp = tmp*2%mod
                elif r=="1" and l=="?" : tmp = tmp*2%mod
            ret += tmp
            ret %= mod
    return ret

print(f(L,R))

Measured memory_bytes: 3064
n, x = map(int, input().split())
A = sorted([int(i) for i in input().split()])
# print(A)
cnt = 0
for e in A:
    if e <= x:
        x = x - e
        cnt += 1
if cnt == n and x > 0:
    print(cnt-1)
else:
    print(cnt)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

ll f(ll i){
	ll ret=0;
	while(i!=0){
		ret+=i%10;
		i/=10;
	}
	return ret;
}

int main(){
  ll k;cin>>k;
  string digit="";
  set<ll> s;
  rep(i,14){
  	FOR(i,1,160){
  		s.insert(stol(to_string(i)+(digit)));
  	}
  	digit+="9";
  }
  ll cnt=0;
  bool flg=true;
  reps(x,s){
  	flg=true;
  	reps(y,s){
  		if(y>x){
  			if(double(y)/f(y)<double(x)/f(x)){
  				flg=false;
  			}
  		}
  	}
  	if(flg){
  		cout<<x<<endl;
  		cnt++;
  		if(cnt==k){
  			return 0;
  		}
  	}
  }
  return 0;
}

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

int n;
int ans;

void dfs(ll x, int a, int b, int c){
	if(x > n) return;
	if(a*b*c) ans++;
	dfs(x*10+3, 1, b, c);
	dfs(x*10+5, a, 1, c);
	dfs(x*10+7, a, b, 1);
}



int main(){
	cin >> n;
	dfs(0, 0, 0, 0);
	cout << ans << endl;
}

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

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

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

    

    for(int i = 0; i < H; i++)
    {
        string C;
        for(int j = 0; j < W; j++)
        {
            char temp;
            cin >> temp;
            C += temp;
        }

        cout << C << endl;
        cout << C << endl;
        
    }
}

Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

vector<int> to[200005];
vector<int> ans;

void dfs(int v, int p=-1){
  for(int u: to[v]){
    if(u == p) continue;
    ans[u] += ans[v];
    dfs(u,v);
  }
}

int main(){
  int n,q;
  cin >> n >> q;
  int a,b;
  rep(i,n-1){
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  ans.resize(n);
  rep(i,q){
    int p,x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }

  dfs(0);

  rep(i,n){
    printf("%d ", ans[i]);
  }

  printf("\n");



  return 0;
}


Measured memory_bytes: 23424
r, g, b, n = map(int, input().split())
ans = 0
nr = n // r
ng = n // g
for i in range(nr + 1):
    for j in range(ng + 1):
        tmp = n - i * r - j * g
        if tmp >= 0 and tmp % b == 0:
            ans += 1
print(ans)


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

int main(void){
    int n;
    string s;
    cin >> n >> s;

    ll count = 0;
    for(int i=0;i<1000;i++){
        string key;
        if(i<10) key = "00";
        else if(i<100) key = "0";
        key += to_string(i);
        //cout << key << endl;

        bool ok1 = false,ok2 = false,ok3 = false;
        int j = 0;
        for(int i=0;i<s.size();i++){
            if(key[j]==s[i]) j++;
            if(j==key.size()){count++; break;}
        }
        
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<iterator>
#include<vector>
#include<string>
#include<map>

using namespace std;


#define mod(cans) cans%10**9+7
#define cin_pl(x,y) for(int i=0;i<x;i++){cin>>y[i];}
#define pl_twin(x,y,z) for(int i=0;i<x;i++){cin>>y[i]>>z[i];}
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define st(s) size_t size = s.length()
#define prians(Answer) cout<<Answer<<"\n"
#define make_pair mp;
#define com_div(x,Co) for(int i=1;i<x+1;i++){if(x%i==0){Co++;}}
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int,int> pr;
typedef greater<int> gi;

int main()
{   
    int r,d,x;
    cin>>r>>d>>x;
    rep(i,10)
    {
        int tmp=x;
        x=r*tmp-d;
        prians(x);
    }
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int res = 0;
  while (n--) {
    string s;
    cin >> s;
    res += s == "E869120";
  }
  cout << res << '\n';
}



Measured memory_bytes: 3228
//
// Created by syakushimo nekomo on 2018/02/28.
//
#include <stdio.h>
int main(void) {
    int n=0;
    scanf("%d",&n);
    int max;
    int min;
    int difference;
    int tmp;
    scanf("%d",&tmp);
    scanf("%d",&min);
    difference=min-tmp;
    max=min;
    if(tmp<min)
    {
        min=tmp;
    }
    for(int i=2;i<n;i++)
    {
        //最大値が更新される度に最小値と比較する
        scanf("%d",&tmp);
        if(tmp>=max){
            max = tmp;
            if(max-min>difference)
            {
                difference = max - min;
            }
        }else if(tmp<=min)
        {
            min=tmp;
            //それ以前の最高値は無意味なのでminに合わせる
            max=min;
        }
    }
    printf("%d\n",difference);
}



Measured memory_bytes: 2100
#include<stdio.h>
 
int main(void){
  int x,y,z;
  scanf("%d%d",&x,&y);
  for(int i=0;i<=x;i++){
    z=x-i;
    if(4*i+2*z==y){
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 1608
#include<iostream>

using namespace std;


int main()
{

        int a,b;
        char op;

        while(cin>>a>>op>>b&&op!='?')
        {
            switch(op)
            {
            case '+':
                cout<<a+b<<endl;
                break;
            case '-':
                cout<<a-b<<endl;
                break;
            case '*':
                cout<<a*b<<endl;
                break;
            case '/':
                cout<<a/b<<endl;
                break;
            }
        }

        return 0;


}



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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> s(N);
  int nonTen = 101;
  int sum = 0;
  for (int i = 0; i < N; ++i) {
    cin >> s[i];
    if (s[i] % 10 != 0) {
      nonTen = min(nonTen, s[i]);
    }
    sum += s[i];
  }

  if (sum % 10 == 0) {
    if (nonTen == 101) {
      cout << 0 << endl;
    } else {
      cout << sum - nonTen << endl;
    }
  } else {
    cout << sum << endl;
  }
  return 0;
}



Measured memory_bytes: 256
n = int(input())

max1 = max1ad = max2 = 0
for i in range(n):
    a = int(input())
    if a > max1:
        max2 = max1
        max1 = a
        max1ad = i
    elif a > max2:
        max2 = a

for i in range(n):
    if i == max1ad:
        print(max2)
    else:
        print(max1)


Measured memory_bytes: 4540
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
#include <cmath>
#include <cstdio>
#include <complex>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	ll a, b;
	cin >> a >> b;
	cout << max({ a + b,a - b,a*b }) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rg register
#define ll long long 
inline ll read()
{
    ll x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-')
        {
            f=-1;
        }
        c=getchar();
    } 
    while(c<='9'&&c>='0')
    {
        x=(x<<1)+(x<<3)+(c^48);
        c=getchar();
    }
    return x*f;
}
ll a,b;
int main()
{
	 a=read(),b=read();
	 cout<<max(a+b,max(a-b,a*b));
} 

Measured memory_bytes: 256
def divide(n):
    counter = 0
    counter1 = 0
    if n % 2 != 0:
        for i in range(1, n+1, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    else:
        for i in range(1, n, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    return counter1

                         
if __name__ == '__main__':
    n = int(input())
    print(divide(n))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fir first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define quickio(a) ios::sync_with_stdio(a)
#define cl(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn=2e5+10;
const ll mod=1e9+7;
const double eps=1e-7;
const int maxm=1e6+10;
int vis[50050];

int main()
{
	int a,b,c;
	scanf("%1d",&a);
	scanf("%1d",&b);
	scanf("%1d",&c);
	int ans=a*111;
	int aans=a*100+b*10+c;
	if(ans>=aans) cout<<ans<<endl;
	else cout<<(a+1)*111<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  string s;
  cin >> s;
  int a,b,c;
  a = b = c = 0;
  int len = sz(s);
  rep(i,len) {
    if(s[i] == 'a') a++;
    if(s[i] == 'b') b++;
    if(s[i] == 'c') c++;
  }
  int ma = max(a,max(b,c));
  int mi = min(a,min(b,c));
  if(ma - mi >= 2) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		while (s.hasNext()) {
			char[] chars = s.next().toCharArray();
			if (chars[0] == '0') return;
			int sum = 0;
			for (char ch : chars) {
				sum += Character.getNumericValue(ch);
			}
			System.out.println(sum);
		}
	}
}

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

using namespace std;

using ll = long long;

const int MAXN = 4040;
const int MOD = 1e9 + 7;

int C[MAXN][MAXN];
int prefC[MAXN][MAXN];
int dp[MAXN][MAXN];

void precalc() {
   for (int i = 0; i < MAXN; ++i) {
      C[i][0] = 1;
      prefC[i][0] = 1;
      for (int j = 1; j <= i; ++j) {
         C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
         if (C[i][j] >= MOD) C[i][j] -= MOD;
         prefC[i][j] = prefC[i][j - 1] + C[i][j];
         if (prefC[i][j] >= MOD) prefC[i][j] -= MOD;
      }
   }
   for (int i = 0; i < MAXN; ++i) {
      for (int j = 0; j < MAXN; ++j) {
         if (i == 0) dp[i][j] = 1;
         else {
            dp[i][j] = dp[i - 1][j];
            if (j) {
               dp[i][j] += prefC[j - 1][min(j - 1, i)];
               if (dp[i][j] >= MOD) dp[i][j] -= MOD;
            }
         }
      }
   }
}

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   precalc();
   int A, B;
   cin >> A >> B;
   int ans = 0;
   for (int p = 0; p <= A; ++p) {
      for (int q = 0; q <= min(B - 1, A - p); ++q) {
         ans = ans + ll(dp[p][q]) * C[B - 1][q] % MOD;
         if (ans >= MOD) ans -= MOD;
      }
   }
   cout << ans << "\n";
   return 0;
}


Measured memory_bytes: 191616
// Last Change: 03/25/2019 23:12:41.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

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

  int ans = 0;
  for (int i = 1; i < N; ++i) {
    vector<char> X;
    string Y;
    for (int j = 0; j < i; ++j) {
      X.push_back(S[j]);
    }
    sort(X.begin(), X.end());
    Y = S.substr(i, N - i);

    char lastChar = 'a'; //適当
    int tmpAns = 0;
    for (int j = 0; j < i; ++j) {
      if (j == 0 or lastChar != X[j]) {
        lastChar = X[j];
        for (int k = 0; k < N - i; ++k) {
          if (X[j] == Y[k]) {
            ++tmpAns;
            break;
          }
        }
        ans = max(ans, tmpAns);
      }
    }
  }

  cout << ans << endl;

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;
class Player implements Comparable<Player>{
	int party;
	int num;
	String time;
	Player(int p,int n,String t){
		this.party = p;
		this.num = n;
		this.time = t;
	}
	/*@Override
	public int compareTo(Player p) {
		return this.time.compareTo(p.num);
	}
	*/
	@Override
	public int compareTo(Player o) {
		// TODO Auto-generated method stub
		return this.time.compareTo(o.time);
	}
	
}

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Player[] person = new Player[24];
		int[][] rank = new int[3][8];
		int cnt1 = 0;
		int cnt2 = 0;
		int cnt3 = 0;
		for(int i = 0;i < 3;i++){
			for(int j = 0;j < 8;j++){
				person[i*8+j] = new Player(i,sc.nextInt(),sc.next());
			}
		}
		Arrays.sort(person);
		for(int i = 0;i < 24;i++){
			if(person[i].party == 0){
				rank[0][cnt1] = i;
				cnt1++;
			}else if(person[i].party == 1){
				rank[1][cnt2] = i;
				cnt2++;
				
			}else{
				rank[2][cnt3] = i;
				cnt3++;
			}
		}
		for(int i = 0;i < 3;i++){
			for(int j = 0;j < 2;j++){
				System.out.println(person[rank[i][j]].num+" "+person[rank[i][j]].time);
				person[rank[i][j]].time = "999";
			}
		}
		Arrays.sort(person);
		for(int j = 0;j < 2;j++){
			System.out.println(person[j].num+" "+person[j].time);
		}
		
	}
}

Measured memory_bytes: 26004
import sys
def input(): return sys.stdin.readline().rstrip()
from itertools import accumulate
import numpy as np
def main():
    n,k=map(int,input().split())
    P=[int(_) for _ in input().split()]
    P_num=np.array(P)
    PP=(P_num+1)/2
    PP_cum=np.cumsum(PP)
    PP_cum=np.insert(PP_cum,0,0)
    ans=PP_cum[k:]-PP_cum[:n-k+1]
    print(np.max(ans))

if __name__=='__main__':
    main()

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

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

}

Measured memory_bytes: 3576
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        for(int i=1; ;i++) {
            int n = scan.nextInt();
            if(n==0) break;
            System.out.println("Case" + " " + i + ":" + " " +n);
        }
    }
}

Measured memory_bytes: 42512
A, B, C, X, Y = map(int, input().split())

result = []

n = A*X + B*Y 
result.append(n) 

n = C*min([X,Y])*2
if X >= Y:
    n += (X-Y)*A 
else:
    n += (Y-X)*B 
result.append(n) 

n = C*max(X,Y)*2
result.append(n)

print(min(result))


    
        

Measured memory_bytes: 3060