akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define big 998244353
#define ff first
#define se second
#define pb push_back
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define pi 3.141592653589
int power(int x,int y){
    int r=1,z=x;
    while(y){
        if(y & 1)r*=z;
        z*=z;y=y>>1;}
    return r;}
int powerm(int x,int y,int p){
    int r=1;
    while(y){
        if(y & 1)r=(r*x)%p;
        y=y>>1;
        x=(x*x)%p;}
    return r%p;}
int modinv(int x,int m){
    return powerm(x,m-2,m);}
int logarithm(int a,int b){
    int x=0;
    while(a>1){
        x++;
        a/=b;}
    return x;}
int32_t main(){
    fast;
    int n,k;
    cin>>n>>k;
    set<int> s;
    int d;
    for(int i=0;i<k;i++){
        cin>>d;
        for(int j=0;j<d;j++)
        {
            int l;
            cin>>l;
            s.insert(l);
        }
    }
    cout<<n-s.size();
    return 0;
}

Measured memory_bytes: 3604
a = list(map(int,input().split()))
a = [x-min(a) for x in a]
a.sort()
A = a[2]
B = a[1]
C = a[0]
if B%2 == 0:
    print(int(A-B/2))
else:
    print(int(A-(B-1)/2+1))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
long long dp[401][401];
int main() {
	int n;
	cin>>n;
	vector < int > a(n);
	vector < long long > sum(n+1);
	for(int  i=0;i<n;i++) cin>>a[i];
	sum[0]=0;
	for(int i=1;i<=n;i++) sum[i]=a[i-1]+sum[i-1];
	for(int i=1;i<=n-1;i++) {
		for(int j=0;j<=n-1-i;j++) {
			dp[j][j + i]=1e18;
			for(int k=0;k<i;k++) {
				dp[j][j+i]=min(dp[j][j+i],dp[j][j+k]+dp[j+k+1][j + i]+sum[j+i+1]-sum[j]);
			}
		}
	}
	cout<<dp[0][n-1];
	return 0;
}

Measured memory_bytes: 1536
import math
import sys
import collections

n = int(input())

if n == 1:
    print(0)
    sys.exit()
a = []
while n % 2 == 0:
    a.append(2)
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        a.append(f)
        n //= f
    else:
        f += 2
if n != 1:
    a.append(n)
c = collections.Counter(a)
list = c.values()
ANS = 0
for l in list:
    i = 1
    cnt = 1
    while l >= cnt:
        ANS += 1
        i += 1
        cnt += i
print(ANS)

Measured memory_bytes: 9492
#include<iostream>
#include<cstdio>
#include<vector>
#include<cstring>
#include <math.h>
#include<algorithm>
#include <stack>
#include <string>
#define ll long long int
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    int n,m;
    int a,sum=0;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++)
    {
        scanf("%d",&a);
        sum+=a;
    }
    if(sum>=n)
    cout<<"Yes";
    else 
    cout<<"No";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int);
void init(void);
void printList(void);
void deleteNode(NodePointer);
void deleteLast(void);
void deleteFirst(void);
void delete(int);
void insert(int);

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++;
      }
      size--;
    }
  }

  printList();
  return 0;
}

NodePointer listSearch(int key){
  NodePointer ele = nil->next;
  while(ele != nil && ele->key != key){
  	ele = ele->next;
  }
  return ele;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
	if(t == nil) return ;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  deleteNode(listSearch(key));
}

void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}



Measured memory_bytes: 32976
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
const int MAX = 10005;
int P[MAX];
pair<int, pair<int,int> > C[MAX]; //<重み,<始点,終点>>

void init()
{
	for (int i = 0; i < MAX; ++i)
	{
		P[i] = i;
	}
}

int root(int a)
{
	if (a == P[a])
	{
		return a;
	}
	else
	{
		root(P[a]);
	}
}

bool same(int a, int b)
{
	if (root(a) == root(b))
	{
		return true;
	}
	else
	{
		return false;
	}
}

void unite(int a, int b)
{
	P[root(b)] = root(a); 
}

int main()
{
	int n;
	cin >> n;
	int cnt = 0;
	int temp;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			cin >> temp;
			if (temp != -1)
			{
				C[cnt].first = temp;
				C[cnt].second.first = i;
				C[cnt].second.second = j;
				cnt++;
			}
		}
	}

	init();
	int ans = 0;
	sort(C,C+cnt);
	for (int i = 0; i < cnt; ++i)
	{
		if (same(C[i].second.first,C[i].second.second) == false)
		{
			ans += C[i].first;
			unite(C[i].second.first,C[i].second.second);
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

constexpr lli inf = 10000 * 10000;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int cs[11] = {};

int main(void) {

	string s;
	cin >> s;

	for (int i = 0; i < s.size(); i++) {
		cs[i] = s[i] - '0';
	}

	lli answer = 0;

	for (lli i = 0; i < (1 << (s.size() - 1)); i++) {

		lli t = cs[0];

		for (int j = 1; j < s.size(); j++) {
			if ((i >> (j - 1)) & 1) {
				answer += t;
				t = cs[j];
			}
			else {
				t *= 10;
				t += cs[j];
			}
		}

		answer += t;
	}

	cout << answer << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>                                                         
                                                                            
using namespace std;                                                        
                                                                            
int main(void){                                                             
  int n, d;                                                                 
  cin >> n >> d;                                                            
                                                                            
  cout << n / (2 * d + 1) + (n % (2 * d + 1) == 0 ? 0 : 1) << endl;         
  return 0
   ;                                                                 
}                                                                           

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

int main()
{
  int n;
  cin >> n;
  vector<int> alphabet_min_count(26, 55);
  rep(i, n)
  {
    string S;
    cin >> S;
    vector<int> alphabet_count(26, 0);
    rep(j, S.size())
    {
      alphabet_count[S[j] - 'a']++;
    }

    rep(j, 26)
    {
      alphabet_min_count[j] = min(alphabet_min_count[j], alphabet_count[j]);
    }
  }

  rep(i, 26)
  {
    char c = 'a' + i;
    rep(j, alphabet_min_count[i])
    {
      cout << c;
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<cstdio>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(int i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const int N=7;
const int INF=1e9+7;
int n;
int a[100007];
int gcd(int x,int y){return y? gcd(y,x%y):x;}
int main(){
	scanf("%d%d",&n,&a[0]);
	rep(i,n)scanf("%d",&a[i]);
	sort(a,a+n+1);
	rep0(i,n)a[i]=a[i+1]-a[i];
	int hh=a[0];
	rep(i,n-1)hh=gcd(a[i],hh);
	printf("%d\n",hh);
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 2000000000
typedef long long ll;

int main(){
    int N ,M;
    double v[51],sum=0.0,ans;
    string s;
    cin >>N;
    rep(i,N){
        cin >> v[i];
    } 
    sort(v, v + N);
    ans = (v[0]+v[1])/2.0;
    for(int i=2;i<N;i++){
        ans = (ans+v[i])/2.0;
    }

    cout << ans << endl;
    
    
    return 0;
    

}

Measured memory_bytes: 256
mod = 10**9 + 7

fact_range = 10**6
facts = [1] * (fact_range + 1)
for i in range(0, fact_range):
    facts[i+1] = facts[i] * (i + 1) % mod

ifacts = [1] * (fact_range + 1)
ifacts[fact_range] = pow(facts[fact_range], mod - 2, mod)
for i in range(fact_range, 0, -1):
    ifacts[i-1] = ifacts[i] * i % mod

def comb(n, k):
    if k < 0 or n < k:
        return 0
    else:
        return facts[n] * ifacts[n-k] % mod * ifacts[k] % mod

x, y = map(int, input().split())
if (x + y) % 3:
    print(0)
else:
    n = (x + y) // 3
    k = x - n
    print(comb(n, k))


Measured memory_bytes: 82164
#include<stdio.h>
#include<string.h>
const int N = 1300;
int main()
{
	char str[N];
	while(fgets(str, 1300, stdin))
	{
		for(int i = 0; i < strlen(str); i++)
		{
			if(str[i] >= 'A' && str[i] <= 'Z')
			{
				printf("%c", str[i] + 32);
			}
			else if(str[i] >= 'a' && str[i] <= 'z')
			{
				printf("%c", str[i] - 32);
			}
			else
			{
				printf("%c", str[i]);
			}
		}
	}
	return 0;
} 


Measured memory_bytes: 2520
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N,M,i,j,k,l,m,n,counter=0;
    cin>>N>>M;
    char a[N][M];
    int b[N][M];
    for(i=0;i<N;i++)
    {
        for(j=0;j<M;j++)
        {
            cin>>a[i][j];
            b[i][j]=-1;
        }
    }
    for(k=0;k<N;k++)
    {
        for(l=0;l<M;l++)
        {
            while(1)
            {
                if(a[k][l-counter]=='c')
                {
                    b[k][l]=counter;
                    counter=0;
                    break;
                }
                if(l-counter==0&&a[k][l]=='.')
                {
                    counter=0;
                    break;
                }
                counter++;
            }
        }
    }
    for(m=0;m<N;m++)
    {
        for(n=0;n<M;n++)
        {
            cout<<b[m][n];
            if(n+1!=M)
            {
                cout<<" ";
            }
            else
            {
                cout<<endl;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3140
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>

#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl

//ここからAtCoder向けdefine
#define yes cout << "YES" << endl
#define no cout << "NO" << endl

using namespace std;

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using pint = pair<int,int>;

const int INF = ~(1 << 31);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m;
    cin >> m;
    cout << 48 - m << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ii pair<int, int>
#define vi vector<int>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
using namespace std;
const int MOD = 1e9+7, N = 2002;
int f[N];

int pow(int x, int p) {
    int res = 1;
    for(; p; p>>=1) {
        if(p & 1) (res *= x) %= MOD;
        (x *= x) %= MOD;
    }
    return res;
}

int inv(int x) {return pow(x, MOD-2);}

int C(int i, int j) {
    int d = (f[i] * f[j-i]) % MOD;
    return (f[j] * inv(d)) % MOD;
}

int32_t main() {
    // freopen("in.txt", "r", stdin);
    IOS;
    f[0] = 1;
    for(int i=1; i<N; i++) f[i] = (f[i-1] * i) % MOD;
    int S, ans = 0; cin >> S;
    f[0] = 1;
    for(int i=1; i<=S/3; i++) {
        (ans += C(i-1, S-2*i-1)) %= MOD;
    }
    cout << ans;

}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll a,b,n;
  scanf("%lld%lld%lld",&a,&b,&n);
  ll x=min(b-1,n);
  printf("%lld\n",a*x/b);
  return 0;
}


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

const int MOD = (int)1e9+7;

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

	if(A==B)	cout << 0 << endl;
	else if((A+B)%2==0)	cout << (A+B)/2 << endl;
	else	cout << "IMPOSSIBLE" << endl;

	return 0;
}


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

string S;
size_t cur;

int digit() {
  assert(isdigit(S[cur]));
  int n = S[cur] - '0'; // ASCII code -> digit
  cur = cur+1;
  return n;
}

int number() {
  int n = digit();
  while (cur<S.size() && isdigit(S[cur])) {
    n = n*10 + digit();
  }
  return n;
}

int expression();

int factor() {
  if (S[cur] != '(') return number();
  cur += 1;
  int n = expression();
  assert(S[cur] == ')');
  cur += 1;
  return n;
}

int term() {
  int a = factor();
  while (cur<S.size() && (S[cur]=='*' || S[cur]=='/')) {
    char op = S[cur++];
    int b = factor();
    if (op=='*') a *= b;
    else a /= b;
  }
  return a;
}

int expression() {
  int a = term();
  while (cur<S.size() && (S[cur]=='+' || S[cur]=='-')) {
    char op = S[cur++];
    int b = term();
    if (op == '+') a += b;
    else a -= b;
  }
  return a;
}

#if 0
int parse() {return expression();}

int main() {
  int a = parse();
  cout << a << endl;
  assert(a == 4);
  assert(cur == S.size());
  return 0;
}
#endif
  
int main() {
  int N;
  cin >> N;
  for (int i=0; i<N; i++){
    cur = 0;
    cin >> S;
    S.resize(S.size()-1); // delete '='
    cout << expression() << endl;
  }
  return 0;
}

Measured memory_bytes: 3028
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	string S;
	cin >> S;
	int ans = 0;
	if (S[0] == 'o') ans += 100;
	if (S[1] == 'o') ans += 100;
	if (S[2] == 'o') ans += 100;
	cout << 700 + ans << endl;
	return 0;
}

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

int N;
vector<vector<int> > adj;

int cc[100010];
int dp(int u) {
    int &ret = cc[u];
    if(ret != -1) return ret;

    vector<int> tmp;
    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        tmp.push_back(dp(v));
    }
    sort(tmp.begin(), tmp.end());
    reverse(tmp.begin(), tmp.end());

    ret = 0;
    int cnt = 1;
    for(int i = 0; i < tmp.size(); i++) {
        ret = max(ret, cnt + tmp[i]);
        cnt++;
    }

    return ret;
}

int main() {
    scanf("%d", &N);
    adj.resize(N);
    for(int i = 0; i < N - 1; i++) {
        int t; scanf("%d", &t);
        adj[--t].push_back(i + 1);
    }
    memset(cc, -1, sizeof(cc));
    printf("%d", dp(0));
}


Measured memory_bytes: 17024
// #pragma GCC optimize "trapv" Uncomment when dealing with huge numbers
/*<----------PBDS---------->

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
template <typename T>
using order_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

order_set<datatype>oset;
Kth smallest : *oset.find_by_order(k-1); // 0 based index
No of elements less than k : oset.order_of_key(k);
Erase X : oset.erase(x)
<----------PBDS---------->*/
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define pb(x) push_back(x)
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
	int n,k;
	cin >> k >> n;
	int a[n];
	for(int i = 0 ; i < n ; i++ ){
		cin >> a[i];
	}
	int ans = 0;
	int res = 0;
	bool ok = false;
	for(int i = 1 ; i < n ; i++ ){
		if((a[i]-a[i-1])>(a[0]+k-a[n-1])){
			res = max(res,a[i]-a[i-1]);
			ok = true;
		}
	}	
	for(int i = 1 ; i < n ; i++ ){
		ans+=(a[i]-a[i-1]);
	}	
	if(ok==false){
		cout << ans;
	}
	else{
		cout << (ans-res)+a[0]+k-a[n-1];
	}
}





Measured memory_bytes: 1792
n=int(input())
dicts={}
nums=0
for x in range(n):
    s=str(input())
    sorting=sorted(s)
    sorting="".join(sorting)
    if sorting not in dicts.keys():
        dicts[sorting]=1
    else:
        dicts[sorting]+=1
for x in  dicts.values():
    nums+=int(x*(x-1)/2)
print(nums)

Measured memory_bytes: 17892
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    int N;ll W;cin>>N>>W;
    vector<vector<ll>> knapsack(4);
    ll v;ll w;
    ll w1;
    REP(i,N){
        cin>>w>>v;
        if(i==0)w1=w;
        knapsack[(int)(w-w1)].push_back(v);
    }
    REP(i,4)sort(all(knapsack[i]),greater<ll>());
    REP(i,4)FOR(j,1,knapsack[i].size())knapsack[i][j]+=knapsack[i][j-1];
    vector<int> n(4);
    ll res=0;
    REP(i,4)n[i]=knapsack[i].size();
    REP(i,n[0]+1)REP(j,n[1]+1)REP(k,n[2]+1)REP(l,n[3]+1){
        if(i*w1+j*(w1+1)+k*(w1+2)+l*(w1+3)>W)continue;
        ll tmp=0;
        if(i>0)tmp+=knapsack[0][i-1];
        if(j>0)tmp+=knapsack[1][j-1];
        if(k>0)tmp+=knapsack[2][k-1];
        if(l>0)tmp+=knapsack[3][l-1];
        res=max(res,tmp);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, n, w, val, wei, wf, ans = 0;
  scanf("%lld%lld", &n, &w);
  ll dp[n + 1][n * 3 + 1];
  for(i = 0; i <= n; ++i) for(j = 0; j <= 3 * n; ++j) dp[i][j] = 0;
  for(i = 0; i < n; ++i) {
    scanf("%lld%lld", &wei, &val);
    if(!i) wf = wei;
    wei -= wf;
    for(j = n; j > 0; --j) for(k = n * 3 - wei; k >= 0; --k) if(dp[j][k + wei] < dp[j - 1][k] + val) dp[j][k + wei] = dp[j - 1][k] + val;
  }
  for(i = 0; i <= n; ++i) for(j = 0; j <= 3 * n; ++j) if(i * wf + j <= w && ans < dp[i][j]) ans = dp[i][j];
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

int d[500][500]; //d[u][v]は辺e=(u,v)のコスト（存在しない場合はINF、ただしd[i][i]=0とする）
int V; //頂点数
vector<int> graph[220];
int color[220];

bool dfs(int v,int c) {
    color[v] = c;
    for(int i = 0;i < graph[v].size();i++) {
        if(color[graph[v][i]] == c) {
            return false;
        }
        if(color[graph[v][i]] == 0 && !dfs(graph[v][i],-c)) {
            return false;
        }
    }
    return true;
}
void init() {
    for(int i = 0;i < 500;i++) {
        for(int j = 0;j < 500;j++) {
            if(i == j) {
                d[i][j] = 0;
            }
            else {
                d[i][j] = INF;
            }
        }
    }
}
void warshall_floyd() {
    for(int k = 0;k < V;k++) {
        for(int i = 0;i < V;i++) {
            for(int j = 0;j < V;j++) {
                d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
            }
        }
    }
}

signed main() {
    cin >> V;
    vector<vector<char>> vec(V,vector<char>(V));
    for(int i = 0;i < V;i++) {
        for(int j = 0;j < V;j++) {
            cin >> vec.at(i).at(j);
        }
    }
    init();
    for(int i = 0;i < V;i++) {
        for(int j = 0;j < V;j++) {
            if(vec.at(i).at(j) == '1') {
                d[i][j] = 1;
                graph[i].push_back(j);
            }
        }
    }
    for(int i = 0;i < V;i++) {
        if(color[i] == 0) {
            if(dfs(i,1) == false) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    warshall_floyd();
    int ret = 0;
    for(int i = 0;i < V;i++) {
        int cnt = 0;
        for(int j = 0;j < V;j++) {
            cnt = max(cnt,d[i][j]);
        }
        ret = max(ret,cnt);
    }
    cout << ret + 1 << endl;
}

Measured memory_bytes: 2688
#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 x;
  cin >> x;

  int ans = 10 - x / 200;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
def main():
    _ = input()
    A = list(map(int, input().split()))
    d = dict()
    for i in range(len(A)):
        d[i+1] = A[i]
    d = sorted(d.items(), key=lambda x: x[1])
    print(*[l[0] for l in d])


if __name__ == "__main__":
    main()


Measured memory_bytes: 25564
import java.util.*;
 
class Main{
    public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		double x1 = scan.nextDouble();
		double y1 = scan.nextDouble();
		double x2 = scan.nextDouble();
		double y2 = scan.nextDouble();

		double distance = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));

		System.out.println(distance);
    }
}

Measured memory_bytes: 27996
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        Pattern p1 = Pattern.compile("^.+keyence$");
        Pattern p2 = Pattern.compile("^k.+eyence$");
        Pattern p3 = Pattern.compile("^ke.+yence$");
        Pattern p4 = Pattern.compile("^key.+ence$");
        Pattern p5 = Pattern.compile("^keye.+nce$");
        Pattern p6 = Pattern.compile("^keyen.+ce$");
        Pattern p7 = Pattern.compile("^keyenc.+e$");
        Pattern p8 = Pattern.compile("^keyence.+$");
        Pattern p9 = Pattern.compile("^keyence$");

        boolean isMatch = p1.matcher(s).matches();
        if(!isMatch) isMatch = p2.matcher(s).matches();
        if(!isMatch) isMatch = p3.matcher(s).matches();
        if(!isMatch) isMatch = p4.matcher(s).matches();
        if(!isMatch) isMatch = p5.matcher(s).matches();
        if(!isMatch) isMatch = p6.matcher(s).matches();
        if(!isMatch) isMatch = p7.matcher(s).matches();
        if(!isMatch) isMatch = p8.matcher(s).matches();
        if(!isMatch) isMatch = p9.matcher(s).matches();

        String ans = isMatch ? "YES" : "NO";
        System.out.println(ans);
    }
}


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

int main() {
    int A;
    int B;
    cin >> A >> B;
    int ans = 0;
    if ( A > 9 || B > 9) {
        ans = -1;
    } else {
        ans = A * B;
    }
    cout << ans ;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <tuple>
#include <numeric>
#include <cstdio>
#include <cmath>
#include <cstdlib>
using namespace std;
using ll = long long;
const int INF = 1e9;

int main() {
    int n; cin >> n;
    vector<int> a(n+1, 1);
    for (int i = 2; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (i * j > n) break;
            a[i * j]++;
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += (ll)a[i] * i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 41840
import scala.math.ceil

object Main {
  val sc = new java.util.Scanner(System.in)

  def sin(n: Int): Seq[Int] = Seq.fill(n)(sc.nextInt())

  def iin(): Int = sc.nextLine().toInt

  def main(args: Array[String]): Unit = {
    val n = iin()
    val a = sin(n)

    println( 1.0 / a.foldLeft(0.0)((b, x) => b + 1 / x.toDouble) )
  }
}

Measured memory_bytes: 27448
array = [[10*[0] for _ in [0]*3] for _ in [0]*4]
n = int(input())
for _ in range(n):
    a,b,c,d = map(int,input().split())
    array[a-1][b-1][c-1] += d
for i in range(4):
    for j in range(3): print('',*array[i][j])
    if i<3: print('#'*20)



Measured memory_bytes: 5620
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define ll long long
#define mset(s, _) memset(s, _, sizeof s)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

struct UnionFind {
  vector<int> par;  // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

  UnionFind(int N) : par(N) {  //最初は全てが根であるとして初期化
    for (int i = 0; i < N; i++) par[i] = i;
  }

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

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

  bool same(int x, int y) {  // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

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

  UnionFind tree(N);

  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    tree.unite(a, b);
  }

  unordered_map<int, int> Map;

  for (int i = 0; i < N; i++) {
    // cout << i << ": " << tree.root(i) << endl;
    Map[tree.root(i)]++;
  }

  int max_tree = 0;
  for (auto m : Map) {
    // cout << m.first << " : " << m.second << endl;
    max_tree = max(max_tree, m.second);
  }

  cout << max_tree << endl;

  return 0;
}


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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;



int main(){

    int a,b,c,d;
    cin >> a >> b >> c >> d;

    int tturn = (a + d - 1) / d;
    int aturn = (c + b - 1) / b;

    cout << (tturn >= aturn ? "Yes" : "No" ) << endl;
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    int i=0,t,d,s;
    cin>>d>>t>>s;
  float n;
    n=(float)d/s;
    if(n>t)
    {
    cout<<"No";
    }
    else
    {cout<<"Yes";}
}

Measured memory_bytes: 3616
#include <iostream>

 

using namespace std;

 

int main()
{
    int i, x;
    for(i=1; i<=10000; i++)
    {
        cin >> x;
        if (x==0)
           break;
        cout << "Case " << i << ":" << " " << x << endl;
        
        
    }
}


Measured memory_bytes: 2976
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1000000007;
ll const N=1e6+5;

int main() {
 
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        int k;cin>>k;k--;
        cout<<a[k]; 
    }
    return 0;   
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
constexpr ll MOD = 1e9+7;
constexpr ll INF = 1LL << 60;
constexpr int Inf = 1e9;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

void Yes(bool b)
{
  if(b) cout << "Yes" << endl;
  else cout << "No" << endl; 
}


signed main()
{
  ios();
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  Yes(abs(c-a) <= d || (abs(a-b)<= d && abs(c-b) <=d));
  
  
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	var N = parseInt(input.split('\n')[0]);
	var a = input.split('\n')[1].split(' ');
	a = a.map(val => parseInt(val));
	var ave = 0;
	for ( var i = 0; i < N; i++ ) {
		ave += a[i];
	}
	ave = ave / N;
	var def = [];
	for ( var j = 0; j < N; j++ ) {
		def.push(Math.abs(a[j] - ave));
	}
	var min = Math.min(...def);
	console.log(def.indexOf(min));
}

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7496
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  string s; cin >> s;
  for (int i = 0; i < s.size(); i += 2) {
    cout << s[i];
  }
  cout << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

const ll mod = 1e9 + 7;
int n;
vector<int> a;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll n;
    cin >> n;
    string s;
    while (n) {
        n--;
        char c = 'a' + n % 26;
        s = c + s;
        n /= 26;
    }
    cout << s;
    return 0;
}

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

using namespace std;

#define lli long long
#define ld long double
#define mod 1000000007 
#define set(n) cout << fixed << setprecision(n)    
#define fi first
#define se second
#define mp make_pair
#define pll pair<lli, lli>
#define endl '\n'

const double PI = acos(-1);
const double epsilon = 1e-7;  // floating point precision

signed main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n;
    cin >> n;
    vector<lli> v(n);
    for(auto& e : v) {
        cin >> e;
    }
    lli ans = 0ll;
    for(int i = 0; i < n; i++) {
        for(int j = i + 1; j < n; j++) {
            for(int k = j + 1; k < n; k++) {
                if(v[i] == v[j] or v[j] == v[k] or v[i] == v[k]) {
                    continue;
                }
                if(v[i] + v[j] > v[k] and v[i] + v[k] > v[j] and v[j] + v[k] > v[i]) {
                    ans ++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
// Reading stuff 
// check the modulus 
// for tree case n=1


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
 
#include <bits/stdc++.h>
#include <vector> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;

#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)
const ll hell=1000000007;



int solve(){    
 
 
 double x,pi=3.1415926535897;
 cin>>x;
 x*=2.0;
 x*=pi;
 cout<<fixed<<setprecision(15)<<x;



return 0;
}

 
signed main()
{    



   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);


int t=1;                                                                                                                  
//cin>>t;
int k=1;

    while(t--)
     {
      //cout<<"Case #"<<k<<": ";
      k++;
      solve();
     }
    return 0;
  }

Measured memory_bytes: 3800
//raja1999

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string> 
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define int ll

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

//std::ios::sync_with_stdio(false);
int print(int n){
	int i,j;
	rep(i,n){
		rep(j,n){
			if(i<j&&i+j!=n-1){
				cout<<i+1<<" "<<j+1<<endl;
			}
		}
	}
}
int main(){
	std::ios::sync_with_stdio(false); cin.tie(NULL);
	int n,i;
	cin>>n;
	if(n%2==0){
		cout<<((n-2)*n)/2<<endl;
		print(n);
	}	
	else{
		cout<<(n-3)*(n-1)/2+n-1<<endl;
		print(n-1);
		rep(i,n-1){
			cout<<i+1<<" "<<n<<endl;
		}
	}
	return 0;
} 
	

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long A, long long B){
    cout << A*B - A - B + 1 << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val n = readInt()
    print(when(n % 10) {
        2,4,5,7,9 -> "hon"
        0,1,6,8 -> "pon"
        3 -> "bon"
        else -> {}
    })
}

Measured memory_bytes: 34380
#include <stdio.h>

int stack[1000];
int last;

void pop(void)
{
	last--;
}

void push(int x)
{
	stack[last] = x;
	last++;
}

int top(void)
{
	return (stack[last - 1]);
}


int main(void)
{
	char n[1000000];
	int  a, b, x, i;
	
	while (scanf("%s", n) == 1){
		x = 0;
		switch (n[0]){
			case '+':
				a = top();
				pop();
				b = top();
				pop();
				push(a + b);
				break;
			
			case '-':
				a = top();
				pop();
				b = top();
				pop();
				push(b - a);
				break;
			case '*':
				a = top();
				pop();
				b = top();
				pop();
				push(b * a);
				break;
		}
		if (n[0] != '+' && n[0] != '-' && n[0] != '*'){
			for (i = 0; n[i] != '\0'; i++){
				x = x * 10 + n[i] - '0';
			}
			push(x);
		}
	}
	
	printf("%d\n", top());
	
	return (0);
}

Measured memory_bytes: 548
//
// Created by yamunaku on 2019/10/22.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int n;
    cin >> n;
    vi a(n);
    int ki = 0;
    rep(i,n){
        cin >> a[i];
        if(a[i]%2) ki++;
    }
    if(ki==0||ki==n){
        cout << 0 << endl;
    }else if(ki%2){
        cout << n-1 << endl;
    }else{
        cout << n-2 << endl;
    }
    return 0;
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint(){
    int x=0,p=1;char c=getchar();
    while (c<=32)c=getchar();
    if(c==45)p=-p,c=getchar();
    while (c>32)x=x*10+c-48,c=getchar();
    return x*p;
}
using namespace std;
//ruogu
//
int main(){
	int x=getint(),y=getint();
	cout<<max(max(x+y,x-y),x*y)<<endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
S1 = input()
S2 = input()

m = 1000000007

if S1[0] == S2[0]: # 全部横向きの場合
    result = 3
else:
    result = 6

x = 0
W = len(S1)

while x < W:
    if S1[x] == S2[x]:
        if x + 1 == W:
            break
        result *= 2
        result %= m
        x += 1
    else:
        if x + 2 == W:
            break
        if S1[x + 2] != S2[x + 2]:
            result *= 3
            result %= m
        x += 2
print(result)

Measured memory_bytes: 9124
N = int(input())
S = input()

result = 0

for i in range(1000):
    if i < 10:
        temp = "00" + str(i)
    elif i < 100:
        temp = "0" + str(i)
    else:
        temp = str(i)

    cur = 0
    for j in range(3):
        if temp[j] in S[cur:]:
            cur += S[cur:].index(temp[j]) + 1
            if j == 2:
                result += 1
        else:
            break

print(result)

Measured memory_bytes: 3064
# coding: utf-8
#N, h, w = map(int,input().split())
N = int(input())
#s = list(map(str,input().split()))
a, b = map(int,input().split())
P = list(map(int,input().split()))
ans = 0
c1 = 0
c2 = 0
c3 = 0

for p in P:
    if p <= a:
        c1 += 1
    elif a < p <= b:
        c2 += 1
    else:
        c3 += 1
print(min(c1,c2,c3))

Measured memory_bytes: 9032
#include <bits/stdc++.h>
#define rep(begin, end) for (i=begin;i<end;i++)
#define init(arr, val) for (i=0;i<end;i++) arr[i] = val;
#define printint(i0, i1) printf("%d %d\n", i0, i1)

using namespace std;
const int inf = pow(10,9);
const int nil = -1;
long long  i, n, k, ans, numof5=0;

int main() {
    scanf(" %lld", &n);
    if (n%2 != 0) {
        printf("%d\n", 0); exit(0);
    }
    k = 5;
    while (k < n) {
        numof5 += n / k / 2;
        k *= 5;
    }
    printf("%lld\n", numof5);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fill fill_n
#define pf push_front
#define pb push_back
#define FOR(i,l,r) for(int i=l;i<r;i++)
#define ROF(i,r,l) for(int i=r;i>=l;i--)
#define comp(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define infile freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
typedef vector<int> vi;
typedef vector<ll> vli;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvli;
const int M = 1e9+7;
const int N = 2e5;
ll po(int,int);


void solve(){
    int h,w,k;
    cin>>h>>w>>k;
    string s[h];
    FOR(i,0,h) cin>>s[i];
    int ans=0;
    FOR(x,0,(1<<h)){
        FOR(y,0,(1<<w)){
            int b = 0;
            FOR(i,0,h){
                FOR(j,0,w){
                    if(((x>>i)&1)==0 && ((y>>j)&1)==0 && s[i][j]=='#') b++;
                }
            }
            if(b==k) ans++;
            
        }
    }
    cout<<ans<<"\n";
    
}





int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    
	return 0;
	
	
}


ll po(int a,int b){
    if(b==0) return 1;
    ll ans=1;
    if(b%2==0){
        ans = po(a,b/2)%M;
        ans=(ans%M * ans%M)%M;
    }
    else{
        ans = po(a,(b-1)/2)%M;
        ans = (ans%M * ans%M * a)%M;
    }
    return ans%M;
}


Measured memory_bytes: 3608
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i, n):
        ok = True
        for k in range(i, j + 1):
            if s[k] not in ['A', 'T', 'G', 'C']:
                ok = False
        if ok:
            ans = max(ans, j - i + 1)
print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
const int maxn = 1e5 + 5;
int dp[maxn][21] , a[maxn] , n , L;
int ask (int x , int c)
{
    int pos = x;
    if (dp[pos][0] == -1) return 1e9;
    for (int i = 20 ; i >= 0 ; i--){
        if (c & (1 << i)){
            if (pos == -1 || dp[pos][i] == -1) return 1e9;
            pos = dp[pos][i];
        }
    }
    if (pos == -1) return 1e9;
    return pos;
}
void solve ()
{
    for (int i = 1 ; i <= n ; i++) {
        int l = 1 , r = n , mid;
        while (l <= r){
            mid = l + r >> 1;
            if (a[mid] <= a[i] + L) l = mid + 1;
            else r = mid - 1;
        }
        dp[i][0] = r;
    }
    dp[n][0] = -1;
    for (int i = 1 ; i <= 20 ; i++)
        for (int j = 1 ; j <= n; j++){
            if (dp[j][i - 1] == -1) dp[j][i] = -1;
            else dp[j][i] = dp[dp[j][i - 1]][i - 1];
        }
}
int main()
{
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 1 ; i <= n ; i++) cin >> a[i];
    cin >> L;
    solve ();
    int q;cin >> q;
    while (q--){
        int x , y; cin >> x >> y;
        if (x > y) swap(x , y);
        int l = 1 , r = n;
        while (l <= r){
            int mid = l + r >> 1;
            if (ask(x , mid) > y) r = mid - 1;
            else l = mid + 1;
        }
        if (ask(x , r) < y) r++;
        cout << r << endl;
    }
    return 0;
}

/*
9
1 3 6 13 15 18 19 29 31
10
17
1 9
2 9
3 9
4 9
5 9
6 9
7 9
8 9
9 9

9
1 3 6 13 15 18 19 29 31
10
4
4 9
*/


Measured memory_bytes: 12172
import numpy as np
A = np.array([])
f=False
B= np.zeros((3,3))

for i in range(3):
  A=np.append(A,list(map(int,input().split())))
A=A.reshape(3,3)

n=int(input())

for i in range(n):
  x=int(input())
  B+=(A==x)*1
  
for i,j in zip(sum(B),sum(B.T)):
  f=f or (i//3) or (j//3) 
f = f or (sum(np.diag(B))//3)
f = f or (sum(np.diag(np.fliplr(B)))//3)
print("Yes" if f else "No")

Measured memory_bytes: 13664
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>

using namespace std;


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

    // この区間にある白の数
    vector<int> wsum(s.size() + 1, 0);
    vector<int> bsum(s.size() + 1, 0);
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '.'){
            wsum[i+1] = wsum[i] + 1;
            bsum[i+1] = bsum[i];
        }else{
            wsum[i+1] = wsum[i];
            bsum[i+1] = bsum[i] + 1;
        }
    }

    int ans = INT_MAX;

    for(int i = 0; i < wsum.size(); i++){
        ans = min(ans, bsum[i] - bsum[0] + wsum[n] - wsum[i] );
    }
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 2180
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	//min(a,b)...a,bの小さいほう
	//max(a,b)...     大きいほう
	int a;
	int b;
	int c;
	int d;
	int e;
	std::cin >> a;
	if (a % 2 == 0) {
		cout << a << "\n";
	}
	else if(a % 2 == 1) {
		cout << a * 2 << "\n";
	}
	
	std::cin >> e;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int H;
	int W;
	int[][] ans;
	void input(){
		H = sc.nextInt();
		W = sc.nextInt();
		ans = new int [H][W];
		char[] kumo = new char[W];
		for(int i = 0; i < H; i++){
			kumo = sc.next().toCharArray();
			keisan(i, kumo);
		}
	}
	void keisan(int i, char kumo[]){
		int count = 0;
		int no = 0;
		for(int j = 0; j < W; j++){
			for(int l = j; l >= 0; l--){
				if(kumo[l] == 'c'){
					ans[i][j] = count;
					no = 1;
					break;
				}else if(kumo[l] == '.'){
					count = count + 1;
				}
			}
			if(no == 0){
				ans[i][j] = -1;
			}
			count = 0;
			no = 0;
		}
	}
	
	void output(){
		for(int i = 0; i < H; i++){
			for(int k = 0; k < W; k++){
				System.out.print(ans[i][k]);
				if(k != W - 1){
					System.out.print(" ");
				}
			}
		System.out.println("");
		}
	}
	
	
	void doIt(){
		input();
		output();
	}
	

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main() . doIt();
	}

}

Measured memory_bytes: 36492