akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define sc scanf
using namespace std;
const int N=3e5+5;
const int mod=1e9+7;
typedef unsigned long long ull;
typedef long long ll;
template <typename it>int o(it a){cout<<a<<endl;return 0;}
#define maxn 2000+40
typedef long long int LL;
int n , m;
LL dp[maxn][maxn];
int a[maxn];
int b[maxn];
int main()
{

        cin >> n >> m ;
        memset(dp,0,sizeof(dp));
        for(int i = 1 ; i <= n ; ++i)

            scanf("%d ",&a[i]);

        for(int i = 1 ; i <= m ; ++i)

            scanf("%d",&b[i]);

        for(int i = 1 ; i <= n ; ++i)
        {
            for(int j = 1 ; j <= m ; ++j)
            {
                if( a[i] == b[j] )
                {
                    dp[i][j] = dp[i-1][j] + dp[i][j-1] + 1;
                }
                else dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1];
                dp[i][j] %= mod;
            }
        }
        cout << (dp[n][m] + mod+1)%mod << endl;
 }


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

int main(){
  long long A, B, K;
  cin >> A >> B >> K;
  long long temp=A;
  if(A<=K) A=0;
  else A-=K;
  if(A==0){
    if(B>K-temp) B-=(K-temp);
    else B=0;
  }
  cout << A << ' ' << B << endl;
}

Measured memory_bytes: 256
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

H,W = map(int,input().split())

A = [list(map(int,input().split())) for _ in range(H)]
ans = INF
for i in range(H):
    for j in range(W):
        temp_sum = 0
        for l in range(H):
            for k in range(W):
                temp_sum += A[l][k]*min(abs(l-i), abs(k-j))
        ans = min(temp_sum, ans)
print(ans)


Measured memory_bytes: 8932
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    int n, m; cin>>n>>m;
    vector<vector<int>> s(m);
    for(int i=0; i<m; i++){
        int k; cin>>k;
        for(int j=0; j<k; j++){
            int S; cin>>S;
            S--;
            s[i].emplace_back(S);
        }
    }

    vector<int> p(m);
    for(int i=0; i<m; i++) cin>>p[i];

    int ans = 0;
    for(int bit=0; bit<(1<<n); bit++){
        bool valid = true;
        for(int i=0; i<m; i++){
            int sum = 0;
            for(int j=0; j<s[i].size(); j++){
                if(bit & (1 << s[i][j])) sum++;
            }
            if(sum % 2 != p[i]) valid = false;
        }

        if(valid) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

template <class T>
struct SegmentTree{
  using F = function<T(T,T)>;
  F f;
  T inf;
  int n;
  vector<T> node;

  SegmentTree(vector<T> v,T inf,F f):inf(inf),f(f){
    n = 1; while(n < v.size()) n *= 2;
    node.resize(2*n-1,inf);
    for(int i = 0; i < v.size(); i++) node[i+n-1] = v[i];
    for(int i = n-2; i >= 0; i--) node[i] = f(node[2*i+1],node[2*i+2]);
  }

  void update(int k,T val){
    k += n-1;
    node[k] = val;
    while(k > 0){
      k = (k-1) / 2;
      node[k] = f(node[2*k+1],node[2*k+2]);
    }
  }

  void add(int k,T val){
    k += n-1;
    node[k] += val;
    while(k > 0){
      k = (k-1) / 2;
      node[k] = f(node[2*k+1],node[2*k+2]);
    }
  }

  T getval(int a,int b){ return getval(a,b,0,0,n); }
  T getval(int a,int b,int k,int l,int r){
    //区間[a, b)の値を返す
    if(r <= a || b <= l) return inf;
    if(a <= l && r <= b) return node[k];
    T vl = getval(a, b, 2*k+1, l, (l+r)/2);
    T vr = getval(a, b, 2*k+2, (l+r)/2, r);
    return f(vl, vr);
  }
};

signed main(){

  int n,t; cin >> n >> t;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  using P = pair<int,int>;
  vector<P> v(n);
  int mn = 1 << 30;
  for(int i = 0; i < n; i++){
    v[i] = {a[i],i};
    mn = min(mn,a[i]);
  }

  SegmentTree<P> seg(v,{-1,-1},[&](P x,P y){
    return max(x,y);
  });
  int cost = -1;
  for(int i = 0; i < n; i++){
    cost = max(cost,seg.getval(i+1,n).first - a[i]);
  }

  int ans = 0;
  for(int i = 0; i < n; i++){
    auto p = seg.getval(i+1,n);
    if(p.first - a[i] != cost) continue;
    seg.update(p.second,{p.first-1,p.second});
    ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8320
#pragma GCC optimize("Ofast")
  #pragma GCC target("avx,avx2,fma")
  #pragma GCC optimization ("unroll-loops")
  #include <bits/stdc++.h>
  using namespace std;
  //---------------------------------//
  void __print(int x) {cerr << x;}
  void __print(long x) {cerr << x;}
  void __print(long long x) {cerr << x;}
  void __print(unsigned x) {cerr << x;}
  void __print(unsigned long x) {cerr << x;}
  void __print(unsigned long long x) {cerr << x;}
  void __print(float x) {cerr << x;}
  void __print(double x) {cerr << x;}
  void __print(long double x) {cerr << x;}
  void __print(char x) {cerr << '\'' << x << '\'';}
  void __print(const char *x) {cerr << '\"' << x << '\"';}
  void __print(const string &x) {cerr << '\"' << x << '\"';}
  void __print(bool x) {cerr << (x ? "true" : "false");}

  template<typename T, typename V>
  void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
  template<typename T>
  void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
  void _print() {cerr << "]\n";}
  template <typename T, typename... V>
  void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
  #ifndef ONLINE_JUDGE
  #define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
  #else
  #define deb(x...)
  #endif
 //------------------------------//

  typedef long long int ll;
  typedef pair<int,int> pi;
  typedef pair<ll,ll> pll;
  typedef vector<int> vi;
  typedef vector<ll> vll;
  typedef vector<pi> vpi;
  typedef vector<pll> vpll;

  #define  ff           first
  #define  ss           second
  #define  pb           push_back
  #define  IOS          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  #define  all(x)       (x).begin(), (x).end()
  #define  ps(x,y)      fixed<<setprecision(y)<<x
  #define  rep(i,a,b)   for(ll i=a ; i<b ; ++i)

  const ll MOD = 1e9 + 7;
  const ll INF = 1e18;
  const ll maxn = 1e6 + 4;


  void solve(){
	 int h,w,m;
	 cin >> h >> w >> m;
	 map<pair<int,int>,int> mp;
	 vi col(w);
	 vi row(h);
	 int mxrow=INT_MIN;
	 int mxcol = INT_MIN;
	 for(int i=0;i<m;i++){
	 	int a,b;
	 	cin >> a >> b;
	 	mp[{a-1,b-1}]=1;
	 	col[b-1]++;
	 	row[a-1]++;
	 	mxrow=max(mxrow,row[a-1]);
	 	mxcol = max(mxcol,col[b-1]);
	 }
	 vi mxr,mxc;
	 map<int,int>mpxr;
	 map<int,int>mpxc;
	 for(int i=0;i<h;i++){
	 	 if(mxrow==row[i])mxr.pb(i),mpxr[i]=1;
	 }	
	 for(int i=0;i<w;i++){
	 	if(mxcol == col[i])mxc.pb(i),mpxc[i]=1;
	 }
	 
	 ll cnt=0;
	 ll total = ((ll)mxr.size())*((ll)mxc.size());
	for(auto x:mp){
		if(mpxr[(x.ff.ff)] && mpxc[(x.ff.ss)]){
			cnt++;
		}
	}
	if(total-cnt>0){
		cout << mxrow+mxcol;
	}
	else cout << mxrow+mxcol-1;
  }

  int main(){
    IOS
    	solve();
    //cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
  }

// integer overflow
// remember to clear visited array
// take input as vector<string> while using grid
// don't assign after modifying

Measured memory_bytes: 54916
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n; cin >> n;
  string s;
  vector<int> a(4);
  
  for(int i=0;i<n;i++){
    cin >> s;
    
    if(s=="AC")a[0]++;
    else if(s=="WA")a[1]++;
    else if(s=="TLE")a[2]++;
    else if(s=="RE")a[3]++;
  }
  cout << "AC x " << a[0] << endl;
  cout << "WA x " << a[1] << endl;
  cout << "TLE x " << a[2] << endl;
  cout << "RE x " << a[3] << endl;  
}

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

int n, k, idx;
ll a[1001], sum[500500], ans;

int main() {
    cin >> n >> k;
    rep(i, n) cin >> a[i + 1];
    REP(i, 1, n) a[i + 1] += a[i];
    REP(l, 1, n + 1) REP(r, l, n + 1) {
        sum[idx++] = a[r] - a[l - 1];
    }

    for (int i = 39; i >= 0; --i) {
        ll x = ans | (1LL << i);
        // cout << i << " x " << x << endl;
        int cnt = 0;
        rep(j, idx) if ((sum[j] & x) == x) cnt++;
        if (cnt >= k) ans = x;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4224
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	s = readline() |> chomp
	f = s[1]
	x = 0
	for i in 2:length(s)
		if f!=s[i]
			x += 1
			f=s[i]
		end
	end
	println(x)
end

main()

Measured memory_bytes: 114436
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        s: String
    };
    let slen = s.len();
    for i in 1..slen {
        let len = slen - i;
        if len % 2 == 0 {
            let half = len / 2;
            if s[0..half] == s[half..len] {
                println!("{}", len);
                return;
            }
        }
    }
}


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

using namespace std;
using ll=long long;

int main() {
    string s;
    cin>>s;
    ll n=s.size();
    ll s0=1012983091;//1桁多く
    ll s1=0;//その桁まで
    for(ll i=n-1;i>=0;i--){
        ll d=s[i]-'0';
        ll t0=min({
            1+(10-d)+s0-2,
            1+(10-d)+s1,
        });
        ll t1=min({
            d+s0,
            d+s1,
        });
        s0=t0;
        s1=t1;
        //cout<<s0<<" "<<s1<<endl;
    }
    cout<<min({s0,s1})<<endl;
	return 0;
}


Measured memory_bytes: 1412
import math
a=int(input())
kyori=a
dest = int(math.sqrt(a))
for i in range(2,dest+1):
  if a % i == 0:
    if i+(a//i)-2 < kyori:
      kyori=i+(a//i)-2
if kyori==a:
  print(a-1)
else:
  print(kyori)

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


//c++ templte for help............................................................................................................................................
typedef long long ll;

//template<typename... T>
//void print1(T... t){
	//((cout<<t<<" "),...);
//}

//template<typename... T>
//void print2(T... t){
		//vector<vector<ll>> ans={t...};
		//for(ll i=0;i<(ll)ans.size();i++){
			//if(i!=0) cout<<"\t";
			//else cout<<"\t";
			//for(ll j=0;j<(ll)ans[i].size();j++){
				//cout<<ans[i][j]<<" ";
			//}
			//if(i!=(ll)ans.size()-1)
			//cout<<endl;
		//}
//}	
//#define deb(...) cout<<" [ "#__VA_ARGS__<<" : "; print1(__VA_ARGS__); cout<<"]"<<endl; 
//#define vdeb(...) cout<<" [ "#__VA_ARGS__<<" : "; print2(__VA_ARGS__); cout<<"]"<<endl;





	
 
//for loop
#define fo(i,n) for(int i=0;i<(ll)n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
//template<typename T>
//void printV(T vec){
	//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//cout<<endl;
	//}
	
 
#define modulo 1000000007
//const int INF=1e9+5;
 
//iterate map
//template<typename T>
//void itR(T map){
	 //for(auto itr=map.begin();itr!=map.end();itr++){
				//deb(itr->first,itr->second);
			//}
	//cout<<endl;
//}
 
 
 
//c++ template for help...........................................................................................................................................

ll solve(){
	ll n;
	cin>>n;
	
	vector<int> vec(n);
	fo(i,n){
		cin>>vec[i];
	}
	
	vector<int> dp(n+1);//dp[n] -- n pa jane ma kintna cost lagega
	dp[0]=0;
	dp[1]=0;
	
	for(int i=2;i<=n;i++){
		if(i-3>=0)
			dp[i]=min(dp[i-1]+abs(vec[i-1]-vec[i-2]),dp[i-2]+abs(vec[i-1]-vec[i-3]));
		else dp[i]=dp[i-1]+abs(vec[i-1]-vec[i-2]);
	}
	
	return dp[n];
}

int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(50);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA
	 // greedy ma jadatr exceptional case check kr ke dekh lo
	 
	 // WHILE DOING THE QUESTION OF DYNAMIC PROGRAMMING GREEDY KA TRAH SOCHNA BAND KRO
	 // DP M DATA KA BHI USE KRNA PDTA HA BE BHULO MT 
	 // DP BHI WO LEETCODE WALE MATRIX KA QUESTION KI TARAH HA
	 // CONSTRAIN WILL BE THE DIMENSION OF DP
	 // DP MA STATE PTA KRO AUR PHIR FUNCTION GENERATE KRO
	 // OBJECT KO CHOOSE KIA YA NAE KIA AGAR KIA TO KYA HOGA AUR NAE KIA TO KYA HOGA
	 // KYA KYA CHEJ IMPORTANT HA WO STATE BN JAGA AUR HUM LOG STATE KO CHANGE KR SKTA HA JYSA KNPSACK 2 WALE PROBLEM MA KIA THA
	 

	 
	//ll testCase;
	//cin>>testCase;
	//for(ll tt=0;tt<testCase;tt++){
		//solve();
		cout<<solve()<<endl;
	//}
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#define pb push_back
#define mod (int)(1e9+7)
using namespace std;
typedef pair<int,int> pii;


int hako[111111];
int main(){
  int n,t;
  vector<int> a;
  cin>>n;

  bool f=true;
  for(int i=0;i<n;i++){
    cin>>t;
    a.pb(t);
    hako[t]++;
    if(t==0 && hako[t]>1) f=false;
    if(hako[t]>2) f=false;
  }
  if(!f) {
    cout<<0<<endl;
    return 0;
  }
  int res=1;
  for(int i=1;i<n;i++){
    if(hako[i]!=0) res*=2;
    res%=mod;
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 1276
ks = gets.chomp.split
k = ks[0].to_i
s = ks[1].to_i

count = 0
(0..k).each do |x|
    (0..k).each do |y|
        z = s - (x + y)
        count += 1 if 0 <= z && z <= k
    end
end

puts count


Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define Int long long
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  int X, Y, Z; cin >> X >> Y >> Z;
  cout << (X-Z)/(Y+Z) << endl;
}


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

int N, M, INF = 1e9;
int used[100000], C[200000], S[100000];
vector<int> DD;
vector<P> G[100000];
vector<P> D;

int main(){
	cin >> N >> M;
	rep(i, N){ int d; cin >> d; D.push_back(P(d, i)); S[i] = -1; DD.push_back(d); }
	rep(i, M){
		int u, v; cin >> u >> v;
		u--; v--;
		G[u].push_back(P(v, i));
		G[v].push_back(P(u, i));
	}
	sort(ALL(D));
	rep(i, N){
		int now = D[i].second, f = 0;
		if(used[now]) continue;
		rep(j, G[now].size()){
			int to = G[now][j].first;
			if(DD[to] <= DD[now]){
				C[G[now][j].second] = DD[now];
				if(S[to] == -1) S[to] = 1;
				f = 1;
				S[now] = 1 - S[to];
				used[now] = 1;
				used[to] = 1;
				break;
			}
		}
		if(!f){ cout << -1 << endl; return 0; }
	}
	rep(i, N){
		if(S[i]) cout << 'W';
		else cout << 'B';
	}
	cout << "\n";
	rep(i, M){
		if(!C[i]) cout << INF << endl;
		else cout << C[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 13172
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

int main() {
    int A, B;
    cin >> A >> B;
    for (int i=1;i<=3;i++){
        if (i == A || i == B) continue;
        cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
			try(Scanner sc = new Scanner(System.in)){
				while(true){
				int num = sc.nextInt();
				int[] fuda = new int[num];
				for(int i=0; i<fuda.length; i++){
					fuda[i] = num-i;
				}
				int times = sc.nextInt();
				if(num==0 && times==0){
					sc.close();
					return;
				}
				for(int i=0; i<times; i++){
					int p = sc.nextInt();
					int c = sc.nextInt();
					int[] fuda_p = new int[p-1];
					int[] fuda_c = new int[c];
					for(int j=0; j<p-1; j++){
						fuda_p[j] = fuda[j];
					}
					for(int j=0; j<c; j++){
						fuda_c[j] = fuda[j+p-1];
					}
					for(int j=0; j<c; j++){
						fuda[j] = fuda_c[j];
					}
					for(int j=c; j<c+p-1; j++){
						fuda[j] = fuda_p[j-c];
					}
				}
				System.out.println(fuda[0]);
				}
		}
	}
}


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

int main() {
  
  int A, B;
  cin >> A >> B;
  
  int count = 0;
  int mod[5];
  int N;
  for(int i = A; i <= B; i++) {
    N = i;
    for(int j = 0; j < 5; j++) {
      mod[j] = N % 10;
      N = N / 10;
    }
    if(mod[0] == mod[4] && mod[1] == mod[3]) {
      ++count;
    }
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
void S(vector<int>&in){
  int tmp=in[1];
  in[1]=in[0];
  in[0]=in[4];
  in[4]=in[5];
  in[5]=tmp;
}
void E(vector<int>&in){
  int tmp=in[2];
  in[2]=in[0];
  in[0]=in[3];
  in[3]=in[5];
  in[5]=tmp;
}
void T(vector<int>&in){
  int tmp=in[1];
  in[1]=in[2];
  in[2]=in[4];
  in[4]=in[3];
  in[3]=tmp;
}
bool isT(vector<int>&in,vector<int>&out){
  bool h=false;
  rep(i,5){
    S(in);
    if(in[0]==out[0]){h=true;break;}
  }
  if(!h){
    rep(i,5){
      E(in);
      if(in[0]==out[0])break;
    }
  }
  rep(i,5){
    T(in);
    if(in[1]==out[1])break;
  }
  h=true;
  rep(i,6)if(in[i]!=out[i])h=false;
  if(h)return 1;
  else return 0;
}
int main(){
  int n;
  cin>>n;
  vector<vector<int> >in(n);
  rep(i,n)rep(j,6){
    int tmp;cin>>tmp;
    in[i].pb(tmp);
  }
  bool h=false;
  rep(i,n)loop(j,i+1,n)if(isT(in[i],in[j]))h=true;
  if(h)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


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

    cout << min(min(a+b, b+c), a+c);
    
    return 0;
}

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

int main(){
    int n,q;
    cin >> n >> q;
    vector<int> a(n - 1), b(n - 1), p(q), x(q), counter(n);
    for(int i = 0; i < n - 1; i++){
        cin >> a.at(i) >> b.at(i);
        a.at(i)--;
        b.at(i)--;
    }
    for(int i = 0; i < q; i++){
        cin >> p.at(i) >> x.at(i);
        p.at(i)--;
    }
    
    vector<vector<int>> children(n, vector<int>(0));
    
    for(int i = 0; i < n - 1; i++){
        children.at(a.at(i)).push_back(b.at(i));
    }
    
    for(int i = 0; i < q; i++){
        counter.at(p.at(i)) += x.at(i);
    }
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < children.at(i).size(); j++){
            counter.at(children.at(i).at(j)) += counter.at(i);
        }
    }
    
    for(int i = 0; i < n; i++){
        cout << counter.at(i) << " ";
    }
    
}




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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int res = 0;
  for(int i=0; i<=A; i++) {
    for(int j=0; j<=B; j++) {
      for(int k=0; k<=C; k++) {
        if (500*i + 100*j + 50*k == X) res++;
      }
    }
  }
  cout << res << endl;
}

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

int main(){
    ll a,b,x;
    cin >> a >> b >> x;
    ll c,d;
    c=b-a+1;
    d=a%x;
    if(d!=0){
    c+=d-1;
    }
    else{
        c+=x-1;
    }

    ll ans;
    
    ans=c/x;

    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define n 100005
vector<ll> adj[n];
bool visited[n];
stack<ll> s;
void dfs(ll u)
{
	visited[u]=true;
	for(ll i=0;i<adj[u].size();i++)
	{
		ll v=adj[u][i];
		if (visited[v]==false)
		{
			dfs(v);
		}
	}
	s.push(u);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll N,M;
	cin>>N>>M;
	ll m=M,a,b;

	while(m--)
	{
		cin>>a>>b;
		a--;b--;
		adj[a].push_back(b);
	}

	memset(visited,false,sizeof(visited));
	for(ll i=0;i<N;i++)
	{
		if (visited[i]==false)
		{
			dfs(i);
			
		}
		
	}
	ll ans=0;
	ll dp[N];
	memset(dp,0,sizeof(dp));
	while(!s.empty())
	{
		//cout<<s.top()<<" ";
		ll v=s.top();
		ans=max(ans,dp[v]);
		for(ll i=0;i<adj[v].size();i++)
		{
			ll u=adj[v][i];
			dp[u]=max(dp[u],dp[v]+1);
		}
		s.pop();
	}
	cout<<ans;
}

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

using namespace std;

int main(void) {
  string s, t;
  cin >> s >> t;

  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());

  if(s < t) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

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

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int r = 0, n;
    cin >> n;
    map<int, vector<int>> m;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        int a;
        scanf("%d", &a);
        r ^= a;
        v[i] = a;
        int u = __builtin_ffs(a);
        if(m[u-1].empty()) m[u-1].emplace_back(a);
    }
    int x = 1 << 30, ans = 0;
    for (int p = 30; p  >= 0; --p) {
        if(r & x){
            if(m[p].empty()) {
                puts("-1");
                return 0;
            }else {
                r ^= m[p][0];
                r ^= (m[p][0]-1);
                ans++;
            }
        }
        x /= 2;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

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

	int n,a,b;
	cin >> n >> a >> b;

	if((a-b)%2 == 0) cout << "Alice\n";
	else			cout << "Borys\n";

	return 0;
}

Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

LL n, k;
LL h[202020];

int main(){
    cin >> n >> k;
    REP(i, n)cin >> h[i];
    sort(h, h + n);
    LL sum = 0;
    REP(i, n - k)sum += h[i];
    cout << sum << endl;
}

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

    	
    	
#define ll long long
#define pb push_back
#define mp make_pair

ll power(ll x,ll b)
{
    ll res=1;
    if(b==0)
    return 1;
    while(b>0)
    {
      if(b%2!=0)
      res=(res*x);
      b=b/2;
      x=(x*x);
      
    }
    return res;
}
 
 
       


  



      
   
    	
using namespace std;

 
vector<ll> primes;
void SieveOfEratosthenes(int n) 
{ 
    
    vector<ll>prime(200001,0);
  
    for (int p=2; p*p<=n;p++) 
    { 
       
        if (prime[p] == 0) 
        { 
           
            for (int i=p*p; i<=n; i += p) 
                prime[i] = 1; 
        } 
    } 
    
  
    // Print all prime numbers 
    for (int p=1; p<=n; p++) 
       if (prime[p]==0) 
        {
            primes.pb(p);
        }
} 












int main()
{
   ll n,i,j,k;
   cin>>n>>k;
   ll w[n+1],v[n+1];
   
   for(i=0;i<n;i++)
   {
       cin>>w[i+1]>>v[i+1];
   }
   ll dp[n+1][k+1];
   for(i=0;i<=n;i++)
   {
       for(j=0;j<=k;j++)
       {
           if(i==0||j==0)
           dp[i][j]=0;
           else if(w[i]<=j)
              {
                  dp[i][j]=max(v[i]+dp[i-1][j-w[i]],dp[i-1][j]);
                  
              }
              else
             {
                 dp[i][j]=dp[i-1][j];
             }
               
               
       }
       
   }
   cout<<dp[n][k];
   

   







}



Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<ll>>;
vector<bool>seen;
ll N,M;
int main(){
  cin>>N>>M;
  Graph G(N);
  seen.resize(N,false);
  for(ll i=0;i<M;i++){
  ll a,b;cin>>a>>b;a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }vector<ll>A;
  queue<ll>que;que.push(0);
  while(!que.empty()){
  ll v=que.front();seen[v]=true;A.push_back(v);
    que.pop();
    for(auto u:G[v]){
      if(seen[u])
        continue;
      que.push(u);break;
      }
   }vector<ll>B;queue<ll>que1;que1.push(0);
   while(!que1.empty()){
  ll v=que1.front();seen[v]=true;B.push_back(v);
    que1.pop();
    for(auto u:G[v]){
      if(seen[u])
        continue;
      que1.push(u);break;
      }
   }ll m=A.size()+B.size()-1;
  cout<<m<<endl;
  vector<ll>ans;
  for(ll i=B.size()-1;1<=i;i--)
    ans.push_back(B[i]);
  for(ll i=0;i<A.size();i++)
    ans.push_back(A[i]);
  for(ll i=0;i<ans.size()-1;i++)
    cout<<ans[i]+1<<" ";
  cout<<ans[m-1]+1<<endl;
  
  return 0;
}

Measured memory_bytes: 11056
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;   
int a[4];
int main(){
	fastIO;                            
	int x=0,n,ans=0;
	string s;
	cin>>n>>s;
	for(int i=0;i<n;i++){
		if(s[i] == 'I')x++;
		else x--;
		ans=max(ans,x);
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 1;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

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

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans /= (i + 1);
        ans %= mod;
    }
    return ans;
}

int main(){
    ll n,x,y;
    cin >> n >> x >> y;
    vector<ll> ans(n,0);
    rep1(i, n){
        vector<bool> g(n + 2,true);
        g[0] = false;
        g[i] = false;
        g[n + 1] = false;
        
        ll cnt = 0;
        queue<ll> to,erase;
        to.push(i);
        
        while (!to.empty()) {
            ++cnt;
            queue<ll> from = to;
            to = erase;
            while (!from.empty()) {
                if(g[from.front() - 1]){
                    to.push(from.front() - 1);
                    g[from.front() - 1] = false;
                    if(i < from.front() - 1)++ans[cnt];
                }
                if(g[from.front() + 1]){
                    to.push(from.front() + 1);
                    g[from.front() + 1] = false;
                    if(i < from.front() + 1)++ans[cnt];
                }
                if(from.front() == x && g[y]){
                    to.push(y);
                    g[y] = false;
                    if(i < y)++ans[cnt];
                }
                from.pop();
            }
        }
    }
    rep1(i, n - 1)pf(ans[i]);
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int N;
	int L;
	scanf("%d %d", &N, &L);

	int sum_taste = 0;
	sum_taste = (L + (L + N - 1)) * N / 2;

	if (L >= 0) {
		sum_taste -= L;
	}
	else {
		if (L + N <= 0) {
			sum_taste -= (L + N - 1);
		}
	}

	printf("%d", sum_taste);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {


ll a,b,c,k;
cin>>a>>b>>c>>k;
int ans=0;
if(k<a)
	cout<<k;
else if(k>=a&&k<=a+b)
	cout<<a;
else 
	cout<<a-(k-(a+b));
    return 0;
}



Measured memory_bytes: 3624
n = int(input())
li = list(map(int,input().split()))
ans = 0
for i in range(n-2):
  count = 0
  if li[i+1] - li[i] > 0:
    count += 1
  if li[i+1] - li[i+2] > 0:
    count += 1
  if count == 1:
    ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

struct edge{
    ll to;
    ll cost;
};
struct node{
    ll cost;
    ll num;
    bool operator<( const node& right ) const {
        return cost == right.cost ? num < right.num : cost < right.cost;
    }
    bool operator>( const node& right ) const {
        return cost == right.cost ? num > right.num : cost > right.cost;
    }
};

void dijkstra(int s, vector<vector<edge>> G, vector<ll> &d){
    priority_queue<node, vector<node>, greater<node>> que;
    fill(ALL(d), INF);

    d[s] = 0;
    que.push(node{0, s});

    while(!que.empty()){
        node p = que.top(); que.pop();
        if(p.cost > d[p.num]) continue;
        
        for (edge e : G[p.num]){
            if(d[p.num] + e.cost >= d[e.to]) continue;
            d[e.to] = d[p.num] + e.cost;
            que.push(node{d[e.to], e.to});
        }
    }
}

int main(){
    ll N, M, S; cin >> N >> M >> S;
    ll U, V, A, B;
    
    vector<vector<edge>> G(2500*N);
    for (ll i = 0; i < M; i++) {
        cin >> U >> V >> A >> B;
        for (ll j = 0; j < 2500 - A; j++) {
            G[(U-1)*2500+A+j].push_back(edge{(V-1)*2500+j, B});
            G[(V-1)*2500+A+j].push_back(edge{(U-1)*2500+j, B});
        }
    }

    ll C, D;
    for (ll i = 0; i < N; i++) {
        cin >> C >> D;
        ll j = 0;
        for (; j < 2500 - C; j++) {
            G[i*2500 + j].push_back(edge{i*2500 + j + C, D});
        }
        for (; j < 2500; j++){
            G[i*2500 + j].push_back(edge{i*2500 + 2499, D});
        }
    }

    vector<ll> d(N*2500);
    if(S >= 2500) S = 2499;
    dijkstra(S, G, d);

    vector<ll> ans(N+1, INF);

    for (ll i = 2; i < N+1; i++) {
        for (ll j = 0; j < 2500; j++) {
            ans[i] = min(ans[i], d[(i-1)*2500 + j]);
        }
        printf("%lld\n", ans[i]);
    }


    

}


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

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

int par[100001], e[100001], v[100000];
int cnt[100001];
char op[100000];

int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
}

void unite(int x, int y) {
    par[find(x)] = find(y);
}

int main(void) {
    int i, n, q;
    for (;;) {
        scanf("%d%d",&n,&q);
        if (n == 0 && q == 0) break;
        e[1] = 1;
        REP (i,2,n) scanf("%d\n",&e[i]);
        REP (i,1,n) par[i] = e[i];
        REP (i,q) {
            scanf("%c%d\n",&op[i],&v[i]);
            if (op[i] == 'M') {
                par[v[i]] = v[i];
                cnt[v[i]]++;
            }
        }
        ll ans = 0;
        RREP (i,q) {
            if (op[i] == 'M') {
                if (--cnt[v[i]] == 0)
                    unite(v[i],e[v[i]]);
            }
            else
                ans += find(v[i]);
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 4920
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    int N;
    cin >> N;
    long A[N];
    long sum = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        sum += A[i];
    }
    sort(A, A + N, greater<>());
    for(int i = 0; i < N; i++){
        sum -= A[i];
        if(sum * 2 < A[i]){
            cout << i + 1 << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 1024
n,d = map(int,input().split())

X=[]
for i in range(n):
    x=list(map(int,input().split()))
    X.append(x)

c=0
D2=[]
for i in range(n-1):
    for j in range(i+1,n):
        d2=0.0
        for k in range(d):
            d2 += (X[i][k]-X[j][k])**2
        D2.append(d2**0.5)
        if (d2**0.5)%1==0 :
            c+=1
print(c)


Measured memory_bytes: 9352
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <list>
#include <chrono>
#include <thread>
#include <cstring>

using namespace std;

//const bool debug = false;

#ifndef M_PI
    const double M_PI = acos(-1.0);
#endif // M_PI

#define y1 roman_kaban
#define rank oryshych_konb
#define ull unsigned long long
//#define ll long long
//const int mod = int(1e9) + 7;
//const int inf = 1e7;
//const long long infLL = 1e16;
//const int MX2 = 10100500; //  e7
//const long long INF = 1e18 + 0.5;
const int MX = 200500; //       e5
const int SZ = 20;

int a[MX];

int main()
{
    //vector<int> a;lower_bound(a.begin(), a.end());
    //brute(); return 0;
    ios_base::sync_with_stdio(false);
    //freopen("/Users/ozzy/Documents/in.txt","r", stdin);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a, a + n);
    if(a[0] == a[n - 1] && a[0] == n - 1) {cout << "Yes" << endl; return 0;}
    if(a[n - 1] - a[0] > 1) { cout << "No" << endl; return 0;}
    int x = 0;
    for(int  i = 0 ; i < n; i++){
        if(a[i] != a[n - 1]) x++;
    }
    int y = a[n - 1] - x;
    n -= x;
    if(2 * y > n || y <= 0){ cout << "No" << endl; return 0;}
    cout << "Yes" << endl;
    return 0;
}

// 19 + 15 == 10


Measured memory_bytes: 640
from itertools import product

a, b, c = list(map(int, input().split()))
aset = {(a * i) % b for i in range(0, b)}

TheNumberOfElementsIn_aset = 0

while TheNumberOfElementsIn_aset != len(aset):
    TheNumberOfElementsIn_aset = len(aset)
    for element1, element2 in product(aset, aset):
        aset.add((element1 + element2) % b)


if c in aset:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3060
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double l = sc.nextDouble();
        double a = l * l * l /27.0;
        BigDecimal ll = BigDecimal.valueOf(a);
        System.out.println(ll);
    }
}

Measured memory_bytes: 22868
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	p := make([]int, n)
	for i := range p {
		p[i] = nextInt()
	}

	ans := 0
	for i := 0; i < n; i++ {
		if p[i] != i+1 {
			continue
		}
		if i != n-1 && p[i+1] != i+1 {
			tmp := p[i+1]
			p[i+1] = p[i]
			p[i] = tmp
			ans++
		} else if i != 0 {
			tmp := p[i-1]
			p[i-1] = p[i]
			p[i] = tmp
			ans++
		}
	}
	fmt.Println(ans)
}

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, err := strconv.Atoi(next())
	if err != nil {
		fmt.Println(err)
	}
	return i
}


Measured memory_bytes: 1920
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main()
{
	int n,a=0,b=0;
	cin >> n;
	vi c(n);
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(c.rbegin(), c.rend());
	for (int i = 1; i <= n; i++) {
		if (i % 2 == 1) {
			a += c[i - 1];
		}
		else {
			b += c[i - 1];
		}
	}

	cout << a-b << endl;
	return 0;
}

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

using namespace std;

int main() {
    long long int x, k, d;
    cin >> x >> k >> d;

    long long int temp;
    temp = x / d;
    long long int a,b;

    if (x >= 0) {
        if (temp >= k) {
            cout << x - k * d;
        } else {
            if (temp % 2 == 0) {
                if (k % 2 == 0) {
                    cout << x - temp * d;
                } else {
                    cout << (temp + 1) * d - x;
                }
            } else {
                if (k % 2 == 0) {
                    cout << (temp + 1) * d - x;
                } else {
                    cout << x - temp * d;
                }
            }
        }
    } else {
        x = (-1) * x;
        temp = x / d;
        if (temp >= k) {
            cout << x - k * d;
        } else {
            if (temp % 2 == 0) {
                if (k % 2 == 0) {
                    cout << x - temp * d;
                } else {
                    cout << (temp + 1) * d - x;
                }
            } else {
                if (k % 2 == 0) {
                    cout << (temp + 1) * d - x;
                } else {
                    cout << x - temp * d;
                }
            }
        }
    }



    /*if (x > 0) {

        

        if (k / 2 == 0) {
            if (temp / 2 == 0) {
                a = temp * d;
                cout << abs(a - x);
            } else {
                a = (temp - 1) * d;
                b = (temp + 1) * d;
                if (abs(a - x) < abs(b - x)) {
                    cout << abs(a - x);
                } else {
                    cout << abs(b - x);
                }
            }
        } else {
            if (temp / 2 == 0) {
                a = (temp - 1) * d;
                b = (temp + 1) * d;
                if (abs(a - x) < abs(b - x)) {
                    cout << abs(a - x);
                } else {
                    cout << abs(b - x);
                }
            } else {
                a = temp * d;
                cout << abs(a - x);
            }
        }
    }*/

    

    return 0;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstring>
#define R register
#define EN std::puts("")
#define LL long long
inline int read(){
	int x=0,y=1;
	char c=std::getchar();
	while(c<'0'||c>'9'){if(c=='-') y=0;c=std::getchar();}
	while(c>='0'&&c<='9'){x=x*10+(c^48);c=std::getchar();}
	return y?x:-x;
}
int n;
int main(){
	int a=read(),b=read(),c=read();
	if(a==b){
		if(c!=a) return std::puts("Yes"),0;
	}
	if(a==c){
		if(b!=a) return std::puts("Yes"),0;
	}
	if(b==c){
		if(a!=b) return std::puts("Yes"),0;
	}
	std::puts("No");
	return 0;
}


Measured memory_bytes: 256
var N = 0
var K = 0

fun main(args:Array<String>){
    val input = readLine()!!.split(" ")
    N = input[0].toInt()
    K = input[1].toInt()

    var a: Long = 0
    var b: Long = 0
    for (i in 1..N) {
        if (i*2%K == 0) {
            if (i%K == 0) a++
            else b++
        }
    }

    println(a*a*a + b*b*b)
}

Measured memory_bytes: 37900
#include <bits/stdc++.h>
#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()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll number;
    cin >> number;
    if (number >= 1 && number <= 999) {
        cout << "ABC" << endl;
        return 0;
    } else {
        cout << "ABD" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int arr[100005][3];
int dp[1000005][3];
int main(){
    cin >> n;
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < 3 ; j++)
            cin >> arr[i][j];
    dp[0][0] = arr[0][0];
    dp[0][1] = arr[0][1];
    dp[0][2] = arr[0][2];

    for(int i = 1 ; i < n ; i++){
        dp[i][0] = max(dp[i-1][1] + arr[i][0] , dp[i-1][2] + arr[i][0]);
        dp[i][1] = max(dp[i-1][0] + arr[i][1] , dp[i-1][2] + arr[i][1]);
        dp[i][2] = max(dp[i-1][0] + arr[i][2] , dp[i-1][1] + arr[i][2]);
    }
    cout<<max(dp[n-1][0] , max(dp[n-1][1] , dp[n-1][2]));
}


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

int cal_digit(int N, int K){
  int count = 0;
  while(N >0){
    N /= K;
    count++;
  }
  return count;
}

int main(){
  int n,k;
  cin >> n >> k;
  cout << cal_digit(n,k) << endl;
}

Measured memory_bytes: 3556
N = int(input())
h = list(map(int, input().split()))

INF = 10 ** 10
dp = [INF] * 100010

dp[0] = 0
for i in range(1, N):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i >= 2:
        dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[N-1])

Measured memory_bytes: 13928
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int N,D,X;
	vector<int> A;
	cin >> N >> D >> X;
	A.resize(N);
	for(int i=0;i<N;i++) cin >> A[i];
	
	int tot = X;
	for(int i=0;i<N;i++){
		tot += (D - 1) / A[i] + 1;
	}
	cout << tot << endl;
	
	
	
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    long long a, b, c;

    scanf("%lld %lld %lld", &a, &b, &c);

    long long v = c - a - b;

    if (v > 0 && v * v - 4 * a * b > 0) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<math.h>
#include<vector>
#include <iostream>
//#include <algorithm>
#include <limits>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
int H,W;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
vector<vector<char>> maze;
vector<vector<ll>> dp;
/*void printdp(int N,ll Vmax){
	rep(i,N+1){
		for(ll j=0;j<Vmax+1;j++){
			if(dp[i][j]==llMAX)continue;
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;
	return;
}*/
ll culc(int x,int y){
	if(dp[y][x]!=-1){
		return dp[y][x];
	}
	ll score = 0;
	if(x==W-1&&y==H-1){
		return 1;
	}
	if(x<W-1){
		if(maze[y][x+1]=='.'){
			score += culc(x+1,y);
		}
	}
	if(y<H-1){
		if(maze[y+1][x]=='.'){
			score += culc(x,y+1);
		}
	} 
	score%=1000000007;
	dp[y][x] = score; 
	//cout << x << " " << y << " " <<score << endl;
	return score;
}
int main(void){
	int m=0;
	int M;
	int i,k;
	int j;
	cin >> H>>W;
	maze=vector<vector<char>>(H,vector<char>(W,' '));
	dp=vector<vector<long long>>(H,vector<long long>(W,-1));
	rep(i,H){
		rep(j,W){
			cin >> maze[i][j];
		}
	}
	culc(0,0);
	if(dp[0][0]==-1){
		cout << 0;
	}else{
		cout << dp[0][0]%1000000007;
	}
	return 0;
}

Measured memory_bytes: 9216