akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <time.h>
using namespace std;

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << endl
#define ANS(a,b) int a;cin >> a;cout << b << endl
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK" << endl

const double PI = M_PI;
const long long INF = int(10e9-1);
const long long MOD = int(10e9+7);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t start = clock();
        solve();
        clock_t end = clock();
        const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
        cout << endl << time << "[ms]" << endl;
    }
    else{
        solve();
    }
}

void solve(){
    int N, H, W;
    cin >> N >> H >> W;
    PRINT((N-H+1)*(N-W+1));
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

import static java.util.Arrays.binarySearch;
import static java.util.Arrays.copyOfRange;
import static java.util.Arrays.sort;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 998244353;

    long[] fac, inv;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        fac = new long[n + 1];
        inv = new long[n + 1];
        fac[0] = inv[0] = 1;
        for (int i = 1; i <= n; i++) {
            fac[i] = fac[i - 1] * i % mod;
            inv[i] = powMod(fac[i], mod - 2);
        }
        long ans = 0;
        for (int i = n - 1 - k; i <= n - 1; i++) {
            ans = (ans + getC(n - 1, i) * m % mod * powMod(m - 1, i) % mod) % mod;
            //out.println(ans);
        }
        out.println(ans);
    }

    private long getC(int n, int m) {
        return fac[n] * inv[m] % mod * inv[n - m] % mod;
    }

    private long powMod(long a, int b) {
        long ans = 1, d = a;
        while (b > 0) {
            if (b % 2 == 1) {
                ans = ans * d % mod;
            }
            d = d * d % mod;
            b >>= 1;
        }
        return ans;
    }

}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}


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

using namespace std;

int N,A,B,C;
vector<int> ln;
const int INF=1000000000;

int dfs(int cur, int a, int b, int c) {
    if (cur == N) {
        // -30は最初の1本目は合体コストがかからないので、合体コスト10*3本分=30を引く
        if (min({a,b,c}) > 0) return abs(a-A) + abs(b-B) + abs(c-C) - 30;
        else return INF;
    }

    int ret0 = dfs(cur+1, a, b, c);
    // 10は合体コスト
    int ret1 = dfs(cur+1, a+ln[cur], b, c) + 10;
    int ret2 = dfs(cur+1, a, b+ln[cur], c) + 10;
    int ret3 = dfs(cur+1, a, b, c+ln[cur]) + 10;
    return min({ret0, ret1, ret2, ret3});
}

int main() {
    cin>>N>>A>>B>>C;
    for (int i=0;i<N;i++) {
        int l; cin>>l;
        ln.push_back(l);
    }

    cout << dfs(0, 0, 0, 0) << endl;

 }

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> p(n);
  for (int i = 0;i < n;i++){
    cin >> p.at(i);
  }
  
  int q = 0;
  for (int i = 0;i < k;i++){
    q += p.at(i);
  }
  
  int x = n - k + 1;
  vector<long> s(x,q);

  for (int i = 1;i < x;i++){
    s.at(i) = s.at(i-1) - p.at(i-1) + p.at(i-1+k);
  }
  
  int a = 0;
  for (int i = 1;i < x;i++){
    if (s.at(a) < s.at(i)){
      a = i;
    }
  }
  
  double ans = (double)(s.at(a) + k) / 2;
  
  cout << fixed << setprecision(2);
  
  cout << ans << endl;
}

Measured memory_bytes: 5604
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 200005
int a[M],id[M];
int main(){
	int n;
	scanf("%d",&n);
	int l=1,r=n,res=n;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++){
		if(i&1)id[l++]=res--;
		else id[r--]=res--;
	}
	for(int i=1;i<=n;i++)printf("%d ",a[id[i]]);
	puts("");
	return 0;
}

Measured memory_bytes: 3840
import java.io.*;
import java.util.*;

public class Main {

    class Reader {
        BufferedReader in;

        Reader() {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        StringTokenizer tok = new StringTokenizer("");

        String next() throws IOException {
            if (!tok.hasMoreTokens()) {
                tok = new StringTokenizer(in.readLine());
            }
            return tok.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(in.readLine());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }

    class Writer {
        PrintWriter out;

        Writer() {
            out = new PrintWriter(System.out);
        }

        StringBuilder str = new StringBuilder();

        void print(Object o) {
            str.append(o);
        }

        void close() {
            out.write(str.toString());
            out.close();
        }
    }

    int n;

    ArrayList<Integer> g[];


    boolean must = true;

    int bfs(int v0) {
        int d[] = new int[n];
        d[v0] = 1;
        HashSet<Integer> q = new HashSet<>();
        q.add(v0);
        int l = 0;
        while (q.size() > 0) {
            l++;
            HashSet<Integer> q1 = new HashSet<>();
            for (int v : q) {
                for (int u : g[v]) {
                    if (d[u] == 0) {
                        d[u] = l + 1;
                        q1.add(u);
                    } else {
                        if (d[u] == d[v]) {
                            must = false;
                        }
                    }
                }
            }
            q = q1;
        }
        return l;
    }

    void slave() throws IOException {
        Reader in = new Reader();
        Writer out = new Writer();
        n = in.nextInt();
        g = new ArrayList[n];
        for (int i = 0; i < n; i++) {
            g[i] = new ArrayList<>();
        }
        for (int i = 0; i < n; i++) {
            String s = in.next();
            for (int j = 0; j < n; j++) {
                if (s.charAt(j) == '1') {
                    g[i].add(j);
                }
            }
        }
        int mx = -1;
        for (int v = 0; v < n; v++) {
            must = true;
            int len = bfs(v);
            if (must) {
                mx = Math.max(len, mx);
            }
        }
        out.print(mx);
        out.close();
    }

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

Measured memory_bytes: 29908
n=int(input())
a=[0]*n
a=list(map(int,input().split()))
ans=sum(a)
dic={}
for i in range(n):
    dic.setdefault(a[i],0)
    dic[a[i]]+=1
q=int(input())
b=0
c=0
for i in range(q):
    b,c=map(int,input().split())
    if (b in dic):
        change=(c*dic[b]-b*dic[b])
        ans+=change
        print(ans)
        dic.setdefault(c,0)
        dic[c]+=dic[b]
        dic[b]=0
    else:
      	print(ans)	

Measured memory_bytes: 94516
N = int(input())
six = []
i = 6
while i <= 100000:
    six.append(i)
    i *= 6
six.reverse()
nine = []
i = 9
while i <= 100000:
    nine.append(i)
    i *= 9
nine.reverse()
ansmin = 100000
for i in range(1+(N//6)):
    ans = 0
    money = N - 6 * i
    for j in nine:
        ans += money // j
        money = money % j
    ans += money
    money = 6 * i
    for j in six:
        ans += money // j
        money = money % j
    ansmin = min(ansmin, ans)
if ansmin == 100000:
    ansmin = N
print(ansmin)


Measured memory_bytes: 3064
#include <iostream>
#include<stdio.h>
using namespace std;

int main()
{
    string s;
    int counter=0;
cin>>s;
for(int i=0;i<s.size()/2;i++){
    if(s[i]!=s[s.size()-i-1]){
        counter++;
    }
}
printf("%d",counter);
    return 0;
}


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

using namespace std;

typedef long long ll;

ll vet[200005];

ll quantidades[200005];
ll check[200005];

int main ()
{
    int n; cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> vet[i], quantidades[vet[i]]++;

    long long total = 0;

    for (int i = 1; i <= n; i++)
    {
        int v = vet[i];

        if (check[v] == 1)
            continue;
        check[v] = 1;

        ll q = quantidades[v];
        if (q > 1)
            total += q * (q - 1)/2;
    }

    for (int k = 1; k <= n; k++)
    {
        long long vk = vet[k], total2 = total;
        ll q = quantidades[vk];
        if (q > 1)
        {
            total2 -= q * (q-1) / 2;
            if (q > 2)
                total2 += (q - 1) * (q - 2) / 2;
        }
        cout << total2 << endl;
    }

    return 0;
}


Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long long ll;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vrsort(v) sort((v).rbegin(), (v).rend())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 2000000009
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  ll n,i;cin>>n;
  pair<ll,ll> w[n];
  for(i=0;i<n;i++){cin>>w[i].second>>w[i].first;}
  //caricurate
  sort(w,w+n);
  ll t=0;
  for(i=0;i<n;i++){
    t+=w[i].second;
    if(t>w[i].first){cout<<"No"<<endl;return 0;}
  }
  //output
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int D = scan.nextInt();
		int T = scan.nextInt();
		int S = scan.nextInt();
		//演算
		String result = "No";

		if (D <= T * S) {
			result = "Yes";
		}

		//結果出力
		System.out.println(result);
	}
}


Measured memory_bytes: 35680
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d) puts("Left\n");
    if(a+b<c+d) puts("Right\n");
    if(a+b==c+d) puts("Balanced\n");
    }

    

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

int n;
char ch[100005];

int main()
{
	scanf("%s",ch+1);
	n = strlen(ch+1);
	if(n%2==1)
		return puts("No"), 0;
	for(int i=1;i<n;i+=2)
		if(!(ch[i]=='h' && ch[i+1]=='i'))
			return puts("No"), 0;
	puts("Yes");
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> v1(n);
  unordered_map<int,int> m1;
  for(int i=0;i<n-1;i++){
    int m;
    cin>>m;
    m1[m]++;
  }
  for(int i=1;i<=n;i++){
    v1[i-1]=m1[i];
  }
  for(int i=0;i<n;i++){
    cout<<v1[i]<<" ";
  }
}


Measured memory_bytes: 12252
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
ll n, m;
vector<ll> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>m;
    ll koubai=1;
    for (int i = 0; i < n; i++)
    {
        int temp;
        cin >> temp;
        a.push_back(temp);
    }
    for (int i = 0; i < n; i++)
    {
        koubai=lcm(koubai,a[i]);
        if(koubai>2*m){
            return cout<<0<<"\n",0;
        }
    }
    for (int i = 0; i < n; i++)
    {
        if((koubai/a[i])%2==0){
            return cout<<0<<"\n",0;
        }
    }
    ll temp=2*m/koubai;
    if(temp%2){
cout <<temp/2+1<< "\n";
    }
    else{
cout << temp/2 << "\n";
    }
}



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

using namespace std;

using int64 = long long;

int main()
{
  int N, Q;
  cin >> N >> Q;
  while(Q--) {
    int V, W;
    cin >> V >> W;
    if(N > 1) {
      while(V != W) {
        if(V < W) swap(V, W);
        V = (V + N - 2) / N;
      }
    }
    cout << min(V, W) << endl;
  }
}

Measured memory_bytes: 1280
"""
@author:  wangquaxiu
@time:  2020/3/7 19:47
"""

import numpy as np
n = int(input())
dp = np.zeros((n,3),dtype=np.int)
happy = []
for i in range(n):
    d = list(map(int,input().split()))
    happy.append(d)

for i in range(3):
    dp[0][i] = happy[0][i]

for i in range(1,n):
    dp[i][0] = max(dp[i-1][1],dp[i-1][2])+happy[i][0]
    dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + happy[i][1]
    dp[i][2] = max(dp[i - 1][1], dp[i - 1][0]) + happy[i][2]


print(max(dp[n-1]))

Measured memory_bytes: 42636
// Date: 2020-04-04

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define IO freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout)
#define FIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define D(x) cout << #x << " = " << x << endl;
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)x.size())
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int main() {
    LL n;
    cin >> n;
    int m = (int)sqrt(n);
    while(1LL*m*m <= n) m++;
    int m2 = (int)sqrt(n-1);
    LL ans = 1;
    rep(i, 1, m2) {
        if((n-1) % i == 0) {
            LL j = (n-1)/i;
            if(n % i != 0 && i >= m) ans++;
            if(n % j != 0 && j >= m) ans++;
        }
    }
    rep(i, 2, m-1) {
        LL tp = n;
        while(tp % i == 0 && tp >= i) tp /= i;
        if(tp >= i) {
            LL step = tp / i;
            tp -= step * i;
        }
        if(tp == 1) ans++;
    }
    cout << ans;

    return 0;
}

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

namespace _8_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            for(int i = 0; i < a.Length; i++)
            {
                string y = a.Substring(i,1);
                if (char.IsLetter(a, i))
                {
                    if (char.IsUpper(a, i))
                    {
                        Console.Write(y.ToLower());
                    }
                    else
                    {
                        Console.Write(y.ToUpper());
                    }
                }
                else { Console.Write(y); }
            }Console.WriteLine();
        }
    }
}

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

const int MAX_G = 2500;

struct Edge{
    int to;
    ll w;
};
using Graph=vector<vector<Edge>>;

const ll INF=1e15;
vector<ll> dijkstra(int s,Graph& g){
    int n =g.size();
    vector<ll> d(n,INF);
    using P = pair<ll,int>;
    priority_queue<P,vector<P>,greater<>> que;
    d[s] = 0;
    que.push({d[s],s});
    while(!que.empty()){
        auto tmp  =que.top(); que.pop();
        int v = tmp.second;
        if(d[v]<tmp.first) continue;
        for(auto &e:g[v]){
            ll c = d[v]+e.w;
            if(c<d[e.to]){
                d[e.to]= c;
                que.push({d[e.to],e.to});
            }
        }
    }
    return d;
}
int main(){
    int n,m;
    int s;
    cin>>n>>m>>s;
    auto vertex_of=[&](int v,int s){
        return (MAX_G+1)*v+s;
    };
    Graph g(n*(MAX_G+1));
    for(int lp=0;lp<m;lp++){
        int u,v;
        cin>>u>>v; u--,v--;
        int a,b;
        cin>>a>>b;
        for(int i=0;i<=MAX_G-a;i++){
            g[vertex_of(u,i+a)].push_back(Edge{vertex_of(v,i),b});
            g[vertex_of(v,i+a)].push_back(Edge{vertex_of(u,i),b});
        }
    }

    for(int i=0;i<n;i++){
        int c,d;
        cin>>c>>d;
        for(int j=0;j<=MAX_G;j++){
            int tmp = min(MAX_G,j+c);
            g[vertex_of(i,j)].push_back(Edge{vertex_of(i,tmp),d});
        }
    }

    auto d = dijkstra(vertex_of(0,min(s,MAX_G)),g);

    for(int i=1;i<n;i++){
        ll res = INF;
        for(int j=0;j<=MAX_G;j++){
            res = min(res,d[vertex_of(i,j)]);
        }
        cout<<res<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 23648
a, b = map(int, input().split())
cnt = abs(b-a)+1
if (a == 0) or (b==0) or ((a < 0) & (b > 0)):
    print("Zero")
elif a > 0:
    print("Positive")
elif cnt % 2 == 0:
    print("Positive")
else:
    print("Negative")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
const ll mod = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    cout << n * n * n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <array>
#include <iostream>

long long calc(long long h) {
  if (h <= 1)
    return 1;
  return 1 + 2 * calc(h / 2);
}

int main(int argc, char *argv[]) {
  long long h;
  std::cin >> h;
  std::cout << calc(h) << std::endl;
}


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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int N, H, W;
	cin >> N >> H >> W;
	vector<int> cnt(W * N + 1);
	for (int i = 0; i < N; i++) {
		int x;
		cin >> x;
		if (i & 1) x = -x;
		int l = x + i * W;
		cnt[l] += 1;
		cnt[l + W] -= 1;
	}
	int res = 0;
	for (int i = 0; i < W * N; i++) {
		cnt[i + 1] += cnt[i];
		if (cnt[i] == 0) ++res;
	}
	cout << res * H << endl;
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n;
    cin >> n;
    vll a(n);
    REP(i,n){
        cin >> a[i];
    }
    sort(ALL(a));
    reverse(ALL(a));
    if(n%2==0){
        ll ans = a[0];
        for(ll i=1;i<=n/2-1;i++){
            ans += 2*a[i];
        }
        cout << ans <<endl;
    }
    else{
        ll ans = a[0];
        for(ll i=1;i<=n/2-1;i++){
            ans += 2*a[i];
        }
        ans += a[n/2];
        cout << ans <<endl;
    }



    
    return 0;
}



Measured memory_bytes: 4752
def grouping(a, b)
  group_a = [1, 3, 5, 7, 8, 10, 12]
  group_b = [4, 6, 9, 11]
  if (group_a.include?(a) && group_a.include?(b)) || (group_b.include?(a) && group_b.include?(b)) || (a == 2 && b == 2)
    puts "Yes"
  else
    puts "No"
  end
end

a, b= gets.chomp.split(" ").map(&:to_i)
grouping(a, b)

Measured memory_bytes: 1788
x, y = map(int, input().split())
group1 = [1,3,5,7,8,10,12]
group2 = [4, 6, 9, 11]
if(x == 2 and y == 2):
    print('Yes')
elif(x in group2 and y in group2):
    print('Yes')
elif(x in group1 and y in group1):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
// C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
    int n,a;
    int ans[200005] = { 0 };

    cin >> n;
    for (int i = 0; i < n-1; i++) {
        cin >> a;
        ans[a-1]++;
    }

    for (int i = 0; i < n; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 4404
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int t = sc.nextInt();
		int[] a = new int[n];

		int ans = 0;
		for (int i = 0; i < n; i++)
			a[i] = sc.nextInt();
		
		int min=a[0];
		
		int profit = 0;
		for (int i = 1; i < n; i++) {
			if (min > a[i])
				min = a[i];
			if (profit < a[i] - min)
				profit =a[i] - min;
		}

		min = a[0];
		for (int i = 1; i < n; i++) {
			if (min > a[i])
				min = a[i];
			if (profit == a[i] - min)
				ans++;
		}

		System.out.println(ans);
	}

}


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

int main(){
    int n;
    cin >> n;
    long long sum = 0;
    for (int i=1; i<= n; ++i){
        if(i % 3 == 0 || i % 5 == 0) continue;
        sum += i;
    }
    cout << sum << endl;
    return 0;
}

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

int main() {
  std::string s;
  std::cin >> s;

  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 0) {
      std::cout << s[i];
    }
  }
  std::cout << std::endl;
  return 0;
}


Measured memory_bytes: 512
from sys import stdin

S = stdin.readline().rstrip()
inf = 10 ** 9 + 7

dp = [[0] * 4 for _ in range(len(S) + 1)]
dp[len(S)][3] = 1
for k in range(3):
    dp[len(S)][k] = 0

for k in range(len(S) - 1, -1, -1):
    if S[k] == '?':
        dp[k][3] = 3 * dp[k + 1][3]
    else:
        dp[k][3] = dp[k + 1][3]
    dp[k][3] %= inf

for i in range(len(S) - 1, -1, -1):
    for j in range(2, -1, -1):
        if S[i] == '?':
            dp[i][j] += 3 * dp[i + 1][j]
        else:
            dp[i][j] += dp[i + 1][j]
        s = 'ABC'
        if S[i] == '?' or S[i] == s[j]:
            dp[i][j] += dp[i + 1][j + 1]
        dp[i][j] %= inf

print(dp[0][0] % inf)

Measured memory_bytes: 54108
import math
N,K = map(int,input().split())
List = []
for i in range(1,N+1):
    if i>=K:
        List.append(0)
    else:
        tmp = i
        count = 0
        while(tmp<K):
            tmp = tmp*2
            count+=1
        List.append(count) 
        
ans = [0]*N
ans[0] = 0.5**List[0]/N
for i in range(1,N):
    if List[i-1]==List[i]:
        ans[i] = ans[i-1]
    else:
        ans[i] = (2**(List[i-1]-List[i]))*ans[i-1]#直前の答えに減った2の累乗だけ掛け算してあげる．
print(sum(ans))


Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const int MX = 100005;
int n, x, y, a, b[MX], c[16], ans, d[1<<16], k, t;
int main(){
	scanf("%d", &n);
	rep(i,n-1){
		scanf("%d%d%d", &x, &y, &a);
		b[x] ^= a;
		b[y] ^= a;
	}
	rep(i,n) c[b[i]]++;
	for(int i=1; i<1<<16; i++){
		k = 0;
		rep(j,16) if(i>>j&1) k ^= j;
		if(!k){
			d[i] = 1;
			for(int j=(i-1)&i; j; j=(j-1)&i) d[i] = max(d[i], d[j]+d[j^i]);
		}
	}
	for(int i=1; i<16; i++){
		ans += c[i] / 2;
		if(c[i]&1) t ^= 1<<i;
	}
	printf("%d\n", ans + __builtin_popcount(t) - d[t]);
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(2e3 + 5);
const int MAX_M = (int)(2e3 + 5);

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

int n, m;

int s[MAX_N], t[MAX_M];

ll dp[MAX_N][MAX_M];

ll acc[MAX_N][MAX_M];

ll ans;

/////////////////////////////////////////////////////////////
class ModuloOperator {
 public:
  ll modulo;

  ModuloOperator(ll modulo) {
    this->modulo = modulo;
  }

  ll add(ll a, ll b) {
    ll ret = a + b;
    ret %= modulo;
    return ret;
  }

  ll sub(ll a, ll b) {
    ll ret = a - b;
    if (ret < 0)
      ret += modulo;
    else
      ret %= modulo;
    return ret;
  }

  ll mul(ll a, ll b) {
    ll ret = a * b;
    ret %= modulo;
    return ret;
  }

  ll div(ll a, ll b) { return mul(a, pow(b, modulo - 2)); }

  ll pow(ll x, ll y) {
    ll res = 1LL;

    x %= modulo;

    while (y > 0) {
      if (y & 1) {
        res = mul(res, x);
      }

      y = y >> 1;
      x = mul(x, x);
    }

    return res;
  }
};
/////////////////////////////////////////////////////////////

ModuloOperator mo(MOD);

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &m);

  for (int i = 1; i <= n; ++i) {
    scanf("%d", &(s[i]));
  }

  for (int i = 1; i <= m; ++i) {
    scanf("%d", &(t[i]));
  }

  for (int i = 0; i <= n; ++i) acc[i][0] = 1LL;
  for (int i = 0; i <= m; ++i) acc[0][i] = 1LL;

  dp[0][0] = 1LL;

  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      dp[i][j] = (s[i] == t[j]) ? acc[i - 1][j - 1] : 0LL;
      acc[i][j] = mo.add(
          mo.sub(
              mo.add(
                  acc[i - 1][j],
                  acc[i][j - 1]),
              acc[i - 1][j - 1]),
          dp[i][j]);
    }
  }

  ans = acc[n][m];

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 62976
#include <iostream>

template <typename T>
void print_array(const T a[], int length)
{
    for (int i = 0; i < length; i++){
        if (i > 0)
            std::cout << " "; 
        std::cout << a[i];
    }
}

template <typename T>
void insertion_sort(T a[], int length)
{
    for (int i = 1; i < length; i++) {
        for (int j = i - 1; j >= 0; j--) {
            if (a[j + 1] < a[j]) {
                T temp = a[j + 1];
                a[j + 1] = a[j];
                a[j] = temp;
            } else {
                break;
            }
        }
        print_array(a, length);
            std::cout << std::endl;
    }
}

int main() {
//    int a[6] = {5,2,4,6,1,3};
    int n = 0;
    std::cin >> n;
    int a[100] = {0};
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    print_array(a, n);
    std::cout << std::endl;
    insertion_sort(a, n);
    return 0;
}


Measured memory_bytes: 3096
import sys
 
def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a
 
 
 
def lcm(a, b):
    return a * b // (gcd(a, b))
 
 
 
def main():
    A, B, C, D = map(int, input().split())
    Aone = A - 1
    CDlcm = lcm(C, D)
 
    Bc = B // C
    Bd = B // D
    Blcm = B // CDlcm
    Bdec = B - Bc - Bd + Blcm
 
#    print(Bc,Bd,Blcm)
 
    Ac = Aone // C
    Ad = Aone // D
    Alcm = Aone // CDlcm
    Adec = Aone - Ac - Ad + Alcm
 
#    print(Ac,Ad,Alcm)
 
    print(Bdec - Adec)
 
 
main()

Measured memory_bytes: 3064
import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int N  = keyboard.nextInt();
		int L  = keyboard.nextInt();
		
		int sum = 0;
		int z = 1000;
		
		for(int i = 1; i < N+1; i++){
			sum += L+i-1;
				if(Math.abs(z) > Math.abs(L+i-1)){
					z = L+i-1;
				}
		}

		System.out.println(sum-z);
		keyboard.close();	
	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define ii pair<int,int>
#define mod 1000000007
#define endl '\n'
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=((a%mod)*(a%mod))%mod;
		b>>=1;
	}
	return ans;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		double z=22/double(7);
		double r;
		cin>>r;
		z=44*r;
		z/=double(7);
		cout<<fixed<<setprecision(5)<<z;
	}
	return 0;
}

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

using Edge = pair<int, long long>;
int d[10000];

int main(){
  
  int N, X, Y;
  cin >> N >> X >> Y;

  for(int i=1; i<N; i++){
    for(int j=i+1; j<N+1; j++){
      int dd = min(j-i, abs(i-X)+1+abs(j-Y));
      d[dd]++;
    }
  }
  
  
  for(int i=1; i<N; i++) cout << d[i] << endl;

  return 0;
}

Measured memory_bytes: 3604
//#include <bits/stdc++.h>
#include <iostream>
#include <climits>
#include <algorithm>

using namespace std;

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

typedef long long int ll;


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

	int arr[101],n;
	cin >> n;
	rep(i , n)
		cin >> arr[i];

	cout << *max_element(arr , arr+n) - *min_element(arr,arr+n);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
typedef long long ll;
int n, k;
ll ans = 1;
int l_neg = -1, l_pos = -1, r_neg = -1, r_pos = -1;
const ll M = 1e9+7;
 
bool cmp(ll a, ll b)
{
	return abs(a) < abs(b);
}
 
int calc(vector<ll> a)
{
	ll temp = 1;
	for(int i = n - k; i < n; i++)
		temp = (temp * a[i]) % M;
	return temp;
}
 
bool v_cmp(vector<ll> a, vector<ll> b)
{
	double sum1 = 0, sum2 = 0;
	for(int i = n - k; i < n; i++){
		sum1 += log((double)abs(a[i]));
		sum2 += log((double)abs(b[i]));
	}
	return sum1 > sum2;
}

int cp, cm, cz;
int main() {
	cin >> n >> k;
	vector<ll> a(n, 0);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		cp += (a[i] > 0);
		cz += (a[i] == 0);
		cm += (a[i] < 0);
	}
	
	sort(a.begin(), a.end(), cmp);
/*	if (!cz) {
		if (k == cp + cm || (!cp && (k & 1))) {
			for (int i = 0; i < k; i++)
				ans = (ans * a[i]) % M;
			cout << (ans % M + M) % M << endl;
			return 0;
		}
	}*/
	for(int i = n - k; i < n; i++){
		ans = (ans * a[i]) % M;
		if(r_pos == -1 && a[i] > 0) r_pos = i;
		if(r_neg == -1 && a[i] < 0) r_neg = i;
	}
	for(int i = n - k - 1; i >= 0; i--){
		if(l_pos == -1 && a[i] > 0) l_pos = i;
		if(l_neg == -1 && a[i] < 0) l_neg = i;
	}
	
	if(ans < 0 && n > k){
		if(r_pos == -1){
			if(l_pos == -1){
				ans = 1;
				for(int i = 0; i < k; i++)
					ans = (ans * a[i]) % M;
			}
			else if (~r_neg) {
				swap(a[l_pos], a[r_neg]);
				ans = calc(a);
			}
		}
		else {
			if(l_neg == -1){
				swap(a[l_pos], a[r_neg]);
				ans = calc(a);
			}
			else if(l_pos == -1){
				swap(a[l_neg], a[r_pos]);
				ans = calc(a);
			}
			else {
				vector<ll> c1 = a;
				vector<ll> c2 = a;
				swap(c1[l_neg], c1[r_pos]);
				swap(c2[l_pos], c2[r_neg]);
//				ans = v_cmp(c1, c2) == true? calc(c1): calc(c2);
				ans = (abs(a[l_neg] * a[r_neg]) > abs(a[l_pos] * a[r_pos])) ? calc(c1): calc(c2);
			}
		}
	}
	cout << (ans % M + M) % M << endl;
	return 0;
}

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

using ll = long long;
using ld  = long double;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
// int lcm(int a, int b){return a / gcd(a, b) * b;}
#define b_e(a) a.begin(),a.end() //sort(b_e(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll)(n) ; i++ )
#define DREP(i,m,n) for(ll i=(ll)(m) ; i > (ll)(n) ; i-- )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define p_b push_back
#define SZ(x) ((ll)(x).size()) //size()がunsignedなのでエラー避けに
#define endk '\n'


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //


// --------- library end - //



int main(){

  ll a = il();
  cout << ( a == 0 ? 1 : 0 ) << endk;



}



Measured memory_bytes: 3684
#include <stdio.h>
int main () 
{
int n,y,i,j,k;
int a = -1,b = -1,c = -1;
scanf("%d %d",&n,&y);

for(i=0;i<=n;i++)
{
    for(j=0;j<=n-i;j++)
    {
        if(y == 10000*i + 5000*j + 1000*(n-i-j))
        {
            a = i;
            b = j;
            c = n-i-j;
            break;
        }
    }
}
 printf("%d %d %d",a,b,c);
return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
dp = [[0]*2 for _ in range(N)]
dp[0][1] = -10**18

for i in range(N-1):
    dp[i+1][0] = max(dp[i][0]+A[i], dp[i][1]-A[i])
    dp[i+1][1] = max(dp[i][0]-A[i], dp[i][1]+A[i])

print(max(dp[-1][0]+A[-1], dp[-1][1]-A[-1]))

Measured memory_bytes: 98820
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;


signed main(){
    llin(n);
    vll a(n);
    FOR(i,0,n-1){
        cin >>a[i];
    }
    SORT(a);
    ll k=0;
    FOR(i,1,a[0]){
        k=k^n;
    }
    FOR(i,1,n-1){
        FOR(j,1,a[i]-a[i-1]){
            k=k^(n-i);
        }
    }
    sal((k!=0)?"first":"second");
}


Measured memory_bytes: 1024
// In the name of GOD

#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;

void solve() {
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < (int)s.length(); ++i) {
    if (s[i] != t[i]) {
      cout << "No";
      return;
    }
  }
  cout << "Yes";
}

int main () {
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1 ;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    }
}

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

int a,b,x;

int main() {

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

  cin >> a >> b >> x;

  if (a <= x && x <= (a+b)) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int k;
	string s;
	cin >> k >> s;
	if (s.size() <= k)
	{
		cout << s;
		return 0;
	}
	else
	{
		for (int i = 0; i < k; i++)
			cout << s[i];
		cout << "...";
	}
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans;
    if(a&b&c&1){
        ans = min({a*b, b*c, c*a});
    }else ans = 0;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll MODPOW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = MODPOW(n, m / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (n * MODPOW(n, m - 1)) % MOD;
  }
}
ll MODDIV(ll a, ll b) { return a * MODPOW(b, MOD - 2) % MOD; }

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string K;
  ll D;
  cin >> K;
  cin >> D;
  ll N = K.size();
  ll ans = 0;
  ll now = 0;
  vvvl DP = VVVL(N + 1, 2, D, 0);
  DP[0][0][0] = 1;
  REP(i, N) {
    REP(j, 2) {
      ll x = j == 1 ? 9 : K[i] - '0';
      REP(d, x + 1) {
        REP(k, D) {
          DP[i + 1][j || (d < x)][(k + d) % D] += DP[i][j][k];
          DP[i + 1][j || (d < x)][(k + d) % D] %= MOD;
        }
      }
    }
  }

  cout << (DP[N][1][0] + DP[N][0][0] + MOD - 1) % MOD << endl;

  return 0;
}


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

int main(){
  int N,mod2;
  cin >> N >> mod2;
  
  int Nodd = 0;
  int Neven= 0;
  int buf;
  for(int i=0; i<N; i++){
    cin >> buf;
    if(buf%2==1){ Nodd++;  }
    else        { Neven++; }
  }

  int64_t ans= (Nodd==0) ? ((mod2==0) ? (1LL<<Neven)
                                      : 0)
                         : (1LL<<(Nodd-1))* (1LL<<Neven);

  cout << ans << endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long       ll;
#define pb                emplace_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define fore(i, b, e)	  for (int i = (int)b; i < (int)e; i++)
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef pair<ll, ll>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int INF = int(1e9 + 7);
const double EPS = 1e-9;
const double PI = acos(-1);

bool cmp(ii a, ii b)
{
	/*
	a/b > x/y
	a*y > x*b
	*/
	if ( a.F*b.S == b.F*a.S )
	{
		return a.F < b.F;
	}
	return a.F*b.S > b.F*a.S;
}

ll dp[10010][10010]; // remH, pos
    vii v(10010);

ll f(ll h, int pos)
{
    if (h <= 0) return 0;
    ll &res = dp[h][pos];
    if (res != -1) return res;
    res = f(h - v[pos].F, pos) + v[pos].S;
    if (pos) res = min( res, f(h, pos-1) );
    return res;
}

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    clr(dp, -1);
    ll h, n;
    cin >> h >> n;
    fore(i, 0, n)
    {
    	cin >> v[i].F >> v[i].S;
    }
    cout << f(h, n-1) << endl;
    /*
    sort( all(v), cmp );
    ll res = 0;
    while ( h-v[0].F > 0 )
    {
    	h -= v[0].F;
    	res += v[0].S;
    }
    ll bestPrice = v[0].S;
    fore(i, 0, n)
    {
    	if (h <= v[i].F) bestPrice = min(bestPrice, v[i].S);
    }
    cout << res + bestPrice << '\n';
    */
    return 0;
}
// PLUS ULTRA!

Measured memory_bytes: 783744
n = int(input())
a =list(map(int,input().split()))

ans = "APPROVED"
for i in range(n):
  if a[i] % 2 == 0 :
    if a[i] % 3 != 0 and a[i] % 5 != 0 :
      ans = "DENIED"
print(ans)






Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
long long mod=1e9+7;

long long cal(long long n,long long i){
  long long ans=0;
  while(n>0){
    if(n<i){
      ans+=n;
      break;
    }
    ans+=n%i;
    n/=i;
  }
  return ans;
}

int main(){
  long long n,s;
  cin>>n>>s;
  if(n==s){
    cout<<n+1<<endl;
    return 0;
  }
  /*
  if(s==1){
    cout<<n<<endl;
    return 0;
  }
  */

  for(long long i=2;i*i<=n;i++){
    if(cal(n,i)==s){
      cout<<i<<endl;
      return 0;
    }
  }

  long long ans=1e18;
  for(long long i=1;i*i<=n;i++){
    if(n-s>=0&&(n-s)%i==0){
      long long b=((n-s)/i)+1;
      if(cal(n,b)==s){
        ans=min(ans,b);
      }
    }
  }
  if(ans!=1e18)cout<<ans<<endl;
  else cout<<-1<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  vector<ll> prime;
  for(ll i=1;i*i<=N;++i) {
    if(N%i==0) {
      prime.push_back(i);
      if(i!=N/i) prime.push_back(N/i);
    }
  }
  ll tmp = N-1;
  vector<ll> prime1;
  for(ll i=1;i*i<=tmp;++i) {
    if(tmp%i==0) {
      prime1.push_back(i);
      if(i!=tmp/i) prime1.push_back(tmp/i);
    }
  }
  int ans = prime1.size() - 1;
  for(int i=0;i<prime.size();++i) {
    if(prime[i]==1) continue;
    tmp = N;
    while(tmp%prime[i]==0) tmp /= prime[i];
    if(tmp%prime[i]==1) ans++;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3560
a = [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]
k = int(input())
print(a[k - 1])


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

void solve(long long A, long long B, long long T)
{
    cout << (T / A) * B << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long T;
    scanf("%lld", &T);
    solve(A, B, T);
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("trapv")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace __gnu_pbds;
//using namespace __gnu_cxx;
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const int maxn = 3e5 + 33, mlg = 18, mod = 1e9 + 7;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a+b+c>=22?"bust":"win");
}


Measured memory_bytes: 256