akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		int ans = 0;
		int count = 0;
		
		for(int i=0; i<a.length(); i++){
		    if(a.charAt(i) == 'A' || a.charAt(i) == 'C' || a.charAt(i) == 'G' || a.charAt(i) == 'T'){
		        count++;
		        if(ans < count){
		            ans = count;
		        }
		    }else{
		        count = 0;
		    }
		}
		
		System.out.println(ans);
    }
}


Measured memory_bytes: 35520
#include <bits/stdc++.h>
#define endl        '\n'
#define pi          2*acos(0.0)
#define pb(a)       push_back(a)
#define db          double
#define ld          long double
#define ll          long long
#define ull         unsigned long long
#define mod         1000000007
#define inf         1000000000000000001
#define sqr(x)      (x) * (x)
#define gcd(a, b)   __gcd(a, b)
#define lcm(a, b)   ((a/gcd(a,b)) * b)
#define debug(x) 	cerr << #x << " = " << (x) <<endl
#define all(x)      (x).begin(), (x).end()
#define unsyncIO    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)


using namespace std;

int main()
{
    //freopen("/home/taalpatar_shepai/Documents/my_codes/out.txt", "w", stdout);
    unsyncIO;
    int n;
    cin >> n;
    vector<ll> v(n);
    bool check = false;
    for (int i = 0; i < n; i++){
        cin >> v[i];
        if (v[i] == 0)
            check = true;
    }
    if(check) {
        cout << "0" << endl;
        return 0;
    }
    ll ans = 1;
    for (int i = 0; i < n; i++) {
        if (v[i] <= 1000000000000000000 / ans)
            ans *= v[i];
        else
        {
            cout << "-1" << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3980
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,k = readInts()
dic = defaultdict(int)
d = set()
for i in range(n):
    a,b = readInts()
    d.add(a)
    dic[a] += b
d = sorted(list(d))
ans = 0
for v in d:
    if ans + dic[v] >= k:
        print(v)
        exit()
    ans += dic[v]


Measured memory_bytes: 19620
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(vector<vector<A>> v) { string res="{"; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res+"}";}

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

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H,W;
  cin >> H >> W;
  MAT2D(m,int,H+2,W+2);
  REP(i,H) {
    string s;
    cin >> s;
    REP(j,W) {
      if (s[j] == '.') m[i+1][j+1] = 1;
    }
  }
  MAT3D(d,int,H+2,W+2,4);
  RREP(i,1,H+1) {
    RREP(j,1,W+1) {
      if (m[i][j] == 1) {
        d[i][j][0] = d[i][j-1][0] + 1;
        d[i][j][1] = d[i-1][j][1] + 1;
      }
      int ri = H+1-i, rj = W+1-j;
      if (m[ri][rj] == 1) {
        d[ri][rj][2] = d[ri][rj+1][2] + 1;
        d[ri][rj][3] = d[ri+1][rj][3] + 1;
      }
    }
  }
  int ans = 0;
  RREP(i,1,H+1) {
    RREP(j,1,W+1) {
      int t = d[i][j][0]+d[i][j][1]+d[i][j][2]+d[i][j][3];
      if (t > ans) ans = t;
    }
  }
  cout << ans - 3 << endl;
  return 0;
}

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

#define MAX 5000

int t[MAX][5];

void destroy(void){
	for(int i=MAX-1;i>=0;i--){
		int count = 0;
		for(int j=0;j<5;j++){
			count += t[i][j];
		}

		if(count == 0) break;

		else if(count == 5){
			for(int k=i;k>0;k--){
				count = 0;
				for(int j=0;j<5;j++){
					t[k][j] = t[k-1][j];
					t[k-1][j] = 0;
					count += t[k][j];
				}
				if(count == 0) break;
			}
			i++;
		}
	}
}

void setBlock(int d,int p,int q){
	int sj = q - 1;
	int w = d == 1 ? p : 1;
	int h = -1;

	for(int i=0;i<MAX-1;i++){
		for(int j=sj;j<sj+w;j++){
			if(t[i+1][j]){
				h = i;
				break;
			}
		}
		if(h != -1) break;
	}

	if(h == -1) h = MAX-1;

	if(d == 1){
		for(int j=sj;j<sj+p;j++) t[h][j] = 1;
	}
	else{
		for(int i=h;i>h-p;i--) t[i][sj] = 1;
	}
}

int countBlock(void){
	int res = 0;
	for(int i=MAX-1;i>=0;i--){
		int count = 0;
		for(int j=0;j<5;j++){
			count += t[i][j];
			res += t[i][j];
		}
		if(count == 0) break;
	}
	return res;
}

int main(void){
	int n;

	while(cin>>n && n){
		memset(t,0,sizeof(t));
		for(int i=0;i<n;i++){
			int d,p,q;
			cin>>d>>p>>q;
			setBlock(d,p,q);
			destroy();
		}

		cout<<countBlock()<<endl;
	}

	return 0;
}

Measured memory_bytes: 964
N = int(input())

total = 0

for i in range(N):

    if (i+1) % 15 == 0:
        pass
    elif (i+1) % 3 == 0:
        pass
    elif (i+1) % 5 == 0:
        pass
    else:
        total += (i+1)
        
print(total)



Measured memory_bytes: 9160
K,P=map(int,input().split())
A=list(map(int,input().split()))

x=dict()
x[0]=0
x[1]=0
for i in range(K):
    if A[i]%2==0:
        x[0]+=1
    else:
        x[1]+=1
if x[1]==0:
    if P==0:
        print(2**K)
    else:
        print(0)
    exit()
print(2**(K-1))

Measured memory_bytes: 38256
#include<stdio.h>
int main(){
    unsigned short usW_D_num;                /* 情報量の格納用変数 */
    unsigned short usW_D_house[4][3][10];    /* 部屋情報の格納用変数 */
    unsigned short usW_D_bil;                /* 棟番号の格納用変数 */
    unsigned short usW_D_flor;               /* 階数の格納用変数 */
    unsigned short usW_D_room;               /* 部屋番号の格納用変数 */
    signed long  ulW_D_riside;              /* 入居者数の格納用変数 */
    unsigned short usW_C_i, usW_C_j, usW_C_k;            /* ループ変数 */

    /* 配列の初期化 */
    for(usW_C_i = 0;usW_C_i < 4;usW_C_i++){
        for(usW_C_j = 0;usW_C_j < 3;usW_C_j++){
            for(usW_C_k = 0;usW_C_k < 10;usW_C_k++){
                usW_D_house[usW_C_i][usW_C_j][usW_C_k] = 0;
            }
        }
    }

    /* 情報量の入力 */
    scanf("%d", &usW_D_num);
    /* 入居者変更情報の入力 */
    for(usW_C_i = 0;usW_C_i < usW_D_num;usW_C_i++){
        /* 入居者変更情報の入力 */
        scanf("%d %d %d %d", &usW_D_bil, &usW_D_flor, &usW_D_room, &ulW_D_riside);
        /* 入居者変更情報の加算 */
        usW_D_house[usW_D_bil - 1][usW_D_flor - 1][usW_D_room - 1] += ulW_D_riside;
    }

    /* 部屋情報の出力 */
    for(usW_C_i = 0;usW_C_i < 4;usW_C_i++){
        for(usW_C_j = 0;usW_C_j < 3;usW_C_j++){
            for(usW_C_k = 0;usW_C_k < 10;usW_C_k++){
                /* 各部屋の入居者の出力 */
                printf(" %d", usW_D_house[usW_C_i][usW_C_j][usW_C_k]);
            }
            /* 階の区切り */
            printf("\n");
        }
        /* 第四棟でない場合棟を区切る */
        if(usW_C_i != 3){
           /* 棟の区切り */
           printf("####################\n");
        }
    }
    return 0;
}


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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end() å
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int w, h, x, y;

signed main()
{
    cin >> w >> h >> x >> y;

    double ans = (double)(w * h) / (double)2;

    int ans2 = 1;

    if (2 * x == w && 2 * y == h)
    {
        ans2 = 1;
    }
    else
    {
        ans2 = 0;
    }

    cout << ans << " " << ans2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define fi first
#define se second
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
ll mod=1000000007;
ll n,k,t,m,q,flag=0;
ll po(ll k ,ll n,ll ans,ll temp,ll ans1){
    if(n==0)return ans;
    while(temp<=n){
        ans*=ans1;ans%=mod;ans1=ans1*ans1;ans1%=mod;n=n-temp;temp*=2;
    }
    return po(k,n,ans,1,k)%mod;
    //eg. po(2,78,1,1,2);
}
ll min(ll a,ll b){if(a>b)return b;else return a;}
ll max(ll a,ll b){if(a>b)return a;else return b;}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
   
    //cin>>t;
    t=1;
    while(t--){
        ll n,a,b;
        cin>>n>>a>>b;
        if((b-a)%2==0)cout<<(b-a) /2;
        else cout<<min((a+a-1+b-a)/2 , (n-b+n-b+1+b-a)/2);
        
        
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int q1[123],q2[123],x;
int main()
{
	int n,x,ans=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		q1[i+1]=q1[i]+x;
	}
	for(int i=0;i<n;i++)
	{
		cin>>x;
		q2[i+1]=q2[i]+x;
	}
	for(int i=0;i<n;i++)
		ans=max(ans,q1[i+1]+q2[n]-q2[i]);
	cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,sum=0;
  cin>>a;
  int b=a/100,c=(a/10)%10,d=a%10;
  if(b==1)sum++;
  if(c==1)sum++;
  if(d==1)sum++;
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<cmath>
typedef long long ll;

using namespace std;
ll gcd(ll a, ll b);
vector<pair<ll,int>>factorize(ll n);
int main(){

    ll a,b;
    cin >> a >> b;
    ll g = gcd(a,b);
    auto f = factorize(g);
    int ans = f.size() + 1;
    cout << ans << endl;
    return 0;
}

ll gcd(ll a, ll b){
    return b ? gcd(b,a%b) : a;
}

vector<pair<ll,int>>factorize(ll n){
    vector<pair<ll,int>> res;
    for(ll i(2); i*i<=n; ++i){
        if(n%i) continue;
        res.emplace_back(i,0);
        while(n%i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n!=1)res.emplace_back(n,1);
    return res;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()

const int N = 510;
const int M = 35;
int n, c;
int freq[3][M], d[M][M], best;

int main() {
  scanf("%d%d", &n, &c);
  memset(d, 0, sizeof d);
  memset(freq, 0, sizeof freq);

  for (int i = 1; i <= c; i++)
    for (int j = 1; j <= c; j++)
      scanf("%d", &d[i][j]);
      
  int col;
  for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) {
    scanf("%d", &col);
    freq[(i + j) % 3][col]++;
  }

  best = 2e9;
  for (int i = 1; i <= c; i++) {
    for (int j = 1; j <= c; j++) {
      for (int k = 1; k <= c; k++) {
        if (i == j || i == k || j == k) continue;
        int tmp = 0;
        for (int t = 1; t <= c; t++) {
          tmp += freq[0][t] * d[t][i];
          tmp += freq[1][t] * d[t][j];
          tmp += freq[2][t] * d[t][k];
        }
        best = min(best, tmp);
      }
    }
  }
  printf("%d\n", best);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int x,y,a,b;cin >> x >> y >> a >> b;
    rep(i,b-y)cout << 'U';
    rep(i,a-x+1)cout << 'R';
    rep(i,b-y+1)cout << 'D';
    rep(i,a-x+1)cout << 'L';
    rep(i,1)cout << 'U';
    rep(i,1)cout << 'L';
    rep(i,b-y+1)cout << 'U';
    rep(i,a-x+1)cout << 'R';
    rep(i,b-y+1)cout << 'D';
    rep(i,a-x)cout << 'L';
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if( abs(x-a)>abs(x-b)){
    cout << "B" << endl;
  }
  else{
  cout << "A" << endl;
  }
}

  



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define mod 1000000007
#define inf 1e18
#define PI 3.14159265358979323846264338327950L
#define w(x) int x; cin>>x; while(x--)
using namespace std;
bool sieve[2000006];
void sieve_make() 
{
	memset(sieve,true,sizeof(sieve));
	sieve[0]=sieve[1]=false;
	for(int i=2;i*i<2000006;i++)
	{
		if(sieve[i])
		{
			for(int j=i*i;j<2000006;j+=i)
				sieve[j]=false;
		}
	}
}

int max(int a,int b)
{
	if(a>b)
		return a;
	return b;
}
int min(int a,int b)
{
	if(a<b)
		return a;
	return b;
}
int modexp(int a,int b,int c)
{
	if(a==0) return 0;
	if(b==0) return 1;

	int ans;
	if(b%2==0)
	{
		int small=modexp(a,b/2,c);
		ans=(small*small)%c;
	}
	else
	{
		int small=modexp(a,b-1,c);
		ans=(a%c);
		ans=(small*ans)%c;
	}
	return (ans+c)%c;
}
bool sign(int x)
{
	if(x>0)
		return true;
	return false;
}
int kadane(int* a,int n)
{
	int loc=a[0],glo=a[0];
	for(int i=1;i<n;i++)
	{
		loc=max(a[i],loc+a[i]);
		glo=max(glo,loc);
	}
	return glo;
}

int dp[3001][3001];

int solve(vector<int>& a,int i,int j)
{
	if(i>j) return 0;

	if(dp[i][j]!=-1) return dp[i][j];
	int a1=a[i]+min(solve(a,i+2,j),solve(a,i+1,j-1));
	int a2=a[j]+min(solve(a,i+1,j-1),solve(a,i,j-2));

	return dp[i][j]=max(a1,a2);
}
int32_t main()
{
	ios::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
	
	
	
	
	memset(dp,-1,sizeof dp);
	int n;
	cin>>n;
	vector<int>a(n);
	int s=0;
	for(int i=0;i<n;i++){ cin>>a[i];
		s+=a[i];
	}

	int x=solve(a,0,a.size()-1);
	cerr<<x;
	int y=s-x;
	cout<<x-y<<endl;
}



Measured memory_bytes: 74072
#include <iostream>
#include <math.h>
int main(){

  int N;
  scanf("%d",&N);
  int v[N];
  for (int i=0; i<N; i++){
    scanf("%d",&v[i]);
  }
  int temp;
  for (int j=0; j<N; j++){
    for (int i=1; i<N; i++){
     if (v[i-1]>v[i]){
       temp = v[i];
       v[i] = v[i-1];
       v[i-1] = temp;
     }
    }
  }
  for (int i=0; i<N; i++){
    //printf("v[%d] = %d\n",i,v[i]);
  }
  double ans = 0.0;
  ans += v[0]/pow(2,N-1);
  for (int i=1; i<N; i++){
    ans += v[i]/pow(2,N-i);
  }
  printf("%f\n",ans);

  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long HP[] = new long[N];
		for (int i = 0; i < N; i++) {
			HP[i] = sc.nextInt();
		}
		if (N <= K) {
			System.out.println(0);
		} else {
			long ksum = 0;
			Arrays.sort(HP);
			for (int i = N - K - 1; i >= 0; i--) {
				ksum += HP[i];
			}
			System.out.println(ksum);
		}

	}

}


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

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define setIO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define trav(e, x) for (auto &(e) : (x))
#define pb(x) push_back(x)
#define eb(x...) emplace_back(x)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define lc(i) 2*i
#define rc(i) 2*i+1
//#define int long long
using namespace std;
using ii = pair<int, int>;
using vi = vector<int>;
using vb = vector<bool>;
using vii = vector<ii>;

const int N = 1e5 + 5, MOD = 1e9 + 7, INF = 1e9 + 5;

struct UFDS {
    int n;
    vi par, rank;

    void init(int x) {
        n = x;
        par.resize(n);
        iota(all(par), 0);
        rank.assign(n, 1);
    }

    int get(int x) {
        return par[x] == x ? x : par[x] = get(par[x]);
    }

    bool unite(int x, int y) {
        x = get(x);
        y = get(y);
        if (x == y) return false;
        if (x > y) swap(x, y);
        par[x] = y;
        rank[y] += rank[x];
        return true;
    }
};

signed main() {
    FAST_IO;
//    setIO("input.txt", "output.txt");

    int n, m;
    cin >> n >> m;
    UFDS dsu;
    dsu.init(n);
    while (m--) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        dsu.unite(u, v);
    }
    cout << *max_element(all(dsu.rank));
}

Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

ll pwr(ll a, ll n) {
  ll r = 1;
  for (int i = 0; i < n; i++) {
    r *= a;
  }
  return r;
}

ll C2(ll n) {
  return (n * (n - 1)) / 2;
}

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  const VI pr {2, 5};

  map<PII, int> freq;

  int n; cin >> n;
  while (n--) {
    string s; cin >> s;
    int l = s.size();
    int dot = -1;
    for (int i = 0; i < l; i++) {
      if (s[i] == '.') dot = i;
    }

    ll num = 0, den = 0;

    if (dot == -1) {
      num = stoll(s);
      den = 1;
    } else {
      s.erase(s.begin() + dot);
      num = stoll(s);
      den = pwr(10, l - dot - 1);
    }

    VI f(2);
    for (int i: {0, 1}) {
      int p = pr[i];
      while (num % p == 0) num /= p, f[i]++;
      while (den % p == 0) den /= p, f[i]--;
    }

    freq[{f[0], f[1]}]++;
  }

  ll ans = 0;
  for (const auto [k1, f1]: freq) {
    const auto [l1, r1] = k1;
    if (l1 >= 0 && r1 >= 0) {
      ans += C2(f1) * 2;
    }
    for (const auto [k2, f2]: freq) {
      if (k1 == k2) continue;
      const auto [l2, r2] = k2;
      if (l1 + l2 >= 0 && r1 + r2 >= 0) {
        ans += f1 * 1ll * f2;
      }
    }
  }
  ans /= 2;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}


ll HB[300003];
ll WB[300003];


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

	set<pair<ll, ll>> B;
	rep(i, M) {
		ll h, w;
		cin >> h >> w;
		B.insert(make_pair(h, w));
		HB[h]++;
		WB[w]++;
	}
	ll hm = 0, wm = 0;
	vector<ll> hmh = {};
	vector<ll> wmw = {};
	
	rep(i, H) {
		hm = max(hm, HB[i + 1]);
		/*cout << HB[i+1] << endl;*/
	}
	rep(i, H) {
		if (hm == HB[i + 1]) {
			hmh.push_back(i + 1);
		}
	}
	rep(i, W) {
		wm = max(wm, WB[i + 1]);
		/*cout << WB[i+1] << endl;*/
	}
	rep(i, W) {
		if (wm == WB[i + 1]) {
			wmw.push_back(i + 1);
		}
	}
	if (ll(hmh.size()) * ll(wmw.size()) > M) {
		cout << hm + wm << endl; return 0;
	}
	else {
		/*cout << hmh.size() << wmw.size() << endl;*/
		rep(i, hmh.size()) {
			rep(j,wmw.size()) {
				/*cout << hmh.at(i) << wmw.at(j) << endl;*/
				if (B.count(make_pair(hmh.at(i), wmw.at(j)))) {
					continue;
				}
				else {
					
					cout << hm + wm << endl; return 0;
				}
			}
		}
	}
	cout << hm + wm - 1 << endl; return 0;
}


Measured memory_bytes: 34992
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<char> s(n);
    for (int i=0; i<n; i++) cin >> s[i];
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    if (s.size() == 3) {
        cout << "Three" << endl;
    } else {
        cout << "Four" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

int i,hon[9],h;



while(1){
scanf("%d\n",&h);
if (h==0)break;
for(i=0;i<9;i++){
scanf("%d\n",&hon[i]);
h=h-hon[i];
}


printf("%d\n",h);
}
return 0;
}

Measured memory_bytes: 1724
#include <cstdio>
#include <iostream>
#include <bitset>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

#define ALL(obj) (obj).begin(), (obj).end() 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)

int main(){
    int n;
    cin >> n;
    vector<ll> a(n),b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    ll ans=0;
    rep(k,30){
        ll t = 1 << k;
        vector<ll> sa(n);
        vector<ll> sb(n);
        rep(i,n) sa[i] = a[i] % (2 * t);
        rep(i,n) sb[i] = b[i] % (2 * t);
        sort(ALL(sb));
        ll no=0;
        rep(i,n){
            no += upper_bound(ALL(sb), 4 * t - sa[i] - 1) - lower_bound(ALL(sb), 3 * t - sa[i]);
            no += upper_bound(ALL(sb), 2 * t - sa[i] - 1) - lower_bound(ALL(sb), t - sa[i]);   
        }
        ans |= (no % 2) << k;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6552
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		TreeSet<Integer> a = new TreeSet<Integer>();
		for (int i = 0; i < n; i++)
			a.add(sc.nextInt());
		sc.close();

		int ans = a.ceiling(a.last() / 2);
		if (ans - a.last() / 2 > a.last() / 2 - a.floor(a.last() / 2))
			ans =  a.floor(a.last() / 2);
		if (ans == a.last())
			ans = a.lower(a.last());
		System.out.println(a.last() + " " + ans);
	}
}

Measured memory_bytes: 66148
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>

using namespace std;

int ans;
vector<int> ANS;

void func(vector<int> s,int N){
	vector<int> copy;
	for(int i = 0; i < s.size(); i++){
		copy.push_back(0);
	}
	for(int i = 0; i < s.size(); i++){
		for(int j = 0; j < s.size(); j++){
			if(s[i] == s[j]){
				copy[i]++;
			}
		}
	}
	if(copy==s){
		ans = N;
		ANS = copy;
		return;
	}
	func(copy,N+1);
}
				


int main(){
	int n;
	
	while(scanf("%d", &n) && n){
		vector<int> S;
		int temp;
		
		for(int i = 0 ; i < n ;i++){
			scanf("%d", &temp);
			S.push_back(temp);
		}
		func(S,0);
		printf("%d\n",ans);
		for(int i = 0; i < S.size(); i++){
			printf("%d",ANS[i]);
			if(i != S.size()-1)printf(" ");
		}puts("");
		
	}
	return 0;
}

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

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

  int L[N];
  for(int i = 0; i < N; i++){
    cin >> L[i];
  }

  int maxSide = 0;
  int sumSide = 0;
  for(int i = 0; i < N; i++){
    if(maxSide < L[i]) maxSide = L[i];
  }
  
  for(int i = 0; i < N; i++){
    sumSide += L[i];
  }

  if(maxSide < sumSide - maxSide){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main() {
    int n, j, cnt=0;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    vector<bool> dp(1000007, true);
    vector<bool> np(1000007, false);
    rep(i,n){
        j=2;
        if(dp[a[i]]){
            while(1){
                if(a[i]*j>1000001) break;
                dp[a[i]*j]=false;
                ++j;
            }
            if(np[a[i]]) dp[a[i]]=false;
            np[a[i]]=true;
        }
    }
    rep(i,n){
        if(dp[a[i]]) ++cnt;
    }
    cout << cnt << "\n";
    return 0;
}

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

typedef long long ll;
const ll M = 1000000007;
const ll max_n = 1000001010;//n<=2*10~5より

ll pow_mod(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  ll x=1,y=1,z=1,w=1;
  for(ll i=0;i<a;i++){
    x *= (n-i);
    x %= M;
  }
  for(ll i=1;i<=a;i++){
    y *= i;
    y %= M;
  }
  for(ll i=0;i<b;i++){
    z *= n-i;
    z %= M;
  }
  for(ll i=1;i<=b;i++){
    w *= i;
    w %= M;
  }
  x = x * pow_mod(y,M-2) % M;
  z = z * pow_mod(w,M-2) % M;
  long long ans=1;
  while(n>0){
    if(n>=15){
      ans = ans * 32768;
      ans = ans % M;
      n -= 15;
    }else if(n>=10){
      ans = ans * 1024;
      ans = ans % M;
      n -= 10;
    }else{
      ans = ans * 2;
      ans = ans % M;
      n -= 1;
    }
    //cout << ans << endl;
  }
  ans -= x+z+1;
  ans %= M;
  if(ans < 0) cout << M + ans << endl;
  else cout << ans << endl;
}


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

int main(){
  int a,b;
  string s;
  cin >> a >> b >> s;
  if(s[a] == '-'){
    for(int i = 0; i < s.size(); i++){
      if(i != a){
      if(!(s[i] >= 48 && s[i] <= 57)){
        cout << "No" << endl;
        return 0;
      }
    }
    }
    cout << "Yes" << endl;
    return 0;
  }else{
    cout << "No" << endl;
    return 0;
  }
}

Measured memory_bytes: 3608
import copy

N,M = map(int, input().split())
T = [[] for _ in range(N+1)]
for _ in range(M):
    a,b = map(int, input().split())
    T[a].append(b)
    T[b].append(a)

def search(s, V):
    ans = 0
    if s in V:
        return 0
    Vc = copy.copy(V)
    Vc.add(s)
    if Vc == set(list(range(1, N+1))):
        return 1
    for v in T[s]:
        ans += search(v, Vc)
    return ans

print(search(1, set()))

Measured memory_bytes: 3444
W, H, x, y = map(int,input().split())
buf_x = W-x
buf_y = H-y
if buf_x >= x:
  ver_area = H*x
else:
  ver_area = H*buf_x
if buf_y >= y:
  hori_area = W*y
else:
  hori_area = W*buf_y

if x*2 == W and y*2 ==H:
  print(float(W*H/2),1)
else:
  print(float(W*H/2),0)

Measured memory_bytes: 3060
h, w = map(int, input().split())
S = [[] for _ in range(h)]
for i in range(h):
    S[i] = list(input())

ans = 0
L = [[0]*w for _ in range(h)]
for hi in range(h):
    cnt = 1
    for wi in range(w):
        if S[hi][wi]=='#':
            L[hi][wi] = 0
            cnt = 1
        else:
            L[hi][wi] = cnt
            cnt += 1

R = [[0]*w for _ in range(h)]
for hi in range(h):
    cnt = 1
    for wi in range(w):
        if S[hi][w-wi-1]=='#':
            R[hi][w-wi-1] = 0
            cnt = 1
        else:
            R[hi][w-wi-1] = cnt
            cnt += 1

D = [[0]*w for _ in range(h)]
for wi in range(w):
    cnt = 1
    for hi in range(h):
        if S[hi][wi]=='#':
            D[hi][wi] = 0
            cnt = 1
        else:
            D[hi][wi] = cnt
            cnt += 1

U = [[0]*w for _ in range(h)]
for wi in range(w):
    cnt = 1
    for hi in range(h):
        if S[h-hi-1][wi] == '#':
            U[h-hi-1][wi] = 0
            cnt = 1
        else:
            U[h-hi-1][wi] = cnt
            cnt += 1

ans = 0
for hi in range(h):
    for wi in range(w):
        ans = max(ans, L[hi][wi]+R[hi][wi]+D[hi][wi]+U[hi][wi]-3)
print(ans)

Measured memory_bytes: 359544
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <map>
#include <time.h>

using namespace std;

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int k, a, b;
  cin >> k >> a >> b;
  if(k < a || a >= b - 1) {
    cout << k + 1 << endl;
    return 0;
  }
  int bs = a;
  k -= (a - 1);
  if(k % 2) bs++;
  bs += (k / 2) * (b - a);
  cout << bs << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) {a = b; return true;}
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if(a > b) {a = b; return true;}
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if(i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T,U> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp.first << ":" << tp.second;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}


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

    const int MAX = 24;

    for (;;) {
        int N; cin >> N;
        if (N == 0) break;
        vector<vector<ll>> sum(MAX);
        FOR(i, 1, MAX+1) {
            sum[i-1].resize(i);
        }
        REP(i, N) {
            int d, t; cin >> d >> t;
            REP(j, d) {
                ll q; cin >> q;
                sum[d-1][(j + d - t) % d] += q;
            }
        }
        // REP(d, MAX) DEBUG(sum[d]);

        int LCM = 1;
        FOR(i, 1, MAX) {
            if (i == 13 or i == 17 or i == 19 or i == 23) continue;
            LCM = LCM / __gcd(LCM, i) * i;
        }

        ll ans = 0;

        REP(k, LCM) {
            ll s = 0;
            FOR(i, 1, MAX+1) {
                if (i == 13 or i == 17 or i == 19 or i == 23) continue;
                s += sum[i-1][k % i];
            }
            chmax(ans, s);
        }

        for (int i : {13, 17, 19, 23}) {
            ans += *max_element(ALL(sum[i-1]));
        }

        // DEBUG(ans);
        cout << ans << endl;

    }

}



Measured memory_bytes: 3104
n = input()

if bin(n).count('1') == 1:
    print "No"
    exit(0)

print "Yes"

for i in xrange(1, 3):
    print i, i + 1
    print i+n, i+n+1

print 3, 1 + n

for i in xrange(4, n, 2):
    print i, i + 1
    print i + 1, 1
    print 1, i + n
    print i + n, i + 1 + n

if n % 2 == 0:
    print n, n - 1
    print (n ^ (n - 1) ^ 1) + n, n + n


Measured memory_bytes: 38044
#include <bits/stdc++.h>
using namespace std;
int main(){
  int K,N;
  cin>>N>>K;
  vector<int>p(N);
  for(int i=0;i<N;i++)cin>>p[i];
  sort(p.begin(),p.end());
  long s=0;
  for(int i=0;i<K;i++)s+=p[i];
  cout<<s<<endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> b(N);
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < N; i++) {
    if (b[i] > i + 1) {
      cout << "-1\n";
      return 0;
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = b.size() - 1; j >= 0; j--) {
      if (j + 1== b[j]) {
        v[N - i - 1] = j + 1;
        b.erase(b.begin() + j);
        break;
      }
    }
  }
  for (int i : v) {
    cout << i << "\n";
  }
  return 0;
}

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

using namespace std;

typedef long long LL;

int n;
map<int, int> mp;

int main() {
  scanf("%d", &n);
  for(int i = 0; i<n; ++i) {
    int x; scanf("%d", &x);
    ++mp[x];
  }
  int m0 = 0, m1 = 0;
  for(auto it = mp.rbegin(); it!=mp.rend(); ++it) {
    if(it->second > 3) {
      if(m0 == 0)
        m0 = m1 = it->first;
      else
        m1 = it->first;
      break;
    } else if(it->second > 1) {
      if(m0 == 0)
        m0 = it->first;
      else if(m1 == 0) {
        m1 = it->first;
        break;
      }
    }
  }
  printf("%lld\n", (LL)m0 * m1);
}


Measured memory_bytes: 4992
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {
	Rapid_pleaseAC_fast;

	int n;
	cin >> n;
	vint a(n);
	vcin(a, n);
	llint ans = 100000000000;
	rep(i, 101) {
		if (i == 0)continue;
		llint cnt = 0;
		rep(j, n) {
			cnt += (llint)(a[j] - i) * (a[j] - i);
		}
			ans = min(ans, cnt);
	}
	cout << ans << rt;

	please AC;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a[]={0,1,3,1,2,1,2,1,1,2,1,2,1};
    int x,y;
    scanf("%d%d",&x,&y);
    if(a[x]==a[y]) printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 128
n = int(input())
a = list(map(int,input().split()))
mi = 0
p = []
for i in range(n):
    if a[i] < 0:
        mi += 1
        a[i] = -a[i]
if mi % 2 == 0:
    print(sum(a))
elif mi % 2 == 1:
    print(sum(a)-2*min(a))

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

using namespace std;

string string_reverse(string s)
{   
    char temp;
    int len = s.length();
    for (int i=0; i <len/2; i++) {
        temp = s[i];
        s[i] = s[len-i-1];
        s[len-i-1] = temp;
    }
    return s;
}

int kaibun(string s)
{
    string r = string_reverse(s);
    if(s == r){ return 0; }
    else { return 1; }
}

string extract(string s, int start, int end){
    string r;
    for(int i=start; i<=end; i++){
        r += s[i];
    }
    return r;
}

int main()
{
    string s;
    cin >> s;
    if(kaibun(s)== 0){
        string mae = extract(s, 0, (s.length()-1)/2-1);
        string ushiro = extract(s, (s.length()+3)/2-1, s.length()-1);
        if(kaibun(mae)==0 && kaibun(ushiro)==0){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
        
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

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

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

	long long ans = 0;
	int ma = max( A, max( B, C ) );
	if( ma % 2 ) {
		if( A == ma ) ans = B * C;
		else if( B == ma ) ans = A * C;
		else if( C == ma ) ans = A * B;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
s = input()
d = {}
ans = float("inf")
for i, a in enumerate(s):
    if a not in d:
        d[a] = [i + 1]
    else:
        d[a].append(i + 1)
for k in d.keys():
    c = 0
    for i in range(1, len(d[k])):
        c = max(c, d[k][i] - d[k][i - 1] - 1)
    ans = min(ans, max(c, d[k][0] - 1, len(s) - d[k][-1]))
print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> par;
typedef vector<int> vct;
typedef vector<par> vp;
const int mod=1e9+7;
int low[100007],high[100007],n,k,u,v,a[100007];
vct HMS[100007];
int f=0;
void dfs(int start,int fa=-1)
{
	for(int i=0;i<HMS[start].size();i++)
	{
		int d=HMS[start][i];
		if(d==fa) continue;
		dfs(d,start);
		if(low[d]==-1||high[d]==mod) continue;
		low[start]=max(low[start],low[d]-1);
		high[start]=min(high[start],high[d]+1);
		if(low[start]>high[start]||(high[start]-low[start])%2!=0) f=1;
	}
}
void color(int start,int fa=-1)
{
	for(int i=0;i<HMS[start].size();i++)
	{
		int d=HMS[start][i];
		if(d==fa) continue;
		if(a[start]+1<=high[d]) a[d]=a[start]+1;
		else if(a[start]-1>=low[d]) a[d]=a[start]-1;
		else f=1;
		color(d,start);
	}
}
int main()
{
	cin>>n;
	memset(a,-1,sizeof a);
	memset(low,-1,sizeof low);
	for(int i=0;i<n-1;i++)
	{
		high[i+1]=mod;
		cin>>u>>v;
		HMS[u].pb(v);
		HMS[v].pb(u);
	}
	high[n]=mod;
	cin>>k;
	for(int i=0;i<k;i++)
	{
		cin>>u>>v;
		a[u]=v;
		low[u]=v;
		high[u]=v;
	}
	dfs(1);
	a[1]=low[1];
	color(1);
//	cout<<low[1]<<" "<<high[1]<<endl;
	if(f) return cout<<"No",0;
	cout<<"Yes"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<endl;
}

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

using namespace std;

const int N = 2e5+10; 
int c[N];
vector<int> g[N];

int down(int u, int p, int lim) {
    int sum = 0;
    for (int v: g[u])if(v!=p){
        if (v < lim) sum += 1 + down(v, u, lim);
    }
    return sum;
}

void dfs(int u, int p, int mp, int mg) {
    c[u] = c[p];
    if (u > mg) {
        c[u] += 1 + down(u, p, mp);
    } else if (mp > mg) {
        c[u] += down(u, p, mp) - down(u, p, mg);
    }
    for (int v: g[u])if(v!=p){
        dfs(v, u, max(mp, u), max(mg, p));
    }
}

void solve() {
    int n; cin >> n;
    for (int _ = 1; _ < n; _++) {
        int x,y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    dfs(1, 0, 1, 1);
    for (int i = 2; i <= n; i++) {
        cout << c[i] << ' ';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 25856
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;


int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int ans = 0;
    if (d <= a) {
        cout << d << endl;

    }
    else if (d <= a + b) {
        cout << a << endl;
    }
    else {
        cout << a - (d - a - b) << endl;
    }
   
    return 0;

}

Measured memory_bytes: 3532
#include<stdio.h>
 
int main(){
	int i,ans=0;
	char ss[5];
	scanf("%s",ss);
	for(i=0;i<4;i++){
		if(ss[i]=='+'){
			ans++;
        }else{
			ans--;
        }
	}
	printf("%d\n",ans);
}

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

  ll tot=0;
  rep(i,n){
    std::cin >> v[i];
    tot+=v[i];
  }

  ll ntot=0;
  rep(i,n){
    if(ntot+v[i]<=tot/2)ntot+=v[i];
    else {
      // std::cout << "ntot"<<ntot << '\n';

      ll ans=tot-2*ntot;
      if(ans<0)ans*=-1;
      // std::cout << "ans:" <<ans<<'\n';

      if(i+1<n)ntot+=v[i];
      // std::cout << "ntot" <<ntot<<'\n';
      ll ans2=2*ntot-tot;
      if(ans2<0)ans2*=-1;

      // std::cout << "ans2:" << ans2<< '\n';

      if(ans>ans2)ans=ans2;

      std::cout << ans << '\n';




      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void){

  int N;    cin >> N;
  V A(N);   
  bool zeroFlag = false;  //0があるか?
  int minusCount = 0; //マイナスの数の個数
  int absMinNum = 1000000001;  //絶対値が一番小さい数

  for(int i = 0 ; i < N ; i++){
    cin >> A[i];
    if(A[i] == 0)
      zeroFlag = true;
    else if(A[i] < 0)
      minusCount += 1;

    A[i] = abs(A[i]);
    if(A[i] < absMinNum)
      absMinNum = A[i];

  }

  long long ans = 0;
  for(int i = 0 ; i < N ; i++)
      ans += A[i];

  //0なしかつマイナスの個数が奇数
  if(zeroFlag == false && minusCount % 2 == 1)
    ans -= absMinNum * 2;

    SCOUT(ans);

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; 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 rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//---------------------------------------------------------------
#define fastio std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
//--------------------------------------------------------------

int main(int argc,char** argv){ fastio; myio;
  string s; ll k;
  cin>>s>>k;
  int ts=0;
  while(s[ts]=='1' and ts<s.length()){
    if(ts+1==k){cout<<s[ts]; return 0;}
    ts++;
  }
  cout<<s[ts]<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<math.h>

using namespace std;
typedef long long ll ;
int main(){
  ll n[3];
  cin >> n[0] >> n[1]>>n[2];
  sort(n,n+3);
  string ans;
  if(n[0]==5 &&n[1]==5 && n[2]==7){
    ans ="YES";
  }else{
    ans="NO";
  }
  /*
  vector<int> tmp(n);
  for(int i=0;i<n;i++){
    cin >> tmp[i];
  }
  */
  cout << ans <<endl;
}

Measured memory_bytes: 256