akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

string str;

bool check(string s){
	int n = str.size();
	rep(i, s.size()){
		int prv = (i-1+n)%n, nxt = (i+1)%n;
		if(s[i] == 'S'){
			if(str[i] == 'o') {
				if(s[prv] != s[nxt]) return false;
			}
			else{
				if(s[prv] == s[nxt]) return false;
			}
		}
		else{
			if(str[i] == 'o') {
				if(s[prv] == s[nxt]) return false;
			}
			else{
				if(s[prv] != s[nxt]) return false;
			}
		}
	}
	return true;
}

// string makestr(string s, int n){
// 	if(n -1 == str.size()) return s;
// 	if(s[i] == 'S') s[i+1] = s[i-1];
// 	else s[i+1] = (s[i-1] == 'S'?'W':'S');
// 	return makestr(s, n+1);
// }

int main(){
	int n;
	cin>>n;
	cin>>str;
	string s(n, 'X');
	s[0] = 'S';
	s[1] = 'S';
	for(int i = 1; i < n-1; i++){
		if(s[i] == 'S') {
			if(str[i] == 'o')s[i+1] = s[i-1]; else s[i+1] = (s[i-1] == 'S'?'W':'S');
		}
		else {
			if(str[i] == 'o') s[i+1] = (s[i-1] == 'S'?'W':'S'); else s[i+1] = s[i-1];
		}
	}
	if(check(s)){
		cout<<s<<endl;
		return 0;
	}


	s[1] = 'W';
	for(int i = 1; i < n-1; i++){
		if(s[i] == 'S') {
			if(str[i] == 'o')s[i+1] = s[i-1]; else s[i+1] = (s[i-1] == 'S'?'W':'S');
		}
		else {
			if(str[i] == 'o') s[i+1] = (s[i-1] == 'S'?'W':'S'); else s[i+1] = s[i-1];
		}
	}
	if(check(s)){
		cout<<s<<endl;
		return 0;
	}


	s[0] = 'W';
	s[1] = 'S';
	for(int i = 1; i < n-1; i++){
		if(s[i] == 'S') {
			if(str[i] == 'o')s[i+1] = s[i-1]; else s[i+1] = (s[i-1] == 'S'?'W':'S');
		}
		else {
			if(str[i] == 'o') s[i+1] = (s[i-1] == 'S'?'W':'S'); else s[i+1] = s[i-1];
		}
	}
	if(check(s)){
		cout<<s<<endl;
		return 0;
	}
	s[1] = 'W';
	for(int i = 1; i < n-1; i++){
		if(s[i] == 'S') {
			if(str[i] == 'o')s[i+1] = s[i-1]; else s[i+1] = (s[i-1] == 'S'?'W':'S');
		}
		else {
			if(str[i] == 'o') s[i+1] = (s[i-1] == 'S'?'W':'S'); else s[i+1] = s[i-1];
		}
	}
	if(check(s)){
		cout<<s<<endl;
		return 0;
	}
	cout<<-1<<endl;

}


Measured memory_bytes: 640
def divisors(n):
  ret=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      ret.append(i)
      if n//i!=i:
        ret.append(n//i)
  return ret

n = int(input())
ans = len(divisors(n-1)) - 1 

for d in divisors(n)[1:]:
  tmp = n
  while tmp%d == 0:
    tmp = tmp//d
  if tmp%d == 1:
    ans += 1
  
print(ans)

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

void solve() 
{
    int n;cin>>n;
    string s;cin>>s;
    int cnt=0,l=0,r=n-1;
    while(1){
        while(s[l]!='W'&&l<r)l++;
        while(s[r]!='R'&&l<r)r--;
        // cout<<l<<" "<<r<<endl;
        if(l>=r)break;
        cnt++;l++;r--;
    }
    cout<<cnt<<endl;
}

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

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
int n;
int arr[maxn];
int js[maxn];
int ans[maxn];
int jl[maxn];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&arr[i]);
    for(int i=n;i>=1;i--){
        int t=0;
        for(int j=i;j<=n;j+=i)t+=jl[j];
        if(t%2==0){
            if(arr[i]==0){
                ans[i]=0;
            }else {
                ans[i]=1;
            }
        }
        else{
            if(arr[i]==0){
                ans[i]=1;
            }else {
                ans[i]=0;
            }
        }
        if(ans[i]==1)jl[i]+=1;
    }
    int tot=0;
    for(int i=1;i<=n;i++)if(ans[i]==1)jl[++tot]=i;
    printf("%d\n",tot);
    for(int i=1;i<=tot;i++){
        printf("%d%c",jl[i],i==tot?'\n':' ');
    }

}


Measured memory_bytes: 3200
import sys

def main():
    K,X = [int(i) for i in sys.stdin.readline().strip().split()]
    MIN = -1000000
    MAX = 1000000
    start = max(X - (K -1), MIN)
    end = min(MAX, X + (K - 1))
    print(" ".join([str(i) for i in range(start, end+1)]))
        


def solve():
    pass


if __name__ == "__main__":
    main()

Measured memory_bytes: 38384
/*
       Hi there <3 
──────▄▀▄─────▄▀▄
─────▄█░░▀▀▀▀▀░░█▄
─▄▄──█░░░░░░░░░░░█──▄▄
█▄▄█─█░░▀░░┬░░▀░░█─█▄▄█

*/
#include <bits/stdc++.h>
#define MOD 1000000007
#define re return
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repa(i, a, n) for (int i = a; i < n; i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rrepa(i, a, n) for (int i = n; i >= a; i--)
#define fill(x, y) memset(x, y, sizeof(x))
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(abs(x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define ba back()
#define popcount __builtin_popcountll
#define fastIO()                 \
    {                            \
        ios::sync_with_stdio(0); \
        cin.tie(0);              \
        cout.tie(0);             \
    }
#define in(x) \
    int x;    \
    cin >> x;
#define in1(x) \
    int x;     \
    cin >> x;  \
    x--;
#define inll(x) \
    ll x;       \
    cin >> x;
#define ins(x) \
    string x;  \
    cin >> x;

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef pair<double, double> pdd;
typedef long double LD;
typedef double D;

void Solve()
{
    int n;
    cin >> n;
    vi v(n);
    //map<int, int> m;
    rep(i, n)
    {
        cin >> v[i];
        //m[i]++;
    }
    sort(all(v), greater<int>());
    ll total = v[0];
    
    total=v[0];
    int j=1;
    for(int i=1; i<n-1;i++)
    {
        total+=v[j];
        if(i%2==0)
            j++;
        
    }
    
    
    
    cout << total << endl;
}

int main()
{
    fastIO();
    int t;
    t = 1;
    while (t--)
    {
        Solve();
    }
    return 0;
}

Measured memory_bytes: 3988
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd
#define mod 100000007
#define INF 1e9
/****************************/
int main()
{
	int n;
	int k;
	cin>>n>>k;
	ll ans=0;
	while(n)
	{
		ans++;
		n/=k;
	}
	cout<<ans;
	return 0;
}

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

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,x;
    cin>>n>>m>>x;
    int ans1,ans2;
    ans1=ans2=0;
    for(int i=0;i<m;i++)
    {
        int a;
        cin>>a;
        if(a<x)
        ans1++;
        else
        ans2++;
    }
    cout<<min(ans1,ans2)<<"\n";

    
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    int n,k,temp;
    cin>>n>>k;
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        cin>>temp;
        v.push_back(temp);
    }
    sort(v.begin(),v.end());
    vector<bool>dp(k+1,false);
    for(int i=1;i<=k;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(v[j]>i)
            {
                break;
            }
            if(dp[i-v[j]]==false)
            {
                dp[i]=true;
                break;
            }
        }
    }
    if(dp[k])
    {
        cout<<"First"<<endl;
    }
    else
    {
        cout<<"Second"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Numeric

main = do
	[a,b] <- map (read::String->Integer) . words <$> getLine
	putStrLn $ show (a`div`b) ++ " " ++ show (a`mod`b) ++ " " ++ (showFFloat (Just 6) ((fromIntegral(a::Integer))/(fromIntegral(b::Integer))) "")

Measured memory_bytes: 3920
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*-
// ALDS1_2-A: Bubble Sort

#include <algorithm>
#include <iostream>

static void print_ints(const int as[], const unsigned int n)
{
  auto sep = "";
  for (auto i = 0u; i < n; ++i) {
    std::cout << sep << as[i];
    sep = " ";
  }
  std::cout << std::endl;
}

static void print_int(const unsigned int n)
{
  std::cout << n << std::endl;
}

static unsigned int swap_count = 0u;

static void swap(int& a, int& b)
{
  ++swap_count;
  std::swap(a, b);
}

static void bubble_sort(int as[], const unsigned int n)
{
  for (auto j = 0u; j < n-1; ++j) {
    for (auto i = n-1; i > j; --i) {
      if (as[i] < as[i-1]) {
        swap(as[i], as[i-1]);
      }
    }
  }
}

int main()
{
  unsigned int n;
  std::cin >> n;
  int as[n];
  for (auto i = 0u; i < n; ++i) {
    std::cin >> as[i];
  }

  bubble_sort(as, n);
  print_ints(as, n);
  print_int(swap_count);
}

// eof

Measured memory_bytes: 3084
s = gets.chomp.chars
if s.size % 2 === 0
  center_idx = s.size / 2 - 1
else
  center_idx = s.size / 2
end

n = s.size - 1
arr = []
while center_idx < n
  arr << s[n]
  n -= 1
end
res = 0
s[0..center_idx].zip(arr).each do |front, back|
  res += 1 if front === back
end
puts arr.count - res


Measured memory_bytes: 1788
while (n = readline.chomp!.to_i) != 0
  a = b = 0 
  n.times do
    n1, n2 = readline.split(" ").map {|x| x.to_i}
    if n1 > n2
      a += n1 + n2
    elsif n1 == n2
      a += n1
      b += n2
    else
      b += n1 + n2
    end 
  end 
  puts a.to_s + " " + b.to_s
end

Measured memory_bytes: 6008
#include <bits/stdc++.h>
using namespace std;
 
#define int long long int
#define ld long double
#define mod 1000000007 
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define forn(i,s, e) for (int i = s; i <= e; i++)
#define fornd(i,s, e) for (int i = s ; i >= e; i--)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define print(x) for(auto el: x) cout<<el<<" ";cout<<"\n"
#define PSET(x,y) fixed<<setprecision(y)<<x
// #define bits(x) __builtin_popcount(x)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
void fileio()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
 

 
template <typename T> 
void swap(T& a, T& b){
    T temp = a;
    a = b;
    b = temp;
}

const int N = 100001; 

// int dp[101][N];

ld dp[3000][3000];

void solve(){
    int n;
    cin>>n;

    ld* p = new ld[n];

    forn(i,0,n-1)
        cin>>p[i];

    dp[1][0] = 1-p[0];
    dp[1][1] = p[0];
    dp[0][0] = 1;
    dp[0][1] = 0;

    for(int i=2;i<=n;i++){

        dp[i][0] = dp[i-1][0]*(1-p[i-1]);
        for(int j=1;j<i;j++){
            dp[i][j] = dp[i-1][j]*(1-p[i-1]) + dp[i-1][j-1]*p[i-1]  ;
            // dp[i][j+1] = dp[i-1][j]*p[i-1];
        }
        dp[i][i] = dp[i-1][i-1]*p[i-1];
    }

    ld ans = 0;

    for(int i=n/2 +1 ;i<=n;i++){
        ans += dp[n][i];
    }
    cout<<PSET(ans,10)<<endl;

}
 
int32_t main()
{
    fast;
    // int t;
    // cin>>t;
    // for(int y=1;y<=t;y++)
    {
        // cout<<"Case #"<<y<<": ";
        solve();
    }
    return 0;
} 

Measured memory_bytes: 139136
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> pll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define pb push_back
const ll mod = 1000000007;
const ll MAX_N = 510;

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

	vvl X(MAX_N, vl(MAX_N));
	rep(i, m) {
		ll l, r;
		cin >> l >> r;
        X[l][r]++;
	}

	vvl C(MAX_N, vl(MAX_N));
	exrep(i, 1, n) {
		exrep(j, 1, n) {
            C[i][j] = C[i][j-1] + X[i][j];
        }
	}
	
	rep(loop, Q) {
		ll p, q; 
        cin >> p >> q;
		ll ans = 0;
		exrep(i, p, q) { 
            ans += C[i][q] - C[i][p-1];
        }
		out(ans);
	}

	return 0;
}

Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>
#include<queue>
#include<deque>
#include<fstream>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vp vector<pair<ll, ll> >
#define vvp vector<vector<pair<ll, ll> > >
#define First first
#define Second second.first
#define Third second.second
//#define MOD 998244353
#define MAX 100000

typedef long long int ll;
typedef unsigned long long int ull;

using namespace std;

template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return true; } return false; }




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

	ll N;
	cin >> N;

	vl A(N);
	rep(i, N) {
		cin >> A[i];
	}

	ll m = *max_element(A.begin(), A.end());
	ll mnum = max_element(A.begin(), A.end()) - A.begin();

	A.erase(A.begin() + mnum);

	ll m2 = *max_element(A.begin(), A.end());

	rep(i, N) {
		if (i == mnum) {
			cout << m2 << endl;
		}
		else {
			cout << m << endl;
		}
	}


	return 0;
}



Measured memory_bytes: 3200
import java.util.Scanner;

class Main {

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

        int x = scan.nextInt();
        int i = 1;
        while (x != 0) {

            System.out.println("Case " + i + ": " + x);
            x = scan.nextInt();
            i++;
        }
    }

}


Measured memory_bytes: 42444
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
typedef long long int ll;
int main(void){
    ll n ;
    cin >> n ;
    ll b[n] ;
    for(int i = 0 ; i < n ; i++ ){
        cin >> b[i] ;
    }

    sort(b , b + n ) ;

    ll ans ;
    ans = b[(n /2 ) ] - b[( n / 2 ) - 1 ] ;
    
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1024
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data',function(line){
	before(line);
});

var log = console.log;
function before(line){
	var lines = line.split("\n");
	lines = lines.filter(function(e){
		return (e !== "");
	});
	main(lines);
}

//-----------
function main(lines){
	var ls = lines.map(function(e){return Number(e);});
	while(ls.length > 1){
		var tpl = ls.shift();
		var arr = ls.slice(0,tpl);
		ls = ls.slice(tpl);
		var mid = arr.indexOf(Math.min.apply(this,arr));
		arr.splice(mid,1);
		var Mid = arr.indexOf(Math.max.apply(this,arr));
		arr.splice(Mid,1);
		var sum = arr.reduce(function(p,c,i,a){return p+c;});
		log(Math.floor(sum/arr.length));
	}
}

Measured memory_bytes: 16284
//url:
//problem name: 

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

const int MOD = 1000000007;

ll modkaijou(int a) {
    ll ans = 1;
    for(int i = 1; i <= a; i++) {
        ans *= i;
        ans %= MOD;
    }
    return ans;
}

int main() {
    int N,M;
    cin >> N >> M;
    if(abs(N-M) > 1) cout << 0 << endl;
    else if(abs(N-M) == 0) cout <<  2 * modkaijou(N) * modkaijou(M) % MOD << endl;
    else cout << modkaijou(N) * modkaijou(M) % MOD << endl;
}


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



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	int H,W,h,w;
	scanf("%d %d", &H, &W);
	scanf("%d %d", &h, &w);

	printf("%d\n", (H-h)*(W-w));


	return 0;

}


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

int main(){
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    auto res = unique(s.begin(), s.end());
    s.resize(distance(s.begin(), res));
    cout << s.size() << "\n";
    return 0;
}


Measured memory_bytes: 512
//
// Created by maze on 2019/09/15.
//

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

#define INF_LL (int64)1e18
#define INF (int64)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a); i < (b); i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int32_t;
using int64 = int64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

int main(void) {
    string S;
    cin >> S;
    if (S == "Sunny") {
        cout << "Cloudy" << endl;
    } else if (S == "Cloudy") {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long int ll;
ll digitsum(ll n){
  ll sum=0;
  while(1){
    if(n==0) break;
    sum+=(n%10);
    n/=10;
  }
  return sum;
}
int main(){
  ll n;
  cin >>n;
  ll ans=10000000000;
  for(ll i=1;i<=n/2;i++){
   ll sum=digitsum(i);
   ll sum1=digitsum(n-i);
   ans=min(sum+sum1,ans);
  }
  cout <<ans<<endl;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long v = 7;
		int cnt = 1;
		for(int i=0;i<K + 10; i++){
			if(v % K == 0){
				Console.WriteLine(cnt);
				return;
			}
			v *= 10;
			v += 7;
			v %= K;
			cnt++;
		}
		Console.WriteLine(-1);
		
	}
	long K;
	public Sol(){
		K = rl();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 27500
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
/*        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);*/
//        int b = int.Parse(input[2]);
//        string temp = ReadLine();
        int a = int.Parse(ReadLine());
        int b = int.Parse(ReadLine());
        WriteLine(a*a-b);
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

int main() {
	int x, y, z;
	cin >> x >> y >> z;
	if (x % (y + z) >= z) cout << x / (y + z) << endl;
	else cout << x / (y + z) - 1 << endl;
}

Measured memory_bytes: 256
from collections import deque

def bfs(graph, n, s):
  visited = [0]*n
  visited[s] = 1
  q = deque([s])
  while q:
    node = q.popleft()
    for i in graph[node]:
      if not visited[i]:
        visited[i] = node + 1
        q.append(i)
  return visited

n,m = map(int, input().split())
graph = [[] for _ in range(n)]
for _ in range(m):
  a,b = map(lambda n: int(n)-1, input().split())
  graph[a].append(b)
  graph[b].append(a)
visited = bfs(graph, n, 0)[1:]
if all(visited):
  print("Yes")
  print(*visited, sep="\n")
else:
  print("No")


Measured memory_bytes: 38156
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for(int i = 0; i < N; i++){
    cin >> P[i];
  }
  int ans = 0;
  int curMin = 1e9;
  for(int i = 0; i < N; i++){
    curMin = min(curMin, P[i]);
    if(curMin == P[i]){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a%3==0 || b%3==0||(a+b)%3==0) {
            System.out.println("Possible");
        }else {
            System.out.println("Impossible");
        }
    }
}

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

constexpr long long mod{1000000007};

long long fac[200000], finv[200000], inv[200000];

void init_combi();
long long combi(long long, long long);

int main()
{
	init_combi();
	int h, w, a, b;
	scanf("%d%d%d%d", &h, &w, &a, &b);
	long long ans{};
	for (int i = 0; i < h - a; i++)
	{
		long long tmp = combi(i + b - 1, b - 1) * combi(h - i - 1 + w - b - 1, w - b - 1) % mod;
		ans = (ans + tmp) % mod;
	}
	
	printf("%lld\n", ans);

	return 0;
}

void init_combi()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < 200000; i++)
	{
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

long long combi(long long n, long long r)
{
	if (n < r) return 0;
	if (n < 0 || r < 0) return 0;
	return fac[n] * finv[r] % mod * finv[n - r] % mod;
}

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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long n,i,w = 0;
	vector <long long> v;
	cin >> n;
	for (i=0;i<n;i++)
	{
	    cin >> w;
	    v.push_back(w);
	}
	w = 0;
	for (i=1;i<n;i++)
	{
	    if (v[i] < v[i-1])
	    {
	        w += (v[i-1]-v[i]);
	        v[i] = v[i-1];
	    }
	}
	cout << w;
	return 0;
}


Measured memory_bytes: 5312
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

s = S()
t = S()
if s == t[:-1]:
    print('Yes')
else:
    print('No')


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

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    if (a > b || (n == 1 && a != b)) cout << 0 << endl;
    else if (n <= 2) cout << 1 << endl;
    else cout << (b * (n - 1ll) + a) - (b + a * (n - 1ll)) + 1 << endl;
}


Measured memory_bytes: 256
//This is getting accepted!
#include<bits/stdc++.h>
#define ll long long
#define oo 1000000009
#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define INARR(a,n) for (int i = 1; i <= (n); ++i) cin >> a[i];
#define ITE(x) for(auto it = (x).begin(); it != (x).end(); ++it)
#define isset(x, i) (((x)>>(i))&1)
#define setbit(x, i) ((x)^(1ll<<(i)))
#define clearbit(x, i) ((x)&(~(1ll<<(i))))
#define twoexp(i) (1ll<<(i))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define FI first
#define SE second
#define son1 (id*2)
#define son2 (id*2+1)

using namespace std;

const int MOD = 1000000007;
const double EPS = 1e-8;
const double PI = 2 * acos(0);
const int MAXN = 1e6 + 6;

int n;
ll a[MAXN], b[MAXN];

void input() {
	int u, v, w, x, y, qtype;
	
	cin >> n;
	INARR(a, n+1);
	INARR(b, n);
	
}


void preprocess() {
	
	
	
}

void process(int itest) {
	int u, v, w, x, y, qtype;
	
	ll res = 0;
	
	FOR(i, 1, n) {
		ll kill = MIN(a[i], b[i]);
		res += kill;
		
		a[i] -= kill;
		b[i] -= kill;
		
		kill = MIN(a[i+1], b[i]);
		res += kill;
		a[i+1] -= kill;
		
	}
	
	cout << res << endl;
	
}

void oneTest() {
	
	input();
	preprocess();
	process(0);
	
}

void multiTest() {
	
	int t;
	cin >> t;
	
	for (int it = 1; it <= t; ++it) {
		input();
		preprocess();
		process(it);
	}
}

int main(){
    #ifndef ONLINE_JUDGE
//    freopen("../out.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	oneTest();
//	multiTest();

    return 0;

}


Measured memory_bytes: 5120
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner in = new Scanner(System.in);
	Dice dice = new Dice(); 
	for(int i=1;i<=6;i++){
	    dice.putNum(in.nextInt(),i);
	}
	dice.top=dice.num1;
	

        String str = in.next();
	for(int i=0;i<str.length();i++){
	    char order = str.charAt(i);
	    if(order == 'E')dice.moveDice('E');
	    else if(order == 'W')dice.moveDice('W');
	    else if(order == 'N')dice.moveDice('N');
	    else if(order == 'S')dice.moveDice('S');
	}
    
       
	System.out.println(dice.returnTop());
    }
}

class Dice{
    int  num1,num2,num3,num4,num5,num6;
    int tmp,top;
    Dice(){}
	
    public void putNum(int num,int i){
	if(i == 1)this.num1=num;
	else if(i == 2)this.num2=num;
	else if(i == 3)this.num3=num;
	else if(i == 4)this.num4=num;
	else if(i == 5)this.num5=num;
	else if(i == 6)this.num6=num;
    }
    
    public void moveDice(char order){
	if(order == 'W'){
	    this.tmp = this.num1;
	    this.num1 = this.num3;
	    this.num3 = this.num6;
	    this.num6 = this.num4;
	    this.num4 = this.tmp;
	    this.top = this.num1;
	}else if(order == 'E'){
	    this.tmp = this.num1;
	    this.num1 = this.num4;
	    this.num4 = this.num6;
	    this.num6 = this.num3;
	    this.num3 = this.tmp;
	    this.top = this.num1;
	}else if(order == 'N'){
	    this.tmp = this.num1;
	    this.num1 = this.num2;
	    this.num2 = this.num6;
	    this.num6 = this.num5;
	    this.num5 = this.tmp;
	    this.top = this.num1;
	}else if(order == 'S'){
	    this.tmp = this.num1;
	    this.num1 = this.num5;
	    this.num5 = this.num6;
	    this.num6 = this.num2;
	    this.num2 = this.tmp;
	    this.top = this.num1;
	}
    }
    public int returnTop(){
	return this.top;
    }

}
	
    	




Measured memory_bytes: 26440
// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;
 
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int dp[100005][3];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    rep1(i, n) {
        int a, b, c; cin >> a >> b >> c;
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a;
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b;
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c;
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
}



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(ll x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class T>bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

vll dp(100010, INF);

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, k;
    cin >> n >> k;
    vll h(n);
    rep(i, n){
        cin >> h[i];
    }
    dp[0] = 0;
    repr(i, 1, n){
        repr(j, 1, k+1){
            if(i-j<0) continue;
            chmin(dp[i], dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T =  input()
ans = 0
for k in range(K):
  for i in range(k,N,K):
    if i ==k:
      prv_t = T[i]
      prv_t_num = 1
    else:
      if prv_t != T[i]:
        if prv_t_num == 1:
          ans += R if prv_t=='s' else S if prv_t=='p' else P
        else:
          ans += R*(prv_t_num//2+prv_t_num%2) if prv_t=='s' else S*(prv_t_num//2+prv_t_num%2) if prv_t=='p' else P*(prv_t_num//2+prv_t_num%2)
        prv_t = T[i]
        prv_t_num = 1
      else:
        prv_t_num += 1
     
  if prv_t_num == 1:
    ans += R if prv_t=='s' else S if prv_t=='p' else P
  else:
    ans += R*(prv_t_num//2+prv_t_num%2) if prv_t=='s' else S*(prv_t_num//2+prv_t_num%2) if prv_t=='p' else P*(prv_t_num//2+prv_t_num%2)
print(ans)

Measured memory_bytes: 43632
n, B = list(input().split())
n, B=int(n), int(B)
xs =input()
b = None
c = 1
r=0
for x in xs:
    if b==None:
        b=x
        continue
    if x == b:
        c += 1
        continue
    r+=(c-1)
    c = 1
    b=x
r+=(c-1)
print(min(r+(B*2), n-1))


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D) cout << "Left" << endl;
  else if (A + B == C + D) cout << "Balanced" << endl;
  else cout << "Right" << endl;
}

Measured memory_bytes: 3616
import itertools
import numpy as np
N,M,X=map(int,input().split())

CA=[list(map(int, input().split())) for i in range(int(N))]
CA_low_cost=float('inf')
for i in range(N):
    CA_comb=list(itertools.combinations(CA,N-i))
    for comb in CA_comb:
        comb_ls=np.array(comb)
        comb_sum=np.sum(comb_ls,axis=0)
        if list(filter(lambda x:x<X ,comb_sum[1:]))==[]:
            if CA_low_cost>comb_sum[0]:
                CA_low_cost=comb_sum[0]
if CA_low_cost==float('inf'):
    print(-1)
else:
    print(CA_low_cost)

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long long LL;
#define REP(i,N) for (int i=0; i<N; i++)

int main() {
  int A, B;
  cin >> A >> B;
  if (A + B >= 10) cout << "error" << endl;
  else cout << A + B << endl;
  return 0;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

int main() {
    ll N, K;
    cin >> N >> K;

    int ans = 0;
    while (N > 0) {
        N /= K;
        ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3620
n,m=map(int,input().split())
import heapq
c=[[] for _ in range(m+1)]
for i in range(n):
  a,b=map(int,input().split())
  if a<=m:
        c[a].append(-b)
  
q=[]
ans=0
for i in range(1,m+1):
  for j in c[i]:
    heapq.heappush(q,j)
  if q:
    ans-=heapq.heappop(q)
print(ans)

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define out(a) cout << a << endl
#define PI 3.14159265359
using namespace std;
typedef long long ll;

int main() {
    int R;
    cin >> R;
    out(2*PI*R);
}




Measured memory_bytes: 3784
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int f(int n, int b) {
    int s = 0;
    while (n) {
        s += n % b;
        n /= b;
    }
    return s;
}

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

    int r = 1 << 30;
    for (int i = 0; i <= n; i++) {
        r = min(r, f(i, 6) + f(n - i, 9));
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int maxN = 2 * (int)1e5 + 100;
int n;
vector < int > poly_mult(vector < int > a, vector < int > b) {
    vector < int > c(n);
    for (int i = 0; i < n; i++) {
        c[i] = a[b[i]];
    }
    return c;
}
vector < int > inv(vector < int > a) {
    vector < int > c(n);
    for (int i = 0; i < n; i++) {
        c[a[i]] = i;
    }
    return c;
}
vector < int > pw(vector < int > a, int k) {
    vector < int > ans(n);
    if (k == 0) {
        for (int i = 0; i < n; i++) ans[i] = i;
        return ans;
    }
    if (k == 1) return a;
    if (k & 1) return poly_mult(a, pw(a, k - 1));
    auto t = pw(a, k / 2);
    return poly_mult(t, t);
}
int k;
void print(vector < int > p) {
    for (int v : p) cout << v + 1 << " ";
    exit(0);
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    cin >> n >> k;
    vector < int > p(n), q(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    for (int i = 0; i < n; i++) {
        cin >> q[i];
        q[i]--;
    }
    while (k % 6 != 1) {
        auto t1 = poly_mult(q, inv(p));
        auto t2 = q;
        q = t1;
        p = t2;
        k--;
    }
    if (k == 1) {
        print(p);
    }
    auto pp = p;
    auto qq = q;
    for (int i = 0; i < 2; i++) {
        auto t = poly_mult(qq, inv(pp));
        pp = qq;
        qq = t;
    }
    // a[4] = qq;
    auto T = poly_mult(qq, p);
    auto T1 = pw(T, k / 6);
    auto T2 = pw(inv(T), k / 6);
    print(poly_mult(T1, poly_mult(p, T2)));
    return 0;
}


Measured memory_bytes: 37352
# Yesが出力される時(すなわちビンゴ達成のパターン)
# a[0],a[1],a[2] == 0
# a.transpose[0],a.transpose[1],a.transpose[2] ==  0
# a[0][0]+a[1][1]+a[2][2],a[0][2]+a[1][1]+a[2][0] == 0

a = 3.times.map{gets.split.map(&:to_i)}
n = gets.to_i
b = n.times.map{gets.to_i}

c = []
c2 = []
c << a[0][0]
c << a[1][1]
c << a[2][2]
c2 << a[0][2]
c2 << a[1][1]
c2 << a[2][0]

puts (a[0] - b).size == 0 || (a[1] - b).size == 0 || (a[2] - b).size == 0 ||
  (a.transpose[0] - b).size == 0 || (a.transpose[1] - b).size == 0 || (a.transpose[2] - b).size == 0 ||
  (c - b).size == 0 || (c2 - b).size == 0 ? 'Yes':'No'

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

int main(){
    int d;
    cin >> d;
    if(d==22){
        cout << "Christmas Eve Eve Eve" << endl;
    }
    if(d==23){
        cout << "Christmas Eve Eve" << endl;
    }
    if(d==24){
        cout << "Christmas Eve" << endl;
    }
    if(d==25){
        cout << "Christmas" << endl;
    }
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

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

const int INF = 1001001001;

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    
    if(A % 2 != 0 || B % 2 != 0 || C % 2 != 0){
        cout << 0 << endl;
        return 0;
    }
    if(A == B == C){
        cout << -1 << endl;
        return 0;
    }
    
    int cnt = 0;
    for(int i = 0; i < 50; ++i){
        int a = A / 2;
        int b = B / 2;
        int c = C / 2;
        
        A = a + b;
        B = b + c;
        C = c + a;
        cnt++;
        
        if(A % 2 != 0 || B % 2 != 0 || C % 2 != 0){
            cout << cnt << endl;
            return 0;
        }
    }
    
    cout << -1 << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	int n = tmp[0], w = tmp[1];

	int nw0 = 0, nw1 = 0, nw2 = 0, nw3 = 0;
	long[] vs0 = new long[n];
	long[] vs1 = new long[n];
	long[] vs2 = new long[n];
	long[] vs3 = new long[n];

	tmp = ReadIntArray();
	long w1 = tmp[0], v1 = tmp[1];
	nw0++;
	vs0[0] = v1;

	for (int i = 1; i < n; i++)
	{
	    tmp = ReadIntArray();
	    int ww = tmp[0], vv = tmp[1];

	    if      (ww == w1 + 0) vs0[nw0++] = vv;
	    else if (ww == w1 + 1) vs1[nw1++] = vv;
	    else if (ww == w1 + 2) vs2[nw2++] = vv;
	    else                   vs3[nw3++] = vv; 
	}

	Array.Resize(ref vs0, nw0); 
	Array.Resize(ref vs1, nw1);
	Array.Resize(ref vs2, nw2);
	Array.Resize(ref vs3, nw3);

	Array.Sort(vs0); Array.Reverse(vs0);
	Array.Sort(vs1); Array.Reverse(vs1);
	Array.Sort(vs2); Array.Reverse(vs2);
	Array.Sort(vs3); Array.Reverse(vs3);

	for (int i = 1; i < vs0.Length; i++){ vs0[i] += vs0[i-1]; }
	for (int i = 1; i < vs1.Length; i++){ vs1[i] += vs1[i-1]; }
	for (int i = 1; i < vs2.Length; i++){ vs2[i] += vs2[i-1]; }
	for (int i = 1; i < vs3.Length; i++){ vs3[i] += vs3[i-1]; }

	long ans = 0;

	for (int i = 0; i <= Math.Min(n, vs0.Length); i++)
	{
	    for (int j = 0; j <= Math.Min(n - i, vs1.Length); j++)
	    {
		for (int k = 0; k <= Math.Min(n - i - j, vs2.Length); k++)
		{
		    for (int l = 0; l <= Math.Min(n - i - j - k, vs3.Length); l++)
		    {
			long weight =
			    w1 * i + (w1+1)*j + (w1+2)*k + (w1+3)*l;
			if (weight <= w)
			{
			    long value = 0;
			    if (i > 0) value += vs0[i-1];
			    if (j > 0) value += vs1[j-1];
			    if (k > 0) value += vs2[k-1];
			    if (l > 0) value += vs3[l-1];
			    ans = Math.Max(ans, value);
			}
		    }
		}
	    }
	}
	    
	WriteLine(ans);
    }
}
    


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    rep(i, N) cin >> p[i];
    sort(ALL(p));
    int ans = 0;
    rep(i, K) ans += p[i];
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;

#define PB push_back
#define MP make_pair

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    int a; cin >> a;
    cout << setprecision(100) << a + pow(a, 2) + pow(a, 3) << "\n";
}



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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol n; cin >> n;
    result = (n+1)*(n)/2;
    lol san = n/3;
    lol sann{0};
    lol gon{0};
    lol go = n/5;
    sann = (3*(san+1)*san)/2;
    FOR(i, 1, go)
    {
        if(i%3 != 0)
        {
            gon = gon + 5*i;
        }
    }
    result = result - gon - sann;

    cout << result << endl;
    return 0;
}

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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;
using strs = vector<string>;
int mlt(int &idx, int d);
int add(int &idx, int d);
int inum(int &idx, int d);
strs str;

int mlt(int &idx, int d){
	int ret = 1;
	for(; idx < str.size() && d < str[idx].size(); idx++){
		if(str[idx][d] == '*'){
			ret *= mlt(++idx, d+1);
			--idx;
		}
		else if(str[idx][d] == '+'){
			ret *= add(++idx, d+1);
			--idx;
		}
		else if(isdigit(str[idx][d])){
			ret *= inum(idx, d);
		}
		else{
			cout << idx << ":" << d << endl;
			assert(0);
		}
	}
	return ret;
}

int add(int &idx, int d){
	int ret = 0;
	for(; idx < str.size() && d < str[idx].size(); idx++){
//		cerr << idx << ":" << str[idx][d] << " ";
		if(str[idx][d] == '*'){
			ret += mlt(++idx, d+1);
			--idx;
		}
		else if(str[idx][d] == '+'){
			ret += add(++idx, d+1);
			--idx;
		}
		else if(isdigit(str[idx][d])){
			ret += inum(idx, d);
		}
		else{
			cout << idx << ":" << d << endl;
			assert(0);
		}
	}
	return ret;
}

int inum(int &idx, int d){
//	cerr << idx << ":" << d << endl;
//	cerr << str[idx].substr(d) << endl;
	return stoi(str[idx].substr(d));
}

signed main(){
	while(true){
		int n; cin >> n;
		if(n == 0)break;
		str = strs(n);
		for(auto &e : str)cin >> e;
		int idx = 0;
		cout << add(idx, 0) << endl;
//		cerr << "\n\n" << endl;
	}

	return 0;
}




Measured memory_bytes: 3172
#include <stdio.h>

int main(void)
{
	int a[30];
	int i, n;
	
	for (i = 0; i < 30; i++){
		a[i] = 0;
	}
	
	for (i = 0; i < 28; i++){
		scanf("%d", &n);
		a[n - 1] = 1;
	}
	for (i = 0; i < 30; i++){
		if (a[i] == 0){
			printf("%d\n", i + 1);
		}
	}
	
	return (0);
}

Measured memory_bytes: 596
import fractions
A,B=map(int,input().split())

base=fractions.gcd(A,B)
count=1


for i in range(2,int(pow(base,1/2)+1)):
    if base==1:
        break
    else:
        if base%i==0:
            count+=1
            while base%i==0:
                base//=i
if base!=1:
    count+=1
print(count)

Measured memory_bytes: 5176
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {

            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(p[2] >= p[0] && p[2] <= p[0] + p[1] ? "YES" : "NO");

            //Console.Out.Flush();

        }
    }



    public class Calculation
    {

    }

    public class Graph
    {

    }
}
// aa b ba a
// a b a 

Measured memory_bytes: 13396
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#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 ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define SZ(x) ((int)(x).size)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;

int main(){
    ll c=0,x=1,g=0,n,h,w,k,m,l,ans=0,ptr=0;
    string s,s1,s2;
    MP p;
    cin >> n >> g;
    VI a(n);
    rep(i,n){
        cin >> a[i];
	}

    for(int i=0;i<n-1;i++){
        if(a[i+1] - a[i] <= g){
            ans += a[i+1] - a[i];
        }
        else{
            ans += g;
        }
    }
    ans += g;
    cout << ans << endl;
    return 0;
}



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

int main(int argc,char* argv[]){
    int k,a,b;

    cin>>k>>a>>b;

    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

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

	int sum = 0;

	for (int i = 1; i <= N; i++) {
		if (i >= K + 1) sum += Y;
		else sum += X;
	}

	cout << sum << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }
    int g = __gcd(A[0], A[1]);
    for (int i = 2; i < N; i++) {
        g = __gcd(g, A[i]);
    }
    cout << g << endl;
    return 0;
}

Measured memory_bytes: 640
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n,m = MAP()
if n == m:
    print('Yes')
else:
    print('No')

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

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int a[100][100];
int b[100][100];
long long int rst[100][100];
int main(){
	REP(i,100) REP(j,100) {a[i][j]=b[i][j]=rst[i][j]=0;}
	int n,m,l;
	cin >> n >> m >> l;
	REP(i,n) REP(j,m) cin >> a[i][j];
	REP(i,m) REP(j,l) cin >> b[i][j];
	REP(i,n){
		REP(j,l){
			REP(k,m){
				rst[i][j]+=a[i][k]*b[k][j];
			}
		}
	}
	REP(i,n){
		REP(j,l){
			cout << rst[i][j];
			if(j!=l-1) cout << " ";
		}
		cout << endl;
	}
}

Measured memory_bytes: 1312