akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 18
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353



n, k = LI()
if k == 1:
    print(0)
else:
    print(n - k)

Measured memory_bytes: 39024
#include <stdio.h>

int main(){
  int a,b;
  scanf("%d%d",&a,&b);
  
  int numA=0,numB=0;
  
  for(int i=0; i<b; i++){
    numA += power(10,i) * a;
  }
  
  for(int j=0; j<a; j++){
    numB += power(10,j) * b;
  }
  
  if(numA < numB){
    printf("%d",numB);
  }else{
    printf("%d",numA);
  }
}

int power(int K, int i){
  int sum = 1;
  if(i == 0){
    return 1;
  }else{
    for(int j=1; j<=i; j++){
      sum *= K;
    }
  }
  return sum;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,s;
ll a[3003],dp[6003];
const ll mod=998244353;
int main(void)
{
	scanf("%lld%lld",&n,&s);
	for(ll i=0;i<n;i++) scanf("%lld",&a[i]);
	dp[0]=1;
	for(ll i=0;i<n;i++)
	{
		for(ll j=s;j>=0;j--)
		{
			dp[j+a[i]]+=dp[j];
			dp[j+a[i]]%=mod;
			dp[j]*=2;
			dp[j]%=mod;
		}
	}
	printf("%lld",dp[s]);
}

Measured memory_bytes: 3848
object Main extends App {
    for (Array(a, b, n) <- io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))) {
        var rem = a
        var res = 0
        (0 until n).foreach(_ => {
            rem = rem % b * 10
            res += rem / b
        })
        println(res)
    }
}

Measured memory_bytes: 43820
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

map<int, pair<int, int>> mp;
int H, W, D;
int ans[90010];

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

    rep(i, H) rep(j, W) {
        int a;
        cin >> a;
        mp[a] = {i, j};
    }

    for(int i=1;i<=D;i++){
        ans[i] = 0;
        for(int j=i+D;j<=H*W;j+=D){
            ans[j] = ans[j-D] + abs(mp[j].first - mp[j-D].first) +
            abs(mp[j].second - mp[j-D].second);
        }
    }

    int Q;
    cin >> Q;
    rep(i, Q) {
        int l, r;
        cin >> l >> r;
        cout << ans[r]-ans[l] << endl;
    }
}

Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll md=1e9+7;
char s[100100];
ll dp[100100][13];
int l;
ll qp(ll a,ll b,ll mmd=13){
	ll ret=1;
	while(b){
		if(b&1) ret=ret*a%mmd;
		a=a*a%mmd;
		b>>=1;
	}
	return ret;
}
ll dfs(int pos,int res){
	if(pos==-1){
		if(res==5) return 1;
		else return 0;
	}
	if(dp[pos][res]!=-1) return dp[pos][res];
	ll ret=0;
	if(s[pos]!='?'){
		ret+=dfs(pos-1,(res+(s[pos]-'0')*qp(10,1ll*(l-1-pos)))%13);
		ret%=md;
	}
	else{
		for(int i=0;i<=9;i++){
			ret+=dfs(pos-1,(res+i*qp(10,1ll*(l-1-pos)))%13);
			ret%=md;
		}
	}
	if(dp[pos][res]==-1) dp[pos][res]=ret;
	return ret;
}
ll ans=0;
int main(){
	scanf("%s",s);
	l=strlen(s);
	memset(dp,-1,sizeof(dp));
	ans=dfs(l-1,0);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 18304
#include <iostream>
#include <string>
#include <vector>

using namespace std;

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A&lang=jp
// 挿入ソート
static void printArray(vector<int> vector) {
    int size = vector.size();
    for (int i = 0; i < size; ++i) {
        if (i == size - 1) {
            cout << vector[i] << endl;
        } else {
            cout << vector[i] << " ";
        }
    }
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);

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

    // 逆の隣接要素が存在する
    bool flag = true;
    int counter = 0;
    while (flag) {
        flag = false;
        for (int j = N - 1; j > 0; --j) {
            if(A[j] < A[j-1]) {
                swap(A[j], A[j - 1]);
                flag = true;
                ++counter;
            }
        }
    }

    printArray(A);
    cout << counter << endl;

    return 0;
}




Measured memory_bytes: 3164
#include <cstdio>
bool A[200001];inline int r(){int a=0,c=getchar_unlocked();while(c<48||c>57)c=getchar_unlocked();while(c>=48&&c<=57){a=a*10+(c-48);c=getchar_unlocked();}return a;}
main(){int n,m,a,b;n=r();m=r();while(m--){a=r();b=r();if(a==1){if(A[b])return puts("POSSIBLE"),0;A[b]=1;}if(b==n){if(A[a])return puts("POSSIBLE"),0;A[a]=1;}}puts("IMPOSSIBLE");}

Measured memory_bytes: 384
#include <iostream>

#define ll long long

using namespace std;

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

  if (k % 2 == 0) {
    cout << a - b << endl;
  } else {
    cout << b - a << endl;
  }
  return 0;
}

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

int main(){
    long long N;
    cin>>N;
    vector<long long> A(N+1,0);
    vector<long long> B(N,0);
    for(long long i=0;i<=N;i++){
        cin>>A[i];
    }
    for(long long i=0;i<N;i++){
        cin>>B[i];
    }
    long long count=0;
    for(long long i=0;i<N;i++){
       long long curr=B[i];
       if(B[i]<=A[i]){
           count+=B[i];
       }else{
           count+=A[i];
           curr=B[i]-A[i];
           if(curr<=A[i+1]){
               count+=curr;
               A[i+1]=A[i+1]-curr;
           }else{
               count+=A[i+1];
               A[i+1]=0;
               //A[i+1]=max(A[i+1]-(B[i]-A[i]),0);
           }
           
       }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b,c;
	cin>>a>>b>>c;
	ll var1=c-a-b;
	if(var1<=0)
	 cout<<"No";
	else{
		ll var2=4*a*b;
		if(var1*var1>var2)
		 cout<<"Yes";
		else
		 cout<<"No";
	}
	return 0;
}

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

#define f first
#define s second
#define ins insert
#define eb emplace_back
#define endl '\n'
#define ll long long
#define ld long double
#define vl vector<ll>
#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define tc ll t; cin >> t; while (t--)
#define sz(c) (ll) (c).size()
#define trav(x,c) for(auto &x : c)
#define all(c) (c).begin(), (c).end()
#define rll(c) (c).rbegin(), (c).rend()
#define _for(i,a,n) for(ll i = a ; i < n; ++i)
#define _rfor(i,a,n) for(ll i = n-1 ; i >= a; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c) trav(x,c) cout << x << " "; cout << endl;
#define godspeed ios::sync_with_stdio(0); cin.tie(0);

int main() {
    godspeed;
    ll n, m; cin >> n >> m;

    cout << n/m + ((n%m) ? 1 : 0);
}

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

#define REP(i,n) for(int i=0,_n=n;i<(int)_n;++i)
#define ALL(a) (a).begin(),(a).end()
#define eb emplace_back
#define pb emplace_back
#define mt make_tuple

template<class T>bool chmin(T&a,const T&b){if(a<=b)return false;a=b;return true;}
template<class T>bool chmax(T&a,const T&b){if(a>=b)return false;a=b;return true;}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cerr<<*i<<" ";cout<<endl;}
typedef long long ll;
typedef vector<int> Vi;

int main(){
  ll a, b; cin >> a >> b;
  if (a * b <= 0) {
    cout << "Zero" << endl;
  } else if (a > 0 && b > 0) {
    cout << "Positive" << endl;
  } else {
    ll n = b - a + 1;
    if (n % 2 == 1)
      cout << "Negative" << endl;
    else
      cout << "Positive" << endl;
  }

}


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

int main() {
    vector<int> a(6);
    rep(i,6) {
        cin>>a[i];
    }
    string ans="Yay!";
    rep(i,5) {
        for (int j=i+1; j<5; j++) {
            if (a[j]-a[i]>a[5]) {
                cout<<":("<<endl;
                return 0;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args)
	{
		Scanner sc =new Scanner(System.in);
		int x=sc.nextInt();
		int t=sc.nextInt();
		
		if(x-t>=0) System.out.println(x-t);
		else System.out.println("0");
	}
} 

Measured memory_bytes: 22228
#include <cstdio>
using namespace std;
int n,m;
char a[100][100];
int main(){
	scanf("%d%d\n",&n,&m);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++)
			a[i][j]=getchar();
		scanf("\n");
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j]=='#'){
			if((i==1 || a[i-1][j]=='.') && (i==n ||a[i+1][j]=='.') && (j==1||a[i][j-1]=='.') && (j==m || a[i][j+1]=='.')){
				puts("No");
				return 0;
			}
		}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

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

    	int a = sc.nextInt(),
    		b = sc.nextInt(),
    		c = sc.nextInt();
    	
    	if((a + b) == c || (b + c) == a || (c + a) == b)	System.out.println("Yes");
    	else												System.out.println("No");
    }
}

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

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> a(N);
    for(int i = 0; i < N; i++)
    {
        std::cin >> a[i];
    }

    int ans = 0;
    for(int usa = 0; usa < N; usa++)
    {
        int aiteUsa = a[usa];

        if(a[aiteUsa - 1] <= -1) continue;

        if(a[aiteUsa - 1] == usa + 1)
        {
            ans++;
            a[aiteUsa - 1] = -1;   // 逆向きのペアをかぞえないため 
        }
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    string s; cin >> s;

    rep(i,s.size()){
        if(i%2==0){
            if(s[i]=='L'){
                cout << "No" << ln;
                return 0;
            }
        }
        else{
            if(s[i]=='R'){
                cout << "No" << ln;
                return 0;
            }
        }
    }

    cout << "Yes" << ln;
    return 0;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int n;
    cin>>n;
    int a = 0, b = 0, c = 0, d = 0;
    for(int i = 0; i < n; i++){
        string s;
        cin>>s;
        if(s=="AC")a++;
        if(s=="WA")b++;
        if(s=="TLE")c++;
        if(s=="RE")d++;
    }   
    cout<<"AC x "<<a<<"\n";
    cout<<"WA x "<<b<<"\n";
    cout<<"TLE x "<<c<<"\n";
    cout<<"RE x "<<d;
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 3616
n,m=map(int,input().split())
if n>=m:
    print(0)
#elif n
else:
    x=list(map(int,input().split()))
    x.sort()
    y=[]
    for i in range(m-1):
        y.append(x[i+1]-x[i])
    y.sort(reverse=True)
    ans=x[-1]-x[0]
    for i in range(n-1):
        ans-=y[i]
    print(ans)

Measured memory_bytes: 13960
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

int main()
{
    string s;
    cin >> s;
    rep(i, s.size())
    {
        if (s[i] == '?')
        {
            s[i] = 'D';
        }
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x,long long int y) 
{ 
    long long int res = 1;     // Initialize result 
  // x=x;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x); 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x);  // Change x to x^2 
    } 
    return res; 
}
long long int power(long long int x,long long int y,long long int m) 
{ 
    long long int res = 1;     // Initialize result 
   x=x%m;
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x)%m; 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x)%m;  // Change x to x^2 
    } 
    return res; 
}

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 } 
 long long int lcm(long long int a, long long int b)  
 { 
     long long int temp;
    
    return (a*b)/gcd(a, b);  
 }
 
int main() {
    
        
        long long int n,m,o=0,l,d=1,i,j,p=0,k,f;
       double pie=3.141592653589793238;
    long long int MOD=1000000007;
    cin>>n;
    long long int a[n];
    vector<string>v;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=1;i<n;i++)
    {
        if(a[i]<=a[i-1])
        {
            o++;
        }
        else
        {
            if(p<o)
            p=o;
            o=0;
        }
    }
    if(p<o)
    p=o;
    cout<<p;
 return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstdio>
#include <tuple>
using namespace std;
typedef long long ll;
typedef tuple<int, int, pair<int, int> > tup;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
int w, h;
int s[32][32];
int c[6];
//dist[t][y][x] :=????????¨?????§?¨????(x, y)??§??\????????????t????????????????????????
int dist[6][32][32];

void dijkstra(void){
    rep(i, 6)rep(j, 32)rep(k, 32){
    	dist[i][j][k] = INF;
    }

    priority_queue<tup, vector<tup>, greater<tup> >  q;//????????????????????????????????\?????? ?????¨?????§?¨?
    dist[1][0][0] = 0;
    q.push(make_tuple(0, 1, make_pair(0, 0)));

    if(s[0][0] == 0){
        q.push(make_tuple(0, 1, make_pair(0, 1)));
        dist[1][0][1] = 0;
    }else if(s[0][0] == 1){
        q.push(make_tuple(0, 2, make_pair(1, 0)));
        dist[2][1][0] = 0;
    }else if(s[0][0] == 2 || s[0][0] == 3 || s[0][0] == 4){
        q.push(make_tuple(c[0], 1, make_pair(0, 1)));
        dist[1][0][1] = c[0];
        q.push(make_tuple(c[1], 2, make_pair(1, 0)));
        dist[2][1][0] = c[1];
    }

    while(!q.empty()){
        int cost, v;
        pair<int, int> p;
        tie(cost, v, p) = q.top(); q.pop();
        int y = p.first, x = p.second;
        if(dist[v][y][x] < cost) continue;

        for (int i = 0; i < 4; ++i){//??´??????????????¢?????????????????????
            int nextv = (v + i) % 4;
                //?????????????????????????????????
            int ny = y + dy[nextv], nx = x + dx[nextv];
            if(!(0 <= ny && ny < h && 0 <= nx && nx < w)) continue;
            if(i == s[y][x]){//????????????
                if(cost < dist[nextv][ny][nx]){
                    dist[nextv][ny][nx] = cost;
                    q.push(make_tuple(dist[nextv][ny][nx], nextv, make_pair(ny, nx)));
                }
            }else{
                if(cost + c[i] < dist[nextv][ny][nx]){
                    dist[nextv][ny][nx] = cost + c[i];
                    q.push(make_tuple(dist[nextv][ny][nx], nextv, make_pair(ny, nx)));
                }
            }
        }
    }
}

int main(void){
	while(1){
		cin >> w >> h;
		if(w == 0 && h == 0) return 0;
        rep(i, h)rep(j, w) cin >> s[i][j];
        rep(i, 4){
            cin >> c[i];
        }

		dijkstra();

		int ans = INF;
		for (int i = 0; i < 4; ++i){
			ans = min(ans, dist[i][h - 1][w - 1]);
		}
        printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3268
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
TA=10**5+1
for i in range(n):
    if TA>abs(a-t+h[i]*0.006):
        ans=i+1
        TA=abs(a-t+h[i]*0.006)
 
print(ans)

Measured memory_bytes: 3060
#include<cstdio>  // 允许的移动方式只有往右和往下 审题不清楚... 
#include<cstring>
#include<iostream>

const int maxn=1e3+5;

const int mod=1e9+7;

char grid[maxn][maxn];

int d[maxn][maxn];

int dr[2]={-1,0};

int dc[2]={0,-1};

int dp(int,int);

int is_legal(int,int);

int h,w;

int main(){
	
	
	scanf("%d %d",&h,&w);

	for(int i=1;i<=h;i++){
	
		for(int j=1;j<=w;j++){
	
			std::cin>>grid[i][j];
		}
	}

	memset(d,-1,sizeof(d));

	d[1][1]=1;

	int ans=dp(h,w)%mod;

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

	return 0;
	
}

int dp(int r,int c){
	
	int &ans=d[r][c];

	if(ans!=-1) return ans;

	ans=0;
	
	for(int i=0;i<2;i++){
	
		int rr=r+dr[i]; int cc=c+dc[i];

		if(is_legal(rr,cc)){
				
			ans=(ans+dp(rr,cc))%mod;
		}
	}

	return ans;
}

int is_legal(int r,int c){
	
	if(r<=0 || r>h || c<=0 || c>w || grid[r][c]=='#') return 0;

	else return 1;
}

Measured memory_bytes: 5248
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<queue>
#include<map>
#include<cmath>
#include<set>
#include<stack>
#define ll long long
#define pb push_back
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)>(y)?(y):(x))
#define cls(name,x) memset(name,x,sizeof(name))
#define fs first
#define sc second
#define mp make_pair
#define L(x) (1<<x)
#define next Next
using namespace std;
const int inf=1e9+10;
const ll llinf=1e16+10;
const int maxn=1e5+10;
const int maxm=1e4+10;
const int mod=1e9+7;
vector<pair<int,int> > v[maxn];
int pos[maxn];
int vis[maxn];
int n,m;
int judge;
void dfs(int x,int val)
{
    //if(x==1) printf("%d %d\n",pos[x],val);
    vis[x]=1;
    if(pos[x]==inf)
        pos[x]=val;
    else if(pos[x]==val)
        return ;
    else if(pos[x]!=val)
    {
        judge=0;
        return;
    }
    for(int i=0;i<v[x].size();i++)
        dfs(v[x][i].fs,val+v[x][i].sc);
}
int main()
{
    //freopen("in.txt","r",stdin);
    //int T;
    //scanf("%d",&T);
    while(~scanf("%d %d",&n,&m))
    {
        judge=1;
        for(int i=1;i<=n;i++)
        {
            v[i].clear();
            pos[i]=inf;
            vis[i]=0;
        }
        while(m--)
        {
            int li,ri,di;
            scanf("%d %d %d",&li,&ri,&di);
            v[li].pb(mp(ri,di));
            v[ri].pb(mp(li,-di));
        }

        for(int i=1;i<=n;i++)
        {
            if(vis[i]==0)
            dfs(i,0);
        }
        //printf("%d %d %d\n",pos[1],pos[2],pos[3]);
        if(judge==0) printf("No\n");
        else printf("Yes\n");
    }
	return 0;
}


Measured memory_bytes: 12416
#include<stdio.h>
#include<math.h>
void koch(double, double, double, double, int);
main()
{
  int n;

  scanf("%d",&n);

  printf("%f %f\n", 0.0, 0.0);

  koch(0.0, 0.0, 100.0, 0.0, n);

  printf("%f %f\n",100.0, 0.0);

  return 0;
}

void koch(double p1x, double p1y, double p2x, double p2y, int c)
{
  double sx, sy, tx, ty, ux, uy;

  if(c != 0)
    {
      sx = (2 * p1x + p2x) / 3;
      sy = (2 * p1y + p2y) / 3;
      tx = (p1x + 2 * p2x) / 3;
      ty = (p1y + 2 * p2y) / 3;
      ux = sx + (tx - sx) * cos(M_PI/3) - (ty - sy) * sin(M_PI/3);
      uy = sy + (tx - sx) * sin(M_PI/3) + (ty - sy) * cos(M_PI/3);

      koch(p1x, p1y, sx, sy, c - 1);
      printf("%f %f\n", sx, sy);
      koch(sx, sy, ux, uy, c - 1);
      printf("%f %f\n", ux, uy); 
      koch(ux, uy, tx, ty, c - 1);
      printf("%f %f\n", tx,ty);
      koch(tx, ty, p2x, p2y, c - 1);
    }
}

Measured memory_bytes: 636
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include <stdio.h>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    int N, a[10000];
    
    scanf("%d", &N);
    for(int i=0; i<=N; i++)
        scanf("%d", &a[i]);
    printf("%d %d %lld\n", *min_element(a, a+N), *max_element(a, a+N), accumulate(a, a+N, (long long)0));
    return 0;
}

Measured memory_bytes: 2796
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    vector<pair<pll,ll> >v;

    struct Implicit_segment_tree {
        ll Sum;
        Implicit_segment_tree *left , *right;
        Implicit_segment_tree(ll _Sum , Implicit_segment_tree *_left , Implicit_segment_tree *_right ){
        Sum = _Sum;
        left = _left;
        right = _right;
        }
    };
     
    void update(Implicit_segment_tree *root , int l , int r , int s , int e , ll value ){
           if(s > r || l > e )
               return;
             if(l >= s && r <= e ){
                root->Sum = min(root->Sum,value);
                return;
             }
             if(root->left == NULL)
             root->left = new Implicit_segment_tree(1e12 , NULL , NULL);
             if(root->right == NULL)
             root->right = new Implicit_segment_tree(1e12 , NULL , NULL);
             update(root->left , l , (l + r)/2 , s , e , value );
             update(root->right , (l + r)/2 + 1 , r , s, e , value);
    }
     
    ll query(Implicit_segment_tree *root , int l , int r, int idx) {
         if( root == NULL ||  idx > r || l > idx )
          return 1e12;
          if( l  == r )
          return root->Sum;
        return min({root->Sum , query(root->left , l , ( l + r)/2 , idx) , query( root->right , (l + r)/2 + 1 , r, idx)});
    }
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            Implicit_segment_tree *root = new Implicit_segment_tree(1e12,NULL,NULL);
            ll n,q,i,j,a,b,c;
            cin>>n>>q;
            for(i=1;i<=n;++i)
            {
                cin>>a>>b>>c;
                --b;
                if(b-c<0)
                    continue;
                //cout<<a-c<<" "<<b-c<<" "<<c<<endl;
                update(root,0,1e9+100,max(0ll,a-c),b-c,c);
            }
            while(q--)
            {
                cin>>a;
                ll ans=query(root,0,1e9+100,a);
                if(ans==1e12)
                    cout<<-1<<endl;
                else
                    cout<<ans<<endl;
            }
        }
        return 0;
    }


Measured memory_bytes: 275072
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
#define PI acos(-1)
typedef long long ll;
using namespace std;
int n, m, *x, a, b;
map<int, vector<int> > mp;
int go(int i)
{
    if(mp.find(i) == mp.end())
        return 0;
    if(~x[i - 1])
        return x[i - 1];
    for(int j = 0; j < mp[i].size(); j++)
        x[i - 1] = max(x[i - 1], go(mp[i][j]) + 1);
    return x[i - 1];
}
int main()
{
    cin.tie(NULL); cout.tie(NULL);  ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif
    cin >> n >> m;
    x = new int[n];
    memset(x, -1, 4 * n);
    for(int i = 0; i < m; i++)
    {
        cin >> a >> b;
        mp[a].push_back(b);
    }
    for(map<int, vector<int> >::iterator it = mp.begin(); it != mp.end(); it++)
        go(it->first);
    int ans = 0;
    for(int i = 0; i < n; i++)
        ans = max(ans, max(x[i], 0));
    cout << ans;
}

Measured memory_bytes: 14976
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

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

  int64_t A, B, C;
  cin >> A >> B >> C;
  int64_t count;
  constexpr int32_t kMaxCount = 100000;
  for (int64_t i = 0; i < kMaxCount; ++i) {
    count = i;
    if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) {
      break;
    }
    const int32_t temp_a = A, temp_b = B, temp_c = C;
    A = temp_b / 2 + temp_c / 2;
    B = temp_a / 2 + temp_c / 2;
    C = temp_a / 2 + temp_b / 2;
  }
  if (count == kMaxCount - 1) {
    cout << -1 << endl;
  } else {
    cout << count << endl;
  }

  return 0;
}


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

using namespace std;

int main(){
	/*input*/
	int n;
    cin >> n;
	int d[100000];
	for(int i=0; i<n;i++){
	  cin >> d[i];
	}

	/*calc*/
	sort(d,d+n);
	int ans = 0;
	ans = d[n/2] - d[n/2 -1];

	/*output*/
   	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
vector<int>E[101000];
int n, m, R[201000], cnt;
bool v[101000];
void DFS(int a){
    v[a]=true;
    R[++cnt] = a;
    int i;
    for(i=0;i<E[a].size();i++){
        if(!v[E[a][i]]){
            DFS(E[a][i]);
            return;
        }
    }
}
int main(){
    int i, a, b, rt;
    scanf("%d%d",&n,&m);
    for(i=0;i<m;i++){
        scanf("%d%d",&a,&b);
        rt = a;
        E[a].push_back(b);
        E[b].push_back(a);
    }
    DFS(rt);
    int c = cnt;
    DFS(rt);
    printf("%d\n",cnt-1);
    for(i=cnt;i>c+1;i--)printf("%d ",R[i]);
    for(i=1;i<=c;i++)printf("%d ",R[i]);
}

Measured memory_bytes: 6784
abcd = input()


def dfs(s, idx):
  
  if len(s) == 7:
    if eval(s) == 7:
      s += "=7"
      print(s)
      exit()
    return
    
  #print(s)
  dfs(s + "+" + abcd[idx], idx+1)
  dfs(s + "-" + abcd[idx], idx+1)
  
  
dfs(abcd[0], 1)

Measured memory_bytes: 3060
//ALDSC_1
#include<iostream>
using namespace std;
int main(){
	int n;
	int ans=0,tmp;
	bool f;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>tmp;
		f=1;
		for(int j=2;j*j<=tmp;j++){
			if(tmp%j==0)f=0;
		}
		ans+=f;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1160
N, K = map(int, input().split())
ans = int(N)
N_1 = N
N_2 = N
k_range = N // K
# print(k_range)

if k_range == 0:
    N = N - K
    if ans > abs(N):
        ans = abs(N)
else:
    N_1 = N - (K * k_range)
    N_2 = N - (K * (k_range + 1))

if abs(N_1) < abs(N_2):
    if ans > abs(N_1):
        ans = abs(N_1)
    else:
        pass
else:
    if ans > abs(N_2):
        ans = abs(N_2)
    else:
        pass
print(ans)


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main()
{
 string s;
 cin>>s;
 int l=s.size();
 int sum=0;
 for(int i=0;i<l;i++)
  sum=sum+s[i]-'0';
  
  if(sum%9==0)
  cout<<"Yes";
  else
  cout<<"No";
  }

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    long x, y, z;
    cin >> x >> y;
    z = y / x;
    int count = 0;
    while(z > 0){
        z /= 2;
        count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    a,b,x = LI()
    return b//x - a//x + (1 if a%x==0 else 0)


print(main())


Measured memory_bytes: 5656
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  ll Max = 0;
  ll Maxind = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
    if(Max<a[i]){
      Max = a[i];
      Maxind = i;
    }
  }
  double dist = INT_MAX;
  int ind = 0;
  for (int i = 0; i < n; i++)
  {
    if(i==Maxind){
      continue;
    }
    if (dist > abs(Max / 2.0 - a[i]))
    {
      ind = i;
      dist = abs(Max / 2 - a[i]);
    }
  }
  cout << Max <<" "<<a[ind] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

int x[5];



int main () {
    while(scanf("%d,%d,%d,%d,%d",&x[0],&x[1],&x[2],&x[3],&x[4])!=EOF){
        int bucket[15]={0};
        for(int i=0; i<5; i++){
            if(x[i]==1){
                bucket[14]++;
            }
            bucket[x[i]]++;
        }
        
        int max1=0;
        int max2=0;
        for(int i=0; i<14; i++){
            if(max1<bucket[i]){
                max2=max1;
                max1=bucket[i];
            }else if(max2<bucket[i]){
                max2=bucket[i];
            }
        }
        
        int first=-1;
        for(int i=0; i<15; i++){
            if(bucket[i]==1){
                first=i;
                break;
            }
        }
        

        
        int straight=1;
        for(int i=first; i<first+4; i++){
            if(bucket[i]!=1){
                straight=0;
                break;
            }
        }
        
        if(straight!=1){
            straight=1;
            for(int i=10; i<15; i++){
                if(bucket[i]!=1){
                    straight=0;
                    break;
                }
            }
        }
        
        
        if(max1==4){
            cout<<"four card"<<endl;
        }else if(max1==3&&max2==2){
            cout<<"full house"<<endl;
        }else if(straight==1){
            cout<<"straight"<<endl;
        }else if(max1==3){
            cout<<"three card"<<endl;
        }else if(max1==2&&max2==2){
            cout<<"two pair"<<endl;
        }else if(max1==2){
            cout<<"one pair"<<endl;
        }else{
            cout<<"null"<<endl;
        }




    }
    
    return 0;
}

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

int N, S;

int main()
{
   while ( cin >> N && N>0)
   {
      int M, m, addup, i;
      M = -1;
      m = 1001;
      addup = 0;
      for ( i = 0; i<N; i++)
      {
         cin >> S;
         addup += S;
         if ( S > M) M = S;
         if ( S < m) m = S;
      }
   cout << (addup - M - m)/(N-2)  << endl;
   }
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int p[2*100005];
int r[2*100005];
void make_set(int x)
{
    p[x]=x;
}
int Find(int x)
{
    if(p[x]==x)return x;
    else return p[x]=Find(p[x]);
}
void unit(int x,int y)
{
    x=Find(x);
    y=Find(y);
    if(r[x]<r[y]){
        p[x]=y;
    }
    else{
        p[y]=x;
        if(r[x]==r[y])r[x]++;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)make_set(i);
    while(m-->0){
        int t;
        cin>>t;
        if(t==0){
            int x,y;
            cin>>x>>y;
            unit(x,y);
        }
        if(t==1){
            int x,y;
            cin>>x>>y;
            if(Find(x)==Find(y))cout<<1<<endl;
            else cout<<0<<endl;
        }
    }
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	string s;
	cin >> s;

	int k;
	cin >> k;

	// 桁数
   int log = s.size();

	// dp0[i][j] : 上からi桁まで決めて、0でない桁がj個あり、Nより小さいことが確定している
	// dp1[i][j] : 上からi桁まで決めて、0でない桁がj個あり、Nより小さいことが確定していない
    vector< vector<ll> > dp0(log + 1, vector<ll>(k + 1, 0));
    vector< vector<ll> > dp1(log + 1, vector<ll>(k + 1, 0));

    dp0[0][0]=1;
    dp1[1][1]=1;
	
	for(int i = 0; i < log; ++i)
	{
		int num = s[i] - '0';

		for(int j = 0; j <= k; ++j)
		{
			if (num == 0)
			{
				dp0[i + 1][j] += dp0[i][j];
				if (j + 1 <= k)
				{
					dp0[i + 1][j + 1] += dp0[i][j] * 9;
				}
				if (j != 0)
				{
					dp1[i + 1][j] += dp1[i][j];
				}
			}
			else
			{
				dp0[i + 1][j] += dp0[i][j] + dp1[i][j];
				if(i == 0 && j == 0)
				{
					dp0[i + 1][j + 1] += dp0[i][j] * (num - 1);
				}
				else if (j + 1 <= k)
				{
					dp0[i + 1][j + 1] += dp0[i][j] * 9 + dp1[i][j] * (num - 1);
				}
				if(j != 0 && j + 1 <= k)
				{
					dp1[i + 1][j + 1] += dp1[i][j];
				}
			}
		}
	}

	cout << dp0[log][k] + dp1[log][k];

	/*
	
	// 上から k桁の数字
	int top_num = stoi(s.substr(0, k));

	ll ans = 0;

	// 最大位数が0の時
	// (log-1) C k が9通り
	ans += pow(9, k) * comb(log - 1, k);

	cout << ans << endl;

	// 最大位数が0でないとき

	if (k == 1)
	{
		ans += top_num;
	}
	else if (k == 2)
	{
		ans += (top_num / 10 - 1) * 9 * (log - 1);
		cout << ans << endl;

		ans += (top_num % 10) * 9 * (log - 2);
		cout << ans << endl;

		ans += (log == k) ? (top_num % 10) : 1;
	}
	else if (k == 3)
	{
		ans += (top_num / 100 - 1) * 9 * (log - 1);
		cout << ans << endl;

		ans += ((top_num % 100) / 10) * 9 * (log - 2);
		cout << ans << endl;

		ans += (log == k) ? ((top_num % 10) / 10) : 1;
	}
	else while(true) cout << "nanikaokashii";
	cout << ans;
	*/
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 256
import sys
from operator import itemgetter
 
inf = 1 << 30
 
def solve():
    n = int(sys.stdin.readline())
 
    # r_max = MAX, b_min = MIN にしたとき
 
    r_max = b_max = 0
    r_min = b_min = inf
 
    p = []
 
    for i in range(n):
        xi, yi = map(int, sys.stdin.readline().split())
 
        if xi > yi:
            xi, yi = yi, xi
 
        p.append((xi, yi))
 
        r_max = max(r_max, yi)
        r_min = min(r_min, yi)
        b_max = max(b_max, xi)
        b_min = min(b_min, xi)
 
    ans1 = (r_max - r_min) * (b_max - b_min)

    # print('r_max = MAX, b_min = MIN -> ', ans1, file=sys.stderr)
 
    # r_max = MAX, r_min = MIN にしたとき
 
    ans2 = (r_max - b_min)
 
    p.sort(key=itemgetter(0))

    # print(*p, sep='\n', file=sys.stderr)
 
    b_min = p[0][0]
    b_max = p[-1][0]
 
    y_min = inf
 
    dif_b = b_max - b_min
 
    for i in range(n - 1):
        if p[i][1] == r_max:
            break
 
        y_min = min(y_min, p[i][1])
 
        b_min = min(p[i + 1][0], y_min)
        b_max = max(b_max, p[i][1])

        # print(b_min, b_max, b_max - b_min, file=sys.stderr)
 
        dif_b = min(dif_b, b_max - b_min)
 
        if y_min < p[i + 1][0]:
            break
 
    ans2 *= dif_b

    # print('r_max = MAX, r_min = MIN ->', ans2, file=sys.stderr)
 
    ans = min(ans1, ans2)
 
    print(ans)
 
if __name__ == '__main__':
    solve()

Measured memory_bytes: 33904
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stdlib.h>

using namespace std;

int main() {
    int n,k;
    int a[100005];
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    int c;
    if((n-k)%(k-1)==0) c=1+(n-k)/(k-1);
    else c=1+(n-k)/(k-1)+1;
    cout<<c<<endl;
    return 0;

 }

Measured memory_bytes: 640
s = str(input())
N = s.count("N")
S = s.count("S")
W = s.count("W")
E = s.count("E")

if (max(N,S)>0 and min(N,S) == 0) or (max(W,E)>0 and min(W,E)==0):
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#include <stdio.h>
int main() {
  vector<char> s(3); 
  for (int i; i<3; i++) cin >> s.at(i);
  sort ( s.begin(), s.end() );
  if(s.at(0)=='a'&&s.at(1)=='b'&&s.at(2)=='c') cout << "Yes" << endl;
  else cout << "No" << endl;
}



Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException e){
			e.printStackTrace();
		}
	}
	
	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line;
		
		while((line = in.readLine()) != null){
			int size = Integer.parseInt(line);
			if(size==0) break;
			int[][] data = new int[size][2];
			for(int n=0; n<size; n++){
				line = in.readLine();
				String[] tmp = line.split(" ");
				data[n][0] = Integer.parseInt(tmp[0]);
				data[n][1] = Integer.parseInt(tmp[1]);
			}
			
			line = in.readLine();
			size = Integer.parseInt(line);
			for(int n=0; n<size; n++){
				line = in.readLine();
				int num = Integer.parseInt(line);
				int[] N = {0};
				count(data, num, N, 0, 0);
				System.out.println(N[0]);
			}
		}
	}
	
	public void count(int[][] data, int ans, int[] N, int current, int depth){
		if(current > ans){
			return;
		}
		if(depth != data.length){
			int cost = current;
			for(int n=0; n<=data[depth][1]; n++){
				count(data, ans, N, cost, depth+1);
				cost += data[depth][0];
			}
		}
		else{
			if(current == ans){
				N[0]++;
			}
		}
	}
}

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

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException e){
			e.printStackTrace();
		}
	}

	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		List<int[][]> puzzle = new ArrayList<int[][]>();
		List<int[][]> error = new ArrayList<int[][]>();
		String line = in.readLine();
		int size = Integer.parseInt(line);
		for(int n=0; n<size; n++){
			int[][] data = new int[9][9];
			int[][] label = new int[][]{
					{0, 0, 0, 0, 0, 0, 0, 0, 0},
					{0, 0, 0, 0, 0, 0, 0, 0, 0},
					{0, 0, 0, 0, 0, 0, 0, 0, 0},
					{0, 0, 0, 0, 0, 0, 0, 0, 0},
					{0, 0, 0, 0, 0, 0, 0, 0, 0},
					{0, 0, 0, 0, 0, 0, 0, 0, 0},
					{0, 0, 0, 0, 0, 0, 0, 0, 0},
					{0, 0, 0, 0, 0, 0, 0, 0, 0},
					{0, 0, 0, 0, 0, 0, 0, 0, 0}
			};

			for(int y=0; y<9; y++){
				line = in.readLine();
				String[] dst = line.split(" ");
				for(int x=0; x<9; x++){
					data[y][x] = Integer.parseInt(dst[x]);
				}
			}

			for(int y=0; y<9; y++){
				for(int x=0; x<9; x++){
					for(int m=0; m<9; m++){
						if(data[y][x] == data[m][x] && m!=y){
							label[y][x] = 1;
						}

						if(data[y][x] == data[y][m] && m!=x){
							label[y][x] = 1;
						}
					}

					int xx = x/3;
					int yy = y/3;
					for(int i=3*xx; i<3*xx+3; i++){
						for(int j=3*yy; j<3*yy+3; j++){
							if(data[y][x] == data[j][i] && i!=x && j!=y){
								label[y][x] = 1;
							}
						}
					}
				}
			}
			puzzle.add(data);
			error.add(label);
		}

		for(int n=0; n<size; n++){
			for(int y=0; y<9; y++){
				for(int x=0; x<9; x++){
					if(error.get(n)[y][x] == 1){
						System.out.print("*");
					}
					else{
						System.out.print(" ");
					}
					System.out.print(puzzle.get(n)[y][x]);
				}
				System.out.println();
			}
			if(n!=size-1){
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 9964
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



signed main(){
cin.tie(0);
ios::sync_with_stdio(false);

	VI a(3);
	cin >> a[0] >> a[1] >> a[2];
	if (a[0] % 2 == 0 || a[1] % 2 == 0 || a[2] % 2 == 0) {
		cout << 0 << endl;
		return 0;
	}
	SORT(a);
	cout << a[0] * a[1] << endl;
	return 0;
}



Measured memory_bytes: 256
def e;eval"[#{gets}]";end
gets
h=(0..21).map{{}};gets.to_i.times{a,b,c,d=e;h[a][b]=c;h[b][a]=d}
*s,z,c=e
s.map{|x|d=[x]
t={x=>0}
(p=q=1e5;d.map{|i|h[i].map{|k,v|t[k]||q>(o=t[i]+v)&&(p,q=k,o)}};t[p]=q;d<<p)until w=t[*s-[x]]
z-=w}
p z-c

Measured memory_bytes: 6124
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll n,i,j;
    ll ara[3];
    cin>>ara[0]>>ara[1]>>ara[2];
    sort(ara,ara+3);
    cout<<ara[0]+ara[1];
return 0;
}


Measured memory_bytes: 4992
using System;

public class Program
{
    public static int maxM;
    public static int[] shinamonotachi;

    public static void Main(string[] args)
    {
        var inputStr = Console.ReadLine().Split(' ');
        var input = new int[inputStr.Length];

        for (int i = 0; i < inputStr.Length; i++)
        {
            input[i] = int.Parse(inputStr[i]);
        }

        if (input[0] >= 10 || input[1] >= 10)
        {
            Console.WriteLine("-1");
            return;
        }
        var result = input[0] * input[1];
        Console.WriteLine(result);
    }
}

Measured memory_bytes: 11092
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

cnt_dict = defaultdict(int)
for a in A:
    cnt_dict[a] += 1

total = 0
for v in cnt_dict.values():
    total += v * (v - 1) // 2

for a in A:
    print(total - (cnt_dict[a] - 1))

Measured memory_bytes: 26780
#include <algorithm>
#include <cstdio>
#include <cstring>

const int Maxv = 5000;
const long long Mod = 998244353;

typedef long long ll; 

ll ans[Maxv], fac[Maxv], inv[Maxv], n, k;

inline ll C(ll n, ll m) {
    if (n < m) return 0; 

    return fac[n] * inv[m] % Mod * inv[n - m] % Mod; 
}

inline ll Pow(ll x, ll p) {
    ll res = 1; 
    for (; p; p >>= 1) {
        if (p & 1) {
            res = res * x % Mod; 
        }
        x = x * x % Mod; 
    }

    return res; 
}

inline void Pre() {
    fac[0] = inv[0] = 1; 

    for (int i = 1; i <= 4000; i++) {
        fac[i] = fac[i - 1] * i % Mod; 
    }
    
    inv[4000] = Pow(fac[4000], Mod - 2); 

    for (int i = 3999; i; i--) {
        inv[i] = (inv[i + 1] * (i + 1)) % Mod; 
    }
}

inline ll Solve(ll cur, ll n, ll k) {
    ll res = 0; 

    for (int i = 0; i <= n >> 1; i++) {
        ll tmp = C(cur >> 1, i) * C(n + k - i * 2 - 1, k - 1) % Mod; 

        if (i & 1) res = (res - tmp + Mod) % Mod; 
        else res = (res + tmp) % Mod; 
    }

    return res; 
}

int main() {
    scanf("%lld%lld", &k, &n); 

    Pre(); 

    for (int i = 1; i <= k; i++) {
        if (i & 1) ans[i] = (Solve(i, n, k - 1) + Solve(i, n - 1, k - 1)) % Mod; 
        else ans[i] = Solve(i, n, k); 
    }

    for (int i = 1; i <= k; i++) printf("%lld\n", ans[i]); 
    for (int i = k - 1; i; i--) printf("%lld\n", ans[i]); 

    return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  int H,N;
  cin >> H >> N;
  int A;
  int sum = 0;
  rep(i,N){
    cin >> A;
    sum += A;
  }
  if(H <= sum){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3552
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String sp[])throws IOException{
		Scanner sc = new Scanner(System.in);
		int a =  sc.nextInt();
		int b = sc.nextInt();
		int c=Math.max((a*b),Math.max((a+b),(a-b)));
		System.out.println(c);
		
	}
	
	
	static class Reader
		{
			final private int BUFFER_SIZE = 1 << 16;
			private DataInputStream din;
			private byte[] buffer;
			private int bufferPointer, bytesRead;
			BufferedReader br;
			public Reader()
			{
				din = new DataInputStream(System.in);
				buffer = new byte[BUFFER_SIZE];
				bufferPointer = bytesRead = 0;
				br = new BufferedReader(new InputStreamReader(System.in));
			}
	 
			public Reader(String file_name) throws IOException
			{
				din = new DataInputStream(new FileInputStream(file_name));
				buffer = new byte[BUFFER_SIZE];
				bufferPointer = bytesRead = 0;
			}
	 
			public String readLine() throws IOException
			{
				byte[] buf = new byte[64]; // line length
				int cnt = 0, c;
				while ((c = read()) != -1)
				{
					if (c == '\n')
						break;
					buf[cnt++] = (byte) c;
				}
				return new String(buf, 0, cnt);
			}
			
			
			
	 
			public int nextInt() throws IOException
			{
				int ret = 0;
				byte c = read();
				while (c <= ' ')
					c = read();
				boolean neg = (c == '-');
				if (neg)
					c = read();
				do
				{
					ret = ret * 10 + c - '0';
				} while ((c = read()) >= '0' && c <= '9');
	 
				if (neg)
					return -ret;
				return ret;
			}
	 
			public long nextLong() throws IOException
			{
				long ret = 0;
				byte c = read();
				while (c <= ' ')
					c = read();
				boolean neg = (c == '-');
				if (neg)
					c = read();
				do
				{
					ret = ret * 10 + c - '0';
				}
				while ((c = read()) >= '0' && c <= '9');
				if (neg)
					return -ret;
				return ret;
			}
	 
			public double nextDouble() throws IOException
			{
				double ret = 0, div = 1;
				byte c = read();
				while (c <= ' ')
					c = read();
				boolean neg = (c == '-');
				if (neg)
					c = read();
	 
				do
				{
					ret = ret * 10 + c - '0';
				}
				while ((c = read()) >= '0' && c <= '9');
	 
				if (c == '.')
				{
					while ((c = read()) >= '0' && c <= '9')
					{
						ret += (c - '0') / (div *= 10);
					}
				}
	 
				if (neg)
					return -ret;
				return ret;
			}
	 
			private void fillBuffer() throws IOException
			{
				bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
				if (bytesRead == -1)
					buffer[0] = -1;
			}
	 
			private byte read() throws IOException
			{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			}
			StringTokenizer st;
			String next() {
				while (st == null || !st.hasMoreTokens()) {
					try {
						st = new StringTokenizer(br.readLine());
					} catch (Exception r) {
						r.printStackTrace();
					}
				}
				return st.nextToken();
			}
	 
	 
			public void close() throws IOException
			{
				if (din == null)
					return;
				din.close();
			}
		}
}

Measured memory_bytes: 22100
a, b, c, x, y = map(int, input().split())

ans = [a * x + b * y]

if x >= y:
    ans.append(2 * c * y + (x - y) * a)
    ans.append(2 * c * x)
else:
    ans.append(2 * c * x + (y - x) * b)
    ans.append(2 * c * y)

print(min(ans))


Measured memory_bytes: 9184