akhauriyash/Code-Regression huggingface dataset:
#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

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin >> n;
    vll v(n);
    rep(i, n){
        cin >> v[i];
    }
    sort(ALL(v));
    long double ans = v[0];
    repr(i, 1, n){
        ans = (ans + v[i])/2.0;
    }
    cout << ans << endl;
    return 0;
}

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

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

diff = [0] * N
for i in range(N):
    diff[i] = A[i] - (i+1)

ans = 0
diff.sort()
if N %2 == 1:
    idx = N//2
    b = diff[idx]
    for i in range(N):
        ans += abs(diff[i] - b)
else:
    idx = N // 2 
    b1 = diff[idx]
    b2 = diff[idx-1]
    tmp1 = tmp2 = 0
    for i in range(N):
        tmp1 += abs(diff[i] - b1)
        tmp2 += abs(diff[i] - b2)
    ans = min(tmp1, tmp2)

print(ans)


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

int main(){

   string s;
   cin >> s;
   if(s=="SUN") cout << 7;
   else if(s=="MON") cout << 6;
   else if(s=="TUE") cout << 5;
   else if(s=="WED") cout << 4;
   else if(s=="THU") cout << 3;
   else if(s=="FRI") cout << 2;
   else if(s=="SAT") cout << 1;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <queue>
#include <cmath>
#include <cfloat>
#include <set>
#include <map>

// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

int gcd(int a, int b){
	return (a%b==0?b:gcd(b, a%b));
}

signed main() {
  INIT;
	VAR(int, n, m);
	VAR(string, s, t);

	int gc = gcd(n,m);
	int len = n * m / gcd(n, m);
	// string ans = string(len, 'A');
	//debug(len);
	// m * n / gc
	// si * m * gc == ti * n * gc?
	map<int, int > mp;
	REP(si, n){
		mp[si*len/n] = s[si];
	}
	REP(ti, m) {
		if (!mp[ti*len/m] == 0 && mp[ti*len/m] != t[ti]) {
			//debug(mp[ti*len/m]);
			OUT(-1)BR;
			return 0;
		}
	}
	// REP(si, n) {
	// 	ans[si*len/n] = s[si];
	// }

	// REP(ti, m) {
	// 	if (ans[ti*len/m] != 'A' && ans[ti * len/m] != t[ti]) {
	// 		//debug(ans[2*len/m]);
	// 		//debug(t[ti]);
	// 		OUT(-1)BR;
	// 		return 0;
	// 	}
	// 	ans[ti*len/m] = t[ti];
	// }
	
	OUT(len)BR;
	
  return 0;
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
#define endl ("\n")
#define pi (3.141592653589)
#define mod 1e9+7
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) cc.begin(), c.end()
#define mini(a, b, c) min(c, min(a, b))
//#define mini(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

int32_t main(){
    fast
    
    // Fuck Ratings, I'm in Love with Experience. 
    // Once a Charas, Always a CHARAS.
    
  //  int t=1;
    //cin>>t;
    //while(t--){



int l,r,x,c=0;
cin>>l>>r>>x;
while(l<=r){
    if(l%x==0)
    c++;
    l++;
}
  cout<<c;  //}
   
      
  
    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int 
#define pb push_back
#define mp make_pair
#define endl "\n"
// #define mem(x) memset(x, -1, sizeof(x))
const int MOD = 1e9+7;

template <typename T>
void print(T AA[], int nn){for(int ii=0; ii<nn; ii+=1){cout<<AA[ii]<<" ";}cout<<endl;}
template <typename T> inline void print(T nn){ cout << nn << endl;}
/* ----------------------------------------------------------------------------------- */

const int N = 3005;
int n, vis[N][N];
double cache[N][N], A[N];

double fn(int i, int heads){
    if(i==n) return (heads*2>=n);
    if(vis[i][heads]==1) return cache[i][heads];
    vis[i][heads] = 1;
    double ans = A[i]*fn(i+1, heads+1) + (1-A[i])*fn(i+1, heads);
    cache[i][heads] = ans;
    return ans;
}


int32_t main(){

    IOS

    memset(vis, 0, sizeof(vis));
    cin >> n;
    for(int i=0; i<n; i+=1) cin >> A[i];
    cout <<fixed << setprecision(9) << fn(0, 0) << endl;

    return 0;
}

Measured memory_bytes: 139904
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class D
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		int K = GetInt();
		int[] RSP = GetInts(3);
		string T = GetString();

		int[] c = new int[N];
		for(int i = 0; i < N; i++)
		{
			if(T[i] == 'r')
				c[i] = 0;
			else if(T[i] == 's')
				c[i] = 1;
			else
				c[i] = 2;
		}

		int[,] dp = new int[N + 1, 3];
		for(int i = 0; i < K; i++)
		{
			for(int j = 0; j < 3; j++)
			{
				if((j + 1) % 3 == c[i])
					dp[i + 1, j] = RSP[j];
			}
		}

		for(int i = K; i < N; i++)
		{
			for(int j = 0; j < 3; j++)
			{
				for(int k = 0; k < 3; k++)
				{
					if(j == k)
						continue;

					if((j + 1) % 3 == c[i])
						chmax(ref dp[i + 1, j], dp[i + 1 - K, k] + RSP[j]);
					else
						chmax(ref dp[i + 1, j], dp[i + 1 - K, k]);
				}
			}
		}

		int ans = 0;
		for(int i = Max(1, N - K + 1); i <= N; i++)
		{
			int max = 0;
			for(int j = 0; j < 3; j++)
				chmax(ref max, dp[i, j]);

			ans += max;
		}
		WriteLine(ans);
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

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

int main() {
  int H , W;
  cin >> H >> W;
  for (int i = 0; i < W + 2; i++){
  	cout << "#";
  }
  cout << endl;
  
  for (int j = 0; j < H; j++){
  cout << "#";
  string p;
  cin >> p;
  cout << p << "#" << endl;
  }
  
  for (int l = 0; l < W + 2; l++){
  	cout << "#";
  }

  cout << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <deque>

using namespace std;

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

	int N, T;
	cin >> N >> T;

	int c[100];
	int t[100];

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

	int min = 10000;
	for (int i = 0; i < N; i++) {
		if (t[i] <= T) {
			if (c[i] < min) {
				min = c[i];
			}
		}
	}

	if (min == 10000) {
		cout << "TLE" << endl;
	} else {
		cout << min << endl;
	}
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 3)
    {
        if (s[i] == '1')
            ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#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 exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    if(a >= 13) {
        out(b);
    }
    else if(a >= 6) {
        out(b/2);
    }
    else {
        out(0);
    }

    re0;
}

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

#define int long long
typedef pair <int, int> pii;

const int N = 1e5 + 10;
int n, m, ar[N];
pii a[N];
multiset <int> st;

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> ar[i], st.insert(ar[i]);
	for (int i = 0; i < m; i++)
		cin >> a[i].first >> a[i].second;
	sort(a, a + m, [&] (pii p1, pii p2) { return p1.second > p2.second; });
	
	for (int i = 0; i < m; i++) {
		int cnt = a[i].first, c = a[i].second;
		while (cnt && *st.begin() < c) {
			st.erase(st.find(*st.begin()));
			st.insert(c);
			cnt--;
		}
	}
	
	int ans = 0;
	for (int i : st)
		ans += i;
	cout << ans;
}

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

using namespace std;
#define ll long long
inline ll read()
{
    ll d=0,f=1;
    char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch)){d=d*10+ch-'0';ch=getchar();}
    return d*f;
}
int num[100005];
vector<int> vec(100005);
int main()
{
    string str;
    cin >> str;
    for(int i=0;i<str.size();i++)
    {
        if(str[i]=='L' && str[i-1]=='R')
        {
            for(int j=i-1,f=0;j>=0 && str[j]=='R';j--,f^=1)
            {
                if(f)
                    num[i]++;
                else
                    num[i-1]++;
            }
            for(int j=i,f=0;j<str.size() && str[j]=='L';j++,f^=1)
            {
                if(f)
                    num[i-1]++;
                else
                    num[i]++;
            }
        }
    }
    for(int i=0;i<str.size();i++)
    {
        if(i)
            printf(" ");
        printf("%d",num[i]);
    }
    return 0;
}


Measured memory_bytes: 1408
a,b = map(int, input().split())

ans = float("inf")
for i in range(4):
	tmp = 0
	x = a
	y = b
	if i == 0:

		if x > y:
			continue

		tmp += y-x

	elif i == 1:
		tmp += 1
		x *= -1
		if x > y:
			continue
		tmp += y-x

	elif i == 2:
		tmp += 1
		y *= -1
		if x > y:
			continue
		tmp += y-x

	else:
		tmp += 2
		x *= -1
		y *= -1
		
		if x > y:
			continue

		tmp += y-x

	ans = min(ans,tmp)

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

void _149() {
    string s, t;
    cin >> s >> t;
    cout << t + s << endl;
}

void _148() {
    int a, b;
    cin >> a;
    cin >> b;

    int c = 0;
    if ((a != 1) && (b != 1))
        c = 1;
    else if ((a != 2) && (b != 2))
        c = 2;
    else if ((a != 3) && (b != 3))
        c = 3;
    cout << c << endl;
}

void _147() {
    int a, b, c;
    cin >> a >> b >> c;

    if (a + b + c >= 22)
        cout << "bust" << endl;
    else
        cout << "win" << endl;
}

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

    vector<string> list = {"SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};
    for (int i = 0; i < list.size(); ++i) {
        if (s == list[i])
            cout << i + 1 << endl;
    }
}

void _145() {
    int r;
    cin >> r;
    cout << pow(r, 2) << endl;
}

void _144() {
    int a, b;
    cin >> a >> b;

    if ((a >= 1 && a <= 9) && (b >= 1 && b <= 9))
        cout << a * b << endl;
    else
        cout << -1 << endl;
}

void _143() {
    int a, b;
    cin >> a >> b;

    if (b * 2 >= a)
        cout << 0 << endl;
    else
        cout << a - 2 * b << endl;
}

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

    if (n % 2 == 0)
        cout << 1 / 2.0 << endl;
    else
        cout << (n / 2 + 1) / (float)n << endl;
}

int main()
{
    _142();
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <map>
#include<stdio.h>

using namespace std;
int n;//??????
int b;
int c;
int i;
int i2;
int d=-1;
bool dame[100000];
multimap<int,int>name;
int po;

int main(){
for(i=0;i<100000;i++){
dame[i]=false;
}
for(i2=0;d==-1;i2++){
po=0;
scanf("%d",&n);
if(n==0){
d=i2;
break;
}
for(i=0;i<n;i++){
scanf("%d %d",&b,&c);
name.insert(multimap<int,int>::value_type(c,b));
}
multimap<int,int>::iterator it=name.begin();
while(it!=name.end()&&dame[i2]!=true){
po+=(*it).second;
if((*it).first<po){
dame[i2]=true;
}
++it;
}
name.clear();
}

for(i=0;i<d;i++){
if(dame[i]==true)printf("No\n");
else printf("Yes\n");
}
return 0;
}

Measured memory_bytes: 1264
fun main(args: Array<String>) {
    val (N, M) = listOfInt()
    val AB = Array(N) {
        val (a, b) = listOfInt()
        a to b
    }.sortedBy { it.first }
    var m = M
    var n = 0
    var ans = 0L
    while (m > 0) {
        val c = Math.min(m, AB[n].second)
        m -= c
        ans += c.toLong() * AB[n].first.toLong()
        n += 1
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)

Measured memory_bytes: 81912
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
// #define LOCAL
const int MAXN=2e5+10;
const ll MOD=17;
ll _gcd(ll a,ll b){if(b==0)return a;return _gcd(b,a%b);}
ll gcd(ll a,ll b){a=abs(a),b=abs(b);if(a<b)swap(a,b);return _gcd(a,b);}
ll qpow(ll a,ll n){ll rt=1;while(n){if(n&1)rt=(rt*a)%MOD;a=a*a%MOD;n>>=1;}return rt;}
ll qpow(ll a,ll n,ll m){ll rt=1;while(n){if(n&1)rt=(rt*a)%m;a=a*a%m;n>>=1;}return rt;}
ll factor[MAXN];
void cal_factor(){factor[0]=1;for(int u=1;u<MAXN;u++){factor[u]=(factor[u-1]*u)%MOD;}}
ll C(ll n,ll k){return factor[n]*qpow(factor[n-k],MOD-2)%MOD*qpow(factor[k],MOD-2)%MOD;}
void solve(){
    int N;
    string x;
    cin>>N>>x;
    reverse(x.begin(),x.end());
    int ones=0;
    for(char c:x){
        if(c=='1')ones++;
    }
    int pos=0,neg=0;
    for(int b=0;b<N;b++){
        if(x[b]=='1'){
            pos=(pos+qpow(2,b,ones+1))%(ones+1);
            if(ones>1)
                neg=(neg+qpow(2,b,ones-1))%(ones-1);
        }
    }
    for(int b=N-1;b>=0;b--){
        if(x[b]=='1'){
            if(ones==1){
                cout<<0<<"\n";
                continue;
            }
            int t=(neg-qpow(2,b,ones-1)+ones-1)%(ones-1);
            int cnt=1;
            while (t){
                int tt=t,bs=0;
                while(tt){
                    if(tt&1)bs++;
                    tt>>=1;
                }
                if(bs){
                    t=t%bs;
                    cnt++;
                }
            }
            cout<<cnt<<"\n";
        }else {
            int t=(pos+qpow(2,b,ones+1)+ones+1)%(ones+1);
            int cnt=1;
            while(t){
                int tt=t,bs=0;
                while(tt){
                    if(tt&1)bs++;
                    tt>>=1;
                }
                if(bs){
                    t=t%bs;
                    cnt++;
                }
            }
            cout<<cnt<<"\n";
        }
    }
}
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    solve();
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	vl x(n), y(n);
	FOR(i,0,n) cin >> x[i] >> y[i];

	map<pll,ll> count;
	FOR(i,0,n) FOR(j,0,n) if (i != j) {
		ll dx = x[i]-x[j], dy = y[i]-y[j];
		count[mp(dx,dy)]++;
	}
	
	ll res = 0;
	for (auto pr: count) res = max(res, pr.yy);
	cout << n-res << endl;

}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

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

vl spf(1000006, 0);

void sieve() {
	for (ll i = 2; i < 1000005; i++) {
		if (spf[i] == 0) {
			for (ll j = i; j < 1000005; j += i) {
				if (spf[j] == 0)
					spf[j] = i;
			}
		}
	}
}

int main() {
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	sieve();
	ll n;
	cin >> n;
	ll ans = 0;
	for (ll c = 1; c < n; c++) {
		ll lef = n - c;
		if (lef == 1)
			ans++;
		else {
			ll d = lef;
			ll cur = 1;
			while (d > 1) {
				ll cnt = 0;
				ll f = spf[d];
				while (d % f == 0) {
					d = d / f;
					cnt++;
				}
				cur *= (cnt + 1);
			}
			ans += cur;
		}
	}
	cout << ans << "\n";
}


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

using namespace std;

#define int long long
#define endl '\n'
#define MOD 1000000007
#define maxn 100010

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

    vector<string> v(n);
    map<string, int> mp;
    int mx = 0;
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        mp[v[i]]++;
        mx = max(mx, mp[v[i]]);
    }
    for (auto x: mp) {
        if (x.second == mx)
            cout << x.first << endl;
    }

}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 25472
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] nums = new int[input.Length];
            for(int i = 0; i < input.Length; i++)
            {
                nums[i] = int.Parse(input[i]);
            }
            int a, b;
            if(nums[0] < nums[2])
            {
                a = nums[2];
            }
            else
            {
                a = nums[0];
            }
            if(nums[1] < nums[3])
            {
                b = nums[1];
            }
            else
            {
                b = nums[3];
            }
            if(b - a > 0)
            {
                Console.WriteLine(b - a);
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX=2e5+7,MOD=2019;
int main (){
    string s;cin>>s;
    int n = s.size();
    vector<int>digits(n);
    for(int i=0;i<n;i++)digits[i]=s[i]-'0';
    map<int,int>cnt;
    cnt[0]=1;
    int res=0;
    ll curr = 0;
    ll power=1;
    reverse(digits.begin(),digits.end());
    for(auto x:digits){
        curr = (curr)%MOD + (x*power)%MOD;
        curr%=MOD;
        res+=cnt[curr];
        cnt[curr]++;
        power*=10;
        power%=MOD;

        //cout<<curr<<" ";
    }
    //cout<<endl;
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 4448
#include<bits/stdc++.h>
using namespace std;
 
int N,W;
vector<int>v,w;
 
int dp[10001];
 
int main(){
    cin>>N>>W;
    v.resize(N);w.resize(N);
 
    for(int i=0;i<N;i++)cin>>v[i]>>w[i];
 
    for(int i=0;i<N;i++){
        for(int j=W;j>0;j--){
            if(j-w[i]<0)break;
            dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
        }
    }
 
    cout<<dp[W]<<endl;
    return 0;
}


Measured memory_bytes: 3144
// バケット法による解
#include <iostream>
using namespace std;

int main() {
    int d[10];
    for (int i = 0; i < 6; ++i) cin >> d[i];

    int num[10] = {0};  // バケット
    for (int i = 0; i < 6; ++i) {
        num[d[i]]++;  // d[i] が 1 個増える
    }

    int res = 0;  // 答えを格納
    for (int i = 1; i < 10; ++i) {  // 1 <= d[i] <= 100 なので 1 から 100 まで探索
        if (num[i]==2) { 
            ++res;
        }
    }
        if (res==2) {  
            cout << "YES" << endl;
    }else{
    cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;


ll MAX = 1000000000;


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

	vec p(N);

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

	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < N; ++j)
		{
			swap(p[i], p[j]);

			bool flag = true;
			for (int k = 1; k < N; ++k)
			{
				if (p[k - 1] > p[k])flag = false;
			}
			if (flag)
			{
				cout << "YES" << endl;
				return 0;
			}

			swap(p[i], p[j]);
		}
	}
	cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using  namespace std;
signed main(){
  double N;
  cin>>N;
  for(int i=1;i<=10000;i++){
    for(int j=1;j<=10000;j++){
      if(3500>=4/N-((1.0/(double)i)+(1.0/(double)j))&&4/N-((1.0/(double)i)+(1.0/(double)j))>0){
        
        //cout<<1/(4/N-((1.0/(double)i)+(1.0/(double)j)))<<" "<<(int)(1/(4/N-((1.0/(double)i)+(1.0/(double)j))))<<"\n";
        
        if(1/(4/N-((1.0/(double)i)+(1.0/(double)j)))==(int)(1/(4/N-((1/(double)i)+(1/(double)j))))){
          cout<<i<<" "<<j<<" "<<1/(4/N-((1.0/(double)i)+(1.0/(double)j)))<<"\n";
          return 0;
        }
      }
    }
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#define ll long long
using namespace std;

int a,b,c,hash1[8];
bool haiku=0;

int main()
{
    cin>>a>>b>>c;
    memset(hash1,0,sizeof(hash1));
    hash1[a]++; hash1[b]++; hash1[c]++;
    if(hash1[5]==2&&hash1[7]==1) haiku=1;
    if(haiku) cout<<"YES";
    else cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Chars;
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused)]
const ALPHA_SMALL: [char; 26] = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z',
];
#[allow(unused)]
const ALPHA: [char; 26] = [
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
    'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
];
macro_rules! maxs {
    ($x:expr, $($y:expr), *) => {{
        let mut ret = $x;
        $(
            ret = max(ret, $y);
        )*
        ret
    }};
}
fn main() {
    input!(N: usize);
    let mut v = vec![];
    for _ in 0..N {
        input!(t: (i64, i64));
        v.push(t);
    }
    let mut w = vec![vec![0; 2]; N];
    for i in 0..N {
        for d in 0..2 {
            w[i][d] = f(v[i].0, v[i].1, d);
        }
    }

    //println!("{:?}", w);
    let mut ans = 0;
    for d in 0..2 {
        let mut m1 = w[0][d];
        let mut m2 = w[0][d];
        for i in 0..N {
            m1 = max(m1, w[i][d]);
            m2 = min(m2, w[i][d]);
            //println!("d = {}, m1 = {}, m2 ={}", d, m1, m2);
        }
        //println!("{}", m1 - m2);
        ans = max(ans, m1 - m2);
    }

    println!("{}", ans);
}

fn f(x: i64, y: i64, d: usize) -> i64 {
    if d == 0 {
        x - y
    } else {
        x + y
    }
}


Measured memory_bytes: 20012
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long
const double pi = acos(-1.0);

const LL mod = 998244353;

int n, k;
int a[10005];

int main() {
#ifdef LOCAL
  auto start_clock = clock();
  freopen("in", "r", stdin);
#endif

  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  int m = 0;
  for (int i = 0; i < k; i++) {
    m += a[i];
  }
  printf("%d\n", m);



#ifdef LOCAL
 auto end_clock = clock();
 cout << "Time:" << (end_clock - start_clock) / CLOCKS_PER_SEC << endl;
#endif
  return 0;
}

Measured memory_bytes: 3840
#include <iostream> pre processor directive
#include <string>
#include <iomanip>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    char c;
    cin>>c;
    if(c=='a' || c=='e' || c=='i' || c=='u' || c=='o'){cout<<"vowel"<<endl;}
    else{cout<<"consonant"<<endl;}
}


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

int main() {
  int H, W, i, j, k;
  cin >> H >> W;
  vector<vector<char>> g(H, vector<char>(W));
  
  for(i=0; i<H; i++)
    for(j=0; j<W; j++)
      cin >> g.at(i).at(j);
  
  for(i=0; i<H; i++) {
    for(j=0; j<W; j++) {
      if(j == 0) {
        for(k=0; k<W; k++)
          if(g.at(i).at(k) != '.')
            break;
        if(k == W)
          break;
      }
      if(g.at(i).at(j) == '.') {
        for(k=0; k<H; k++)
          if(g.at(k).at(j) != '.')
            break;
        if(k == H)
          continue;
      }
      cout << g.at(i).at(j);
    }
    if(j != 0)
      cout << endl;
  } 
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
using namespace std;

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

int N, M;
vector<int> a[10];
int p[10];

int main() {
  cin >> N >> M;
  rep(i, M) {
    int temp;
    cin >> temp;
    a[i].resize(temp);
    rep(j, a[i].size()) {
      cin >> a[i][j];
    }
  }

  rep(i, M) {
    cin >> p[i];
  }

  bool f = true;
  int ans = 0;

  for(int bit = 0; bit < (1<<N); bit++) {
    f = true;
    for(int j = 0; j < M; j++) {
      int count = 0;
      for(int i = 0; i < a[j].size(); i++) {
        int temp = a[j][i] - 1;
        int check = bit & (1<<temp);
        if(check != 0) {
          count++;
          // cout << bit << " " << a[j][i]-1 << endl;
        }
      }
      // cout << count << endl;
      if(count % 2 != p[j]) f = false;
    }
    if(f) ans++;
    // if(bit == 3) cout << endl << f << endl;
  }

  cout << ans << endl;
  // cout << N << endl;
  // cout << endl;
  // cout << a[1][0] << endl;
  // cout << a[0].size() << endl;
  // cout << a[1].size() << endl;

  // int i = 3 & (1<<1);

  // cout << i << endl;


  return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using ll = long long;
#define int ll
using Weight = int;
using Capacity = int;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
    g[a].emplace_back(a, b, w);
    g[b].emplace_back(b, a, w);
}

void add_arc(Graph &g, int a, int b, Weight w = 1) {
    g[a].emplace_back(a, b, w);
}

using namespace std;

Graph to_rooted_tree(const Graph &g, int root = 0) {
    int n = g.size();
    Graph res(n);
    constexpr Weight INF = std::numeric_limits<Weight>::max() / 2;
    std::vector<int> dist(n, INF);
    std::deque<std::pair<int, int>> to_visit; // fixme
    dist[root] = 0;
    to_visit.emplace_back(0, root);
    while (to_visit.size()) {
        Weight d; int v;
        std::tie(d, v) = to_visit.back(); // fixme
        to_visit.pop_back(); // fixme
        d = -d;
        for(auto &e : g[v]){
            if (dist[e.dst] > dist[v] + e.weight) {
                dist[e.dst] = dist[v] + e.weight;
                to_visit.emplace_back(dist[e.dst], e.dst); // fixme
                res[e.src].emplace_back(e);
            }
        }
    }
    return res;
}

int n;
int a[100010];
Graph g;

// 親への辺は何回通るか
int dfs(int v) {
    if (g[v].size() == 0) {
        return a[v];
    } else if (g[v].size() == 1) {
        int c = g[v][0].dst;
        return dfs(c) == a[v] ? a[v] : -1;
    } else {
        vector<int> dfsc;
        int sum = 0;
        for (auto &e : g[v]) {
            int x = dfs(e.dst);
            dfsc.push_back(x);
            sum += x;
        }
        bool ok = true;
        for (auto &x : dfsc) {
            if (x < 0 || a[v] < x) {
                ok = false;
                break;
            }
        }
        int res = 2 * a[v] - sum;
        if (res < 0 || a[v] < res) {
            ok = false;
        }
        return ok ? res : -1;
    }
}

bool solve() {
    int r = -1;
    for (int i = 0; i < n; i++) {
        if (g[i].size() != 1) {
            r = i;
            break;
        }
    }
    if (n == 2) return a[0] == a[1];
    g = to_rooted_tree(g, r);
    return dfs(r) == 0;
}

signed main() {
    while (cin >> n) {
        g.assign(n, {});
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        for (int i = 0; i < n - 1; i++) {
            int a, b;
            cin >> a >> b;
            --a; --b;
            add_edge(g, a, b);
        }
        cout << (solve() ? "YES" : "NO") << endl;
    }
}

Measured memory_bytes: 20808
n = int(input())

if n == 1:
    print(0)
    exit()

def is_prime(num):
    if num == 1:
        raise ValueError("error!")
    d = 2
    while d * d <= num:
        if num % d == 0:
            return False, d
        d += 1
    return True, -1


x = n
yakusuu = {}
while True:
    x_is_prime, div = is_prime(x)
    if x_is_prime:
        yakusuu[x] = yakusuu.get(x, 0) + 1
        break
    else:
        yakusuu[div] = yakusuu.get(div, 0) + 1
        x = x // div

# print(yakusuu)
ans = 0
for v in yakusuu.values():
    for p in range(1, 10000):
        if p*(p+1)//2 <= v < (p+2)*(p+1)//2:
            ans += p
            break
print(ans)


Measured memory_bytes: 9224
def resolve():
    from collections import deque
    n = int(input())
    a = list(map(int, input().split()))
    trans = False
    ans = []
    ans = deque(ans)
    for i in range(n):
        add = a[i]
        if not trans:
            ans.append(add)
        else:
            ans.appendleft(add)
        trans = not trans
    if trans:
        ans = list(ans)[::-1]
    print(*ans)
resolve()

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

class Program
{
    static void Main(string[] args)
    {

        // 入力
        var n = int.Parse(Console.ReadLine());
        int[] x = new int[n];
        int[] y = new int[n];
        int[] h = new int[n];
        var s = 0;
        for (int i = 0; i < n; i++)
        {
            int[] tmp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            x[i] = tmp[0];
            y[i] = tmp[1];
            h[i] = tmp[2];
            if (h[i] != 0)
            {
                s = i;
            }
        }

        //全探索
        var ansx = 0;
        var ansy = 0;
        var ansh = 0;
        for (int i = 0; i < 101; i++)
        {
            for (int k = 0; k < 101; k++)
            {
                bool flag = true;
                var tmp = h[s] + Math.Abs(i - x[s]) + Math.Abs(k - y[s]);
                for (int t = 0; t < n; t++)
                {
                    if (h[t] > 0 && tmp != h[t] + Math.Abs(i - x[t]) + Math.Abs(k - y[t]))
                    {
                        flag = false;
                    }
                    if (h[t] == 0 && tmp > Math.Abs(i - x[t]) + Math.Abs(k - y[t]))
                    {
                        flag = false;
                    }

                }

                if (flag)
                {
                    ansx = i;
                    ansy = k;
                    ansh = tmp;

                }
            }
        }

        Console.WriteLine("{0} {1} {2}", ansx, ansy, ansh);
        return;

    }
}


Measured memory_bytes: 13396
import java.text.DecimalFormat;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
	DecimalFormat df = new DecimalFormat( "0.00000000 ");  
	Scanner sc=new Scanner(System.in);
	while(sc.hasNext()) {
		float sum=0;
		float sum2=0;
		float a = 0;
	int n=sc.nextInt();
	if(n==0) {
		break;
	}
	int s[]=new int[n];
	for(int i=0;i<s.length;i++) {
		s[i]=sc.nextInt();
	}
	for(int i=0;i<s.length;i++) {
		sum=sum+s[i];
	}
	float m=sum/n;
	for(int i=0;i<s.length;i++) {
			a=(s[i]-m)*(s[i]-m);
			sum2=sum2+a;
	}
	float a2=sum2/n;
	float a3=(float)Math.sqrt(a2);
	System.out.println(df.format(a3));
}
}
}


Measured memory_bytes: 31488
#include<bits/stdc++.h>
using namespace std;
int main()
{
    //freopen("input.txt","r",stdin);
    int n,w;
    cin >> n >> w;
    int h =  2*n;
    char ch[n][w];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < w; j++){
            cin >> ch[i][j];
        }
    }

    for(int i = 0; i < n; i++){
            string s;
        for(int j = 0; j < w; j++){
            cout << ch[i][j];
            s += ch[i][j];
        }
        cout << endl;
        cout << s << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
typedef pair<ll, ll> Pair;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define FIND(x,key) x.find(key) != x.end()
#define IN_RANGE_V2(v,k,x,y) (0<=x+dx[k]&&x+dx[k]<v[y].size()&&0<=y+dy[k]&&y+dy[k]<v.size())
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define PRINT_ARRAY_V(a) REPALL(__i,a) {cout<<a[__i]<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};
//const VI dx = {1, 1, 0, -1, -1, -1, 0, 1};
//const VI dy = {0, 1, 1, 1, 0, -1, -1, -1};

void solve()
{
    ll c, d, n, m, l, r, k, x, y, z, ans = 0ll;
    string s, t;
    cin>>n;
    VLL a(n), b(n);
    REP(i,n) cin>>a[i];
    REP(i,n) cin>>b[i];
    ll sum_a = 0ll, sum_b = 0ll;
    ll diff_a = 0ll, diff_b = 0ll;
    REP(i,n) {
        sum_a += a[i];
        sum_b += b[i];
        if (a[i] > b[i]) diff_b += a[i] - b[i];
        else if (a[i] < b[i]) diff_a += (b[i] - a[i] + 1) / 2;
    }
    Yes(diff_a <= sum_b - sum_a && diff_b <= sum_b - sum_a);
}

int main()
{
    cout<<fixed<<setprecision(20);
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3788
def inputs(): return [int(x) for x in input().split()]
def bfs(s):
    if len(s)==cnt1:
        return s
    a = s[-1]
    if a=="0":
        A = ["0","1"]
    elif a=="9":
        A = ["8","9"]
    else:
        A=[str(int(a)-1),a,str(int(a)+1)]
    for i in A:
        if bfs(s+i)!=None:
            ans.append(bfs(s+i))
ans=["1","2","3","4","5","6","7","8","9"]
n = int(input())
cnt1 = 2
while len(ans)<n:
    for i in ans:
        if len(i)==cnt1-1:
            bfs(i)
    cnt1+=1
ans = list(map(int,ans))
ans.sort()
#print(ans)
print(ans[n-1])

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

int main() {
  int N; cin >> N;
  int m = 1, n = 0;
  int long long sum = 0;
  
  vector<int> a(N);
  for( int i = 0; i < N; i++ ) {
    cin >> a.at(i);
    if( a.at(i) < 0 ) {
      n++;
      a.at(i) *= -1;
    }
  }
  
  sort(a.begin(), a.end());
  for( int i = 0; i < N; i++ )
    sum += a.at(i);
  sum = sum - 2 * a.at(0) * ( n % 2 );
  cout << sum << endl;
  
}

Measured memory_bytes: 640
import java.util.Scanner;

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

        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        int c = stdIn.nextInt();

        if((a<c && c<b) || (b<c && c<a)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include<stdio.h>

#define max(a,b) ((a)>(b)?(a):(b))

int main(){
		int a,b,ans=-10000000;
		scanf("%d%d",&a,&b);
		ans=max(ans,a+b);
		ans=max(ans,a-b);
		ans=max(ans,a*b);
		printf("%d\n",ans);
		return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
/*--------Library Zone!--------*/

int n;
P p[214514];
signed main() {
	cin >> n;
	rep(i, n)cin >> p[i].second >> p[i].first;
	sort(p, p + n);
	int now = 0;
	rep(i, n) {
		now += p[i].second;
		if (now > p[i].first) {
			cout << "No" << endl; return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	ini(n);
	ini(n1);
	int tmp = 0;
	if(n>=2){
		tmp+=(n*(n-1))/2;
	}
	if(n1>=2){
		tmp+=(n1*(n1-1))/2;
	}
	out(tmp);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);(i)--)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;

map<ll, int> mp;

void prime_factorization(ll n){
    for (ll i = 2LL; i * i <= n; i++){
        while(n % i == 0){
            mp[i]++;
            n /= i;
        }
    }
    if (n != 1) mp[n]++;;
}

int main(){
    ll n;
    cin >> n;
    REP(i,1,n + 1){
        prime_factorization(i);
    }

    ll ans = 1;
    for (auto i : mp){
        (ans *= i.second + 1) %= MOD;
    }
    
    cout << ans << endl;
    
    return 0;
}

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

using namespace std;

struct point {
	double x, y;
	point() {}
	point(double _x, double _y) : x(_x), y(_y) {}
};

point operator + (const point &P, const point &Q) {
	return point(P.x + Q.x, P.y + Q.y);
}

point operator - (const point &P, const point &Q) {
	return point(P.x - Q.x, P.y - Q.y);
}

point operator * (const point &P, const double k) {
	return point(P.x * k, P.y * k);
}

inline double dot(const point &P, const point &Q) {
	return P.x * Q.x + P.y * Q.y;
}

inline double norm2(const point &P) {
	return dot(P, P);
}

inline double norm(const point &P) {
	return sqrt(dot(P, P));
}

point project(const point &P, const point &P1, const point &P2) {
	return P1 + (P2 - P1) * (dot(P2 - P1, P - P1) / norm2(P2 - P1));
}

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

	point P1, P2;
	cin >> P1.x >> P1.y >> P2.x >> P2.y;

	int q;
	cin >> q;
	while (q--) {
		point P;
		cin >> P.x >> P.y;
		point answer = project(P, P1, P2);
		cout << fixed << answer.x << " " << fixed << answer.y << "\n";
	}
}

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

int main(){
  int N, L;
  cin>>N>>L;
  vector<string> s(N);
  for(int i=0; i<N; i++){
    cin>>s[i];
  }
  sort(s.begin(),s.end());
  string ans;
  for(int i=0; i<N; i++){
    ans+=s[i];
  }
  cout<<ans<<endl;
  return 0;
}

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

int main(){
	int N,c;
	cin >> N;
	c = N%10;
	
	string XON;
	if(c == 3)
		XON  = "bon";
	else if(c == 0 || c == 1 || c == 6 || c == 8)
		XON = "pon";
	else
		XON = "hon";
	
	cout << XON << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<iostream>
#include<fstream>
#define ll long long
using namespace std;

vector<vector<int>> chi;
vector<bool> used;

void dfs(int n, int p){
    int nChi = chi[n].size();
    for(int i=0; i<nChi; i++){
        int m = chi[n][i];
        if(!used[m]){
            used[m] = true;
            dfs(m, n);
        }
    }
}

int main(){
    int N, M;  cin >> N >> M;
    chi = vector<vector<int>>(N+1, vector<int>());
    for(int i=0; i<M; i++){
        int X, Y, Z;
        cin >> X >> Y >> Z;
        chi[X].push_back(Y);
        chi[Y].push_back(X);
    }

    used = vector<bool>(N+1, false);
    int ans = 0;
    for(int i=1; i<=N; i++){
        if(!used[i]){
            ans++;
            dfs(i,0);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 10368
import functools
import operator

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

# prod = functools.partial(functools.reduce, operator.mul)
# tmp_sum_prod = prod(A[:K])
for i in range(K, N):
    sum_prod = (A[i]/A[i-K])
    if sum_prod > 1.0:
        print('Yes')
    else:
        print('No')
    tmp_sum_prod = sum_prod


Measured memory_bytes: 93068
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
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;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;

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

	cout << 800 * N - 200 * (N / 15) << endl;
}

Measured memory_bytes: 256