akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
struct myhash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef pair<string,ll> psl;
typedef vector<psl> vpsl;
typedef vector<int> vi;

#define fur(i,a,b) for(ll (i)=(a);i<(b);++(i))
#define revf(i,a,b) for(ll (i)=(a)-1;(i)>=(b);--(i))
#define mp make_pair
#define mod 1000000007
#define inf 2000000007
#define pb push_back
#define eps 1e-5
#define X first
#define Y second


ll modpow(ll base, ll exp, ll modulus) {
  base %= modulus;
  ll result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}

ll modinv(ll a, ll m) { 
    ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) 
      return 0; 
    while (a > 1) 
    { 
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    } 
    if (x < 0)
       x += m0;
    return x;
}


int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
  ll n,m;
  cin>>n>>m;
  vll a(n);
  vll b(m);
  fur(i,0,n)cin>>a[i];
  fur(j,0,m)cin>>b[j];
  vvll dp(n+1,vll(m+1));
  vvll sum(n+2,vll(m+2,0));
  dp[0][0]=1;
  sum[0][0]=0;
  fur(i,1,n+1){
    fur(j,1,m+1){
      sum[i][j] = ((sum[i-1][j] + sum[i][j-1]) +(mod- sum[i-1][j-1])%mod)%mod;
            if(a[i-1] == b[j-1])
            {
                sum[i][j] = (sum[i][j]+(sum[i-1][j-1] + 1))%mod;
                // dp[i][j]=(sum[i-1][j-1] + 1);
            }
            // sum[i][j]%=mod;

    }
  }
  // fur(i,0,n+1){
  //   fur(j,0,m+1){
  //     cout<<sum[i][j]<<" ";
  //   }
  //   cout<<"\n";
  // }
  cout<<(sum[n][m]+1)%mod;


	return 0;
}


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

namespace mondai0026
{
	class Program
	{
		static void Main(string[] args)
		{
			int[,]	p	= new int[ 30, 30 ];

			while( true ) {
				var	s	= Console.ReadLine();
				if( s == null ) {
					break;
				}
				var	c	= s.Split( ',' );
				var	x	= int.Parse( c[ 0 ] ) + 10;
				var	y	= int.Parse( c[ 1 ] ) + 10;
				var	i	= int.Parse( c[ 2 ] );

				switch( i ) {
				case	1:
					p[ y, x ]++;
					p[ y - 1, x ]++;
					p[ y, x + 1 ]++;
					p[ y + 1, x ]++;
					p[ y, x - 1 ]++;
					break;

				case	2:
					for( int yy = y - 1; yy <= y + 1; yy++ ) {
						for( int xx = x - 1; xx <= x + 1; xx++ ) {
							p[ yy, xx ]++;
						}
					}
					break;

				case	3:
					for( int yy = y - 1; yy <= y + 1; yy++ ) {
						for( int xx = x - 1; xx <= x + 1; xx++ ) {
							p[ yy, xx ]++;
						}
					}
					p[ y - 2, x ]++;
					p[ y, x + 2 ]++;
					p[ y + 2, x ]++;
					p[ y, x - 2 ]++;
					break;
				}
			}

			int	blank	= 0;
			int	inc_max	= 0;
			for( int yy = 10; yy < 20; yy++ ) {
				for( int xx = 10; xx < 20; xx++ ) {
					if( p[ yy, xx ] == 0 ) {
						blank++;
					} else {
						if( p[ yy, xx ] > inc_max ) {
							inc_max	= p[ yy, xx ];
						}
					}
				}
			}
			Console.WriteLine( blank );
			Console.WriteLine( inc_max );
		}
	}
}

Measured memory_bytes: 5584
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 998244353LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

vector<vector<ll>> g;
vector<ll> weight;
vector<ll> ans;

constexpr int MAX_SIZE = 1000010;
template <typename T>
class SegTree {
private:
	int n;
	const function<T(T, T)> op; // 演算
	const T ie; // 演算の単位元
	T seq[MAX_SIZE];

public:
	/// op: 演算, ie: 演算の単位元
	SegTree(int _n, function<T(T, T)> op, const T ie) : op(op), ie(ie) {
		n = 1;
		while(n < _n) n *= 2;
		for(int i = 0; i < 2 * n - 1; i++) seq[i] = ie;
	}

	/// k 番目(0-indexed)の要素を e で更新
	void update(ll k, const T e) {
		k += n - 1;
		seq[k] = e;
		while(k > 0) {
			k = (k - 1) / 2;
			seq[k] = op(seq[k * 2 + 1], seq[k * 2 + 2]);
		}
	}

	// k 番目(0-indexed)の要素を取得
	T get(ll k) {
		k += n - 1;
		return seq[k];
	}

	/// [a, b) 番目(0-indexed)の要素全体の演算結果を返す
	T query(ll a, ll b, int k = 0, int l = 0, int r = -1) {
		if(r == -1) r = n;
		if(r <= a || b <= l) return ie;
		if(a <= l && r <= b) return seq[k];
		T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return op(vl, vr);
	}
};
// [Range Maximum Query] op: [] (long long a, long long b) { return max(a, b); }, ie: -1e18

void dfs(ll pos, ll par, ll dpt, ll maxi_pos, SegTree<ll>& seg) {
	seg.update(dpt, pos);
	if(seg.get(maxi_pos) > pos) {
		if(seg.query(0, maxi_pos) > seg.query(maxi_pos + 1, dpt + 1)) {
			weight[seg.get(maxi_pos)]++;
		}
		else weight[seg.get(maxi_pos + 1)]++;
	} else weight[pos]++;
	REP(i, g[pos].size()) {
		if(g[pos][i] == par) continue;
		if(seg.get(maxi_pos) < pos) {
			dfs(g[pos][i], pos, dpt + 1, dpt, seg);
		} else {
			dfs(g[pos][i], pos, dpt + 1, maxi_pos, seg);
		}
	}
	seg.update(dpt, -1);
	return;
}

void calc(ll pos, ll par, ll cost) {
	cost += weight[pos];
	if(pos != 0) ans[pos - 1] = cost - 1;
	REP(i, g[pos].size()) {
		if(g[pos][i] == par) continue;
		calc(g[pos][i], pos, cost);
	}
	return;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	g.resize(n); weight.assign(n, 0);
	REP(i, n - 1) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	SegTree<ll> seg(n + 1,  [] (ll a, ll b) { return max(a, b); }, -1);
	dfs(0, -1, 1, 0, seg);
	ans.resize(n - 1);
	calc(0, -1, 0);
	DUMP(ans);
	return 0;
}

/* --------------------------------------- */


Measured memory_bytes: 151168
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <bits/extc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define mt make_tuple
//#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 1000000007
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
#define bpc __builtin_popcount
#define base 1000000000000000000ll
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
#define mr mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll mul(ll a,ll b,ll c){return (a*b-(ll)((ld)a*b/c)*c+c)%c;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=mul(ans,a,c);a=mul(a,a,c),b>>=1;}return ans;}

using namespace std;
//using namespace __gnu_pbds;

const ld pi = acos(-1);
const ull ba=233;
const db eps=1e-5;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=200000+10,maxn=2000000+10,inf=0x3f3f3f3f;

int a[N];
int main()
{
    int n,k;scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    deque<int>q;
    set<int>s;
    int ans=n-k+1;
    for(int i=1;i<=n;i++)
    {
        if(i>=k)s.erase(a[i-k+1]);
        s.insert(a[i]);
        while(q.size()&&i-q.front()>=k-1)q.pop_front();
        while(q.size()&&a[q.back()]>a[i])q.pop_back();
        q.pb(i);
        if(i>=k&&i!=n&&q.size()<k-1)
        {
            int x=*s.begin();
            if(a[i-k+1]>x)continue;
            x=*(--s.end());
            if(x>a[i+1])continue;
            ans--;
//            printf("%d %d %d\n",i,a[i-k+1],a[i+1]);
        }
    }
    q.clear();
    int num=0;
    for(int i=1;i<=n;i++)
    {
        while(q.size()&&i-q.front()>=k)q.pop_front();
        while(q.size()&&a[q.back()]>a[i])q.pop_back();
        q.pb(i);
        if(i>=k&&q.size()==k)num++;
    }
    printf("%lld\n",ans-max(0,num-1));
    return 0;
}
/********************

********************/


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

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<int> x(n); rep(i, n) cin >> x[i];

	int ans = (int)1e9;
	for (int i = 1; i <= 100; i++) {
		int cost = 0;
		rep(j, n) {
			cost += (x[j] - i) * (x[j] - i);
		}
		ans = min(ans, cost);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<ll> V;
typedef pair<ll,ll> P;
typedef map<ll,ll> M;

#define REP(i,n) for(ll (i) = 0; (i) < (n); ++(i))


int main(){
    int n,f;
    cin >> n >> f;
    vector<vector<string>> v(n);
    map<pair<string,string>, int> mst;
    REP(i,n){
        int m;
        cin >> m;
        v[i].resize(m);
        for(auto& x : v[i])
            cin >> x;
        REP(j,m){
            for(int k = j + 1; k < m; ++k){
                mst[make_pair(min(v[i][j],v[i][k]),max(v[i][j],v[i][k]))]++;
            }
        }
    }
    vector<pair<string,string>> vps;
    for(auto& x : mst)
        if(x.second >= f)
            vps.push_back(x.first);

    sort(vps.begin(), vps.end());
    cout << vps.size() << endl;
    for(auto& x : vps)
        cout << x.first << " " << x.second << endl;
}



Measured memory_bytes: 3592
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	static Scanner sc = new Scanner(System.in);

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte()) return buffer[ptr++];
			else return -1;
		}

		private static boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

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

	public static void main(String[] args){

		solve_abc163_a();
	}
  	public static void solve_abc163_a(){

		FastScanner sc = new FastScanner(System.in);
		
		double r = sc.nextDouble();
		double ans = 2.0 * r * Math.PI;
		System.out.println(ans);
		


	}

}

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

// プロトタイプ宣言
int Solve(int,int,int);
// ここまで

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

	int y,m,d;
	for(int i=0;i<n;i++){
		cin>>y>>m>>d;
		cout<<Solve(y,m,d)<<endl;
	}

	return 0;
}



int Solve(int y, int m, int d){
	int ans=1;

	if(y%3==0 || m%2) ans+=20-d;
	else ans+=19-d;
	m++;

	while(m<=10){
		if(m%2 || y%3==0 )ans+=20;
		else ans+=19;

		m++;
	}

	y++;
	while(y<1000){
		if(y%3) ans += (20+19)*5;
		else ans+=20*10;

		y++;
	}

	return ans;
}



Measured memory_bytes: 3040
#include <stdio.h>

using namespace std;

int main(){
	int a,b,c,count = 0;
	scanf("%d %d %d",&a,&b,&c);
	for(int i = a; i <= b; i++){
		if(c%i == 0) count++;
	}
	printf("%d\n",count);
}



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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 111111;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    int a[2010];
    for(int i=0;i<n;i++)cin>>a[i];
    int res=0,rr=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i==j)continue;
            if(i<j&&a[i]>a[j]){
                res++;
                res%=mod;
            }
            if(i>j&&a[i]>a[j]){
                rr++;
                rr%=mod;
            }
        }
    }
    int ll = (k*(k+1)/2)%mod;
    int kk = (k*(k-1)/2)%mod;
    int x=res*ll%mod;
    int y=rr*kk%mod;
    cout<<(x+y)%mod<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
 
int main(){
    int N;
    int ans  ;
    cin >> N;
    ans = 1000 - N%1000;
    if(ans == 1000)ans = 0;
    cout << ans << endl;
    return 0;
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
const ul mod = 1000000007;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x;
    cin >> x;
    if (x) {
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }
    return 0;
}



Measured memory_bytes: 3648
#include<cstdio>
int a[100000];
int partition(int *a,int p,int r){
    int x=a[r];
    int i=p-1;
    for(int j=p;j<r;j++){
        if(a[j]<=x){
            i++;
            int tmp=a[i]; a[i]=a[j]; a[j]=tmp;
        }
    }
    int tmp=a[i+1]; a[i+1]=a[r]; a[r]=tmp;
    return i+1;
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int q=partition(a,0,n-1);
    for(int i=0;i<q;i++){
        printf("%d ",a[i]);
    }
    printf("[%d]",a[q]);
    for(int i=q+1;i<n;i++){
        printf(" %d",a[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2952
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    string s;
    cin >> s;
    bool yes = (s[2] == s[3]) && (s[4] == s[5]);
    cout << (yes ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bitset<100005>RED;
int ss[100005];
int main()
{
	int n,m,a,b;
	RED[1]=true;
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++)ss[i]=1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d",&a,&b);
		if(RED[a])
		{
			if(ss[a]==1)
			{
				RED[a]=0;
				RED[b]=1;
			}
			else
			{
				RED[b]=1;
			}
			ss[b]++;
			ss[a]--;
		}
		else
		{
			ss[b]++;
			ss[a]--;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)if(RED[i])ans++;
	printf("%d",ans);
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << " "
#define debugl(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main () {
	int N; cin >> N;
	int ans = 0;
	rep2(i, 1, N + 1) {
		if (i % 2 == 0) continue;
		int cnt = 0;
		rep2(j, 1, i + 1) {
			if (i % j == 0) cnt++;
		}		
		if (cnt == 8) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int x,y,z;
    cin >>x;
    cin >>y;
    cin >>z;
    if(x>y){
        int temp =x;
        x=y;
        y=temp;
    }
    if(y>z){
        int temp =y;
        y=z;
        z=temp;
    }
    if(z>x){
        int temp =z;
        z=x;
        x=temp;
    }
    if(z>y){
        int temp =z;
        z=y;
        y=temp;
    }
    if(y>x){
        int temp =y;
        y=x;
        x=temp;
    }
    if(x>z){
        int temp =x;
        x=z;
        z=temp;
    }
    cout << x << " " << y << " " << z << endl;
}


Measured memory_bytes: 3080
#include <stdio.h>
int main(void){
	int H,W,N,tail=0;
	scanf("%d %d",&H,&W);
	scanf("%d",&N);
	int a[N],c[H][W];
	int queue[10001];
	for(int i=0;i<N;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<a[i];j++){
			queue[tail] = i+1;
			tail++;
		}
	}
			tail=0;
	for(int j=0;j<H;j++){
		for(int i=0;i<W;i++){
			if(j%2 ==0){
			printf("%d ",queue[j*W+i]);
			}else{
				printf("%d ",queue[j*W-i+W-1]);
			}
		}
			printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
import           Control.Applicative
import           Control.Monad
import qualified Data.Vector                   as V

main :: IO ()
main = do
  s <- getLine

  print $ (f . init) s

f ""  = 0
f [_] = 0
f s | (odd . length) s               = (f . init) s
    | take (hl s) s == drop (hl s) s = length s
    | otherwise                      = (f . init) s
  where hl s = length s `div` 2

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
const long long INF = numeric_limits<long long>::max();
int main()
{
    int K, A, B;
    cin >> K;
    cin >> A >> B;
    REP2(i, A, B+1) {
        if (i % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

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

using namespace std;

int main(){
	int N, M, res;
	
	cin >> N;
	vector<int> T(N);

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

	cin >> M;
	vector<int> P(M);
	vector<int> X(M);

	for (int j = 0; j < M; j++){
		cin >> P[j] >> X[j];
	}

	for (int j = 0; j < M; j++){
		res = 0;

		for (int i = 0; i < N; i++){
			if (i+1 == P[j]){
				res += X[j];
			}
			else{
				res += T[i];
			}
		}

		cout << res << endl;
	}

}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const lb PI=3.14159265359;

int main(){

  ll n;cin>>n;

  ll ans=0;
  repr(i,n,1){
    if(to_string(i).size()%2==1)ans++;
  }
  out(ans);

  return 0;
}


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

int main()
{
  int n;
  std::cin >> n;
  std::vector<int> v(n);
  for (int i = 0; i < n; i++) {
    std::cin >> v.at(i);
  }
  int total = 0;
  for (int i = 0; i < n; i++) {
    total += v.at(i);
  }
  int thumbnail = 0;
  for (int i = 1; i < n; i++) {
    if (abs(total - v.at(i) * n) < abs(total - v.at(thumbnail) * n)) {
      thumbnail = i;
    }
  }
  std::cout << thumbnail << '\n';
  return 0;
}


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

using namespace std;

const int MAXN = 305;
const int MOD = 998244353;

int n,ans;
int f[MAXN][MAXN][MAXN];
int g[MAXN][MAXN][MAXN];

char s[MAXN];

bool G(int T,int j,int R0,int R1)
{
	int r[2] = {R0,R1};
	if (R0 + R1 > n - j + 1)
		return 0;
	if (j > n)
		return 1;
	if (!T)
		return 0;
	if (j == n)
		return 1;
	int &res = g[T][j][R0];
	if (~res)
		return res;
	res = G(T - 1,j + 1,r[0],r[1]);
	if (r[s[j] - '0'])
	{
		r[s[j] - '0']--;
		res |= G(T - 1,j + 2,r[0],r[1]);
		r[s[j] - '0']++;
		r[s[j] - '0']--;
		r[(s[j + 1] - '0') ^ 1]++;
		res |= G(T - 1,j + 1,r[0],r[1]);
		r[s[j] - '0']++;
		r[(s[j + 1] - '0') ^ 1]--;
	}
	if (r[s[j + 1] - '0'])
	{
		r[s[j + 1] - '0']--;
		res |= G(T - 1,j + 2,r[0],r[1]);
		r[s[j + 1] - '0']++;
	}
	return res;
}

int main()
{
	memset(g,-1,sizeof(g));
	scanf("%s",s + 1);
	n = strlen(s + 1);
	int cnt[2] = {0};
	for (int i = 1;i <= n;i++)
		cnt[s[i] - '0']++;
	reverse(s + 1,s + n + 1);
	f[0][0][0] = 1;
	for (int i = 0;i < n;i++)
		for (int j = 0;j <= i;j++)
			for (int k = 0;k <= i;k++)
				if (f[i][j][k])
				{
					if (s[j + 1] == '0')
					{
						(f[i + 1][j + 1][k + 1] += f[i][j][k]) %= MOD;
						(f[i + 1][j][k] += f[i][j][k]) %= MOD;
					}
					else
					{
						(f[i + 1][j][k + 1] += f[i][j][k]) %= MOD;
						(f[i + 1][j + 1][k] += f[i][j][k]) %= MOD;
					}
				}
	for (int i = 1;i <= n;i++)
	{
		int c[2] = {0};
		for (int j = 0;j <= i;j++)
		{
			if (j > 0)
				c[s[j] - '0']++;
			for (int k = 0;k <= i;k++)
			{
				if (!f[i][j][k])
					continue;
				if (G(n - i,j + 1,k - c[0],i - k - c[1]))
					(ans += f[i][j][k]) %= MOD;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 169688
#include<stdio.h>
int main(){
int x,y,a,b,c;
  scanf("%ld%ld",&x,&y);
  if(x==1){
    a=300000;
  }else if(x==2){
a=200000;
  }else if(x==3){
    a=100000;
  }else{
    a=0;
  }
if(y==1){
    b=300000;
  }else if(y==2){
b=200000;
  }else if(y==3){
    b=100000;
  }else{
    b=0;
  }
  
  if(a==300000&&b==300000){
    c=a+b+400000;
  }else{
    c=a+b;
  }
printf("%d\n",c);
}
    


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int n, s, cnt;
int a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

void dfs(int i, int sum, int k) {

    if (k == n && sum == s) { cnt++; }

    if (i == 10 || k == n || sum > s) { return; }

    dfs(i + 1, sum + a[i], k + 1);

    dfs(i + 1, sum, k);
}

int main() {
    while (cin >> n >> s) {
        if (!n && !s) { break; }
        cnt = 0;
        dfs(0, 0, 0);
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 3016
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;
int gcd(ll a, ll b) { return (b % a == 0) ? a : gcd(b - a * (b / a), a); }
int main()
{
	ll i,j,n,k;
	cin>>n>>k;ll a[n],dp[n];
	for(i=0;i<n;i++){cin>>a[i];}
	dp[0]=0;dp[1]=abs(a[1]-a[0]);
	for(i=2;i<n;i++)
	{
	      ll ans=mod;
       for(j=i-1;j>=0&&j>=i-k;j--)
       {
      ans=min(ans,dp[j]+abs(a[i]-a[j]));
       }
       dp[i]=ans;
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 5168
import java.util.Scanner;
 class Main {  
				public static void main(String[] args) {
				Scanner reader =new Scanner (System.in);
				int arr[]=new int [101010];
				int k;
			   int n;
			   int cnt=0;
			   n=reader.nextInt();
			   k=reader.nextInt();
			   for(int i=0;i<n;i++)
			   {
				   arr[i]=reader.nextInt();
			   }
			   for(int i=0;i<n;i++)
			   {
				   if(arr[i]>=k)
				   {
					   cnt++;
				   }
			   }
			   System.out.println(cnt);
			}
	}

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    string s, t; cin >> s >> t;

    int p = INF;

    for (int i = 0; i < s.size() - t.size() + 1; ++i) {
        if (s[i] == t[0] || s[i] == '?') {

            bool match = true;

            for (int j = 1; j < t.size(); ++j) {
                if (s[i+j] != '?' && s[i+j] != t[j]) {
                    match = false;
                    break;
                }
            }

            if (match) {
                p = i;
            }
        }
    }

    if (p == INF) {
        puts("UNRESTORABLE");
        return 0;
    }

    for (int i = 0; i < t.size(); ++i) {
        s[p+i] = t[i];
    }

    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '?') {
            s[i] = 'a';
        }
    }

    cout << s << endl;
}

Measured memory_bytes: 256
'use strict'

function main(inp) {
  inp = inp.trim().split('\n')
  const N = Number(inp.shift())
  inp = inp[0].split(' ').map(n => Number(n)).sort((a, b) => a - b)
  let past = inp[0]
  for (let i = 1; i < inp.length; i++) {
    if (past === inp[i]) return console.log('NO')
    past = inp[i]
  }
  return console.log('YES')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 38568
n = int(input())
li = list(map(int, input().split()))
li = [[li[i], i] for i in range(n)]
li.sort()
count = 0
for i in range(n):
    if count > 2:
        print("NO")
        break
    if li[i][1] != i:
        count+=1
else:
    if count % 2 == 0: 
        print("YES")
    else:
        print("NO")

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

int main () {
	string s;
	while (cin >> s,s!="-"){
		int m, h;
		cin >> m;
		for (int i=0;m>i;i++){
			cin >> h;
			s=s.substr(h)+s.substr(0,h);
		}
		cout << s << endl;
	}
}


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

int main() {
  ll n;
  cin >> n;
  string s = "";
  int cnt = 0;
  ll k = 0;
  while (n >= 26) {
    k = n % 26;
    n /= 26;
    cnt++;
    if (k == 0) {
      n -= 1;
      k = 26;
    }
    s.push_back((char)((int)'a' + k - 1));
  }
  if (n != 0) s.push_back((char)((int)'a' + n - 1));

  reverse(s.begin(), s.end());
  cout << s << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
typedef long long ll;
const int MAX = 999999999;

int main(){
    int A, B;
    string S;
    cin >> A >> B >> S;

    int cnt[15] = {}, idx = 0;
    for(auto itr = S.begin(); itr != S.end(); itr++){
        if(*itr == '-'){
            idx ++;
            continue;
        }

        cnt[idx] ++;
    }

    if(cnt[0] == A && cnt[1] == B && idx == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
N, M, X, Y = map(int,input().split())
Xl = list(map(int,input().split()))
Yl = list(map(int,input().split()))

if max(Xl) < min(Yl) and max(Xl) < Y and min(Yl) > X:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3060
//g++  7.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXX 1000000000

bool inBounds(ll x,ll y,ll N,ll M)
{
    return(x >= 0 && x < N && y >= 0 && y < M);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N,M,K; cin>>N>>M>>K;
    ll d[N][M];
    ll vis[N][M];
    
    string s[N];
    ll x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2;
    
    for(ll i=0;i<N;++i)
    {
        cin>>s[i];
        for(ll j=0;j<M;++j)
        {
            d[i][j] = MAXX;
            vis[i][j] = 0;
        }
    }
    
    queue<pair<ll,ll>> q;
    q.push({x1 - 1,y1 - 1});
    vis[x1 - 1][y1 - 1] = 1;
    d[x1 - 1][y1 - 1] = 0;
    
    while(!q.empty())
    {
        ll x = q.front().first;
        ll y = q.front().second;
        q.pop();
        
        //cout<<x + 1<<" "<<y + 1<<" "<<d[x][y]<<endl;
        
        for(ll c=1;c<=K;++c)
        {
            if(inBounds(x + c,y,N,M) && (s[x + c][y] != '@') && (d[x + c][y] > d[x][y]))
            {
                if(!vis[x + c][y])
                {
                    d[x + c][y] = d[x][y] + 1;
                    vis[x + c][y] = 1;
                    q.push({x + c,y});
                }
            }
            else
                break;
        }
        
        for(ll c=1;c<=K;++c)
        {
            if(inBounds(x - c,y,N,M) && (s[x - c][y] != '@') && (d[x - c][y] > d[x][y]))
            {
                if(!vis[x - c][y])
                {
                    d[x - c][y] = d[x][y] + 1;
                    vis[x - c][y] = 1;
                    q.push({x - c,y});
                }
            }
            else
                break;
        }
        
        for(ll c=1;c<=K;++c)
        {
            if(inBounds(x,y + c,N,M) && (s[x][y + c] != '@') && (d[x][y + c] > d[x][y]))
            {
                if(!vis[x][y + c])
                {
                    d[x][y + c] = d[x][y] + 1;
                    vis[x][y + c] = 1;
                    q.push({x,y + c});
                }
            }
            else
                break;
        }
        
        for(ll c=1;c<=K;++c)
        {
            if(inBounds(x,y - c,N,M) && (s[x][y - c] != '@') && (d[x][y - c] > d[x][y]))
            {
                if(!vis[x][y - c])
                {
                    d[x][y - c] = d[x][y] + 1;
                    vis[x][y - c] = 1;
                    q.push({x,y - c});
                }
            }
            else
                break;
        }
        
    }
    
    if(d[x2 - 1][y2 - 1] == MAXX)
        cout<<-1<<endl;
    else
        cout<<d[x2 - 1][y2 - 1]<<endl;
}

Measured memory_bytes: 22016
import math

l, r = map(int, input().split())

if r - l >= 2019:
    print(0)
else:
    ans = 10000
    for i in range(l, r):
        for j in range(i+1, r+1):
            tmp = i * j % 2019
            if tmp < ans:
                ans = tmp
    print(ans)


Measured memory_bytes: 2940
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn is_prime(n: i64) -> bool {
    for i in 2.. {
        if i * i > n {
            return true;
        }

        if n % i == 0 {
            return false;
        }
    }
    unreachable!()
}

fn main() {
    input! {
        x: i64,
    }

    let ans = (|| {
        for i in x.. {
            if is_prime(i) {
                return i;
            }
        }
        unreachable!()
    })();

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


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


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll n,a,b;
    cin>>n>>a>>b;
    ll ans = 0;
    ll sum = a+b;
    ans = n/(sum) * a;
    n -= n/sum * sum;
    ans += min(a,n);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
// #ifndef ONLINE_JUDGE
// #include "debug.cpp"
// #endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  int a,b,c; cin >> a >> b >> c;
  swap(a,b);
  swap(a,c);
  cout << a << " " << b << " " << c;

  

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
using namespace std;
int main(){
	int n,count=0;
	string str,ring;
	cin>>str;
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>ring;
		ring+=ring;
		if(ring.find(str)!=-1){
			count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 3168
N, M = map(int, input().split())

v = [[] for _ in range(N)]
abc = []
for _ in range(M) :
    a, b, c = map(int, input().split())
    v[b-1].append((a-1, -c))
    
visited = [False] * N
visited[N-1] = True
queue = [N-1]
while queue :
    cur = queue.pop()
    for nex, cost in v[cur] :
        if not visited[nex] :
            queue.append(nex)
            visited[nex] = True
        abc.append((nex, cur, cost))
        
dist = [float('inf')] * N
dist[0] = 0

def bellmanford() :
    for i in range(N) :
        for a, b, c in abc :
            if dist[a] + c < dist[b] :
                dist[b] = dist[a] + c
                if i == N-1 :
                    return True
    return False
    
if bellmanford() :
    print('inf')
else :
    print(-dist[N-1])

Measured memory_bytes: 45164
#include <iostream>
#include <cctype>
#include <string>

using namespace std;

int main(){
  string line;
  getline( std::cin, line );

  for(int i=0,l=line.size();i<l;i++){
    if(isalpha(line[i])){
      if(islower(line[i])){
        line[i] = toupper(line[i]);
      }
      else{
        line[i] = tolower(line[i]);
      }
    }
    cout << line[i];
  }
  cout << endl;
  return 0;
}



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



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

	int N;
	cin >> N;
	VI V(N);
	
	priority_queue<double, vector<double>, greater<double> > q2;
	REP(i, N) {
		int a;
		cin >> a;
		q2.push(a);
	}
	double ans;
	double tmp;
	while (!q2.empty()) {
		double tmp,res;
		tmp = q2.top();
		q2.pop();
		res = q2.top();
		q2.pop();

		q2.push((tmp + res) / 2);

		ans = q2.top();
		q2.pop();
		if (q2.empty())break;

		q2.push(ans);

	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int[] l = new int[n];
		for(int i = 0;i < n;i++){
			l[i] = saori.saori_hayami();
		}
		Arrays.sort(l);
		int sum = 0;
		for(int i = 0;i < n-1;i++){
			sum += l[i];
		}
		if(sum > l[n-1]){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()


int main(){
  ll N,K;
  cin >> N >> K;
  if(K%2==1){
    cout << (N/K)*(N/K)*(N/K) << endl;
  }else{
    cout << (N/K)*(N/K)*(N/K)+((N+K/2)/K)*((N+K/2)/K)*((N+K/2)/K) << endl;
  }
}

Measured memory_bytes: 3620
s = input()
if s == 'RRR' :
    print(3)
if s == 'SRR' :
    print(2)
if s == 'RSR' :
    print(1)
if s == 'RRS' :
    print(2)
if s == 'SSR' :
    print(1)
if s == 'RSS' :
    print(1)
if s == 'SRS' :
    print(1)
if s == 'SSS' :
    print(0)

Measured memory_bytes: 8864
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define bit_cnt(n) (__builtin_popcountll(n))
#define substr(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;cin>>n;
  vi L(n);
  bool flag=true;
  for(int i=0;i<n;i++)cin>>L[i];
  for(int i=0;i<n;i++){
    ll sum=0;
    for(int j=0;j<n;j++)
      if(i!=j)sum+=L[j];
    //cout<<sum<<" "<<L[i]<<endl;
    if(sum<=L[i])flag=false;
  }
  Yes(flag);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void) {
  char s[200001], t[200001];
  int i = 0, a=0;
  scanf("%s", s);
  scanf("%s", t);
              
  for(i = 0; i < strlen(s); i++) {
    if(s[i] != t[i]) {
      a++;
    }
  }
              
  printf("%d", a);
  return 0;
}

Measured memory_bytes: 2484
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    double x1,y1,x2,y2,x3,y3,x4,y4,d;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4){
        d=(x2-x1)*(x4-x3)+(y2-y1)*(y4-y3);
        if(abs(d)<1e-10)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

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

	long long int d = c - a - b;

	if (d * d > 4 * a * b && d > 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <stack>
#include <map>
#include <cstdlib>
#include <cctype>
#include <cstdio>
#include <cstring>

using namespace std;

int str2arr(char s[], string A[]) {
    bool flag = true;
    string t;
    int l = strlen(s);
    int n = 0;
    for (int i = 0; i < l; i++) {
        if (isdigit(s[i]) && flag) {
            t = "";
            int j = 0;
            while (isdigit(s[i+j])) {
                t += s[i+j];
                if (i+j == l-1)
                    break;
                j++;
            }
            A[n++] = t;
            flag = false;
        }
        else if (!isdigit(s[i])) {
            A[n++] = s[i];
            flag = true;
        }
    }
    return n;
}

int Generate_RPN(int n, string A[], string B[]) {
    map<string, int> table;
    table["*"] = 1;
    table["/"] = 1;
    table["+"] = 0;
    table["-"] = 0;
    table["("] = -1;
    table[")"] = -1;
    stack<string> S;
    int j = 0;

    for (int i = 0; i < n; i++) {
        if (isdigit(A[i][0])) {
            B[j++] = A[i];
        }

        else if (A[i] == "(")
            S.push(A[i]);

        else if (A[i] == ")") {
            while (S.top() != "(") {
                B[j++] = S.top();
                S.pop();
            }
            S.pop();
        }
        else {
            while ((!S.empty()) && (table[S.top()] >= table[A[i]])) {
                B[j++] = S.top();
                S.pop();
            }
            S.push(A[i]);
        }
    }
    while (!S.empty()) {
        B[j++] = S.top();
        S.pop();
    }
    return j;
}

int calculate(int n, string s[]) {
    stack<double> St;
    double a, b;

    for (int i = 0; i < n; i++) {
        if (s[i] == "+") {
            b = int(St.top()); St.pop();
            a = int(St.top()); St.pop();
            St.push(a+b);
        }
        else if (s[i] == "-") {
            b = int(St.top()); St.pop();
            a = int(St.top()); St.pop();
            St.push(a-b);
        }
        else if (s[i] == "*") {
            b = int(St.top()); St.pop();
            a = int(St.top()); St.pop();
            St.push(a*b);
        }
        else if (s[i] == "/") {
            b = int(St.top()); St.pop();
            a = St.top(); St.pop();
            St.push(a/b);
        }
        else {
            St.push(atoi(s[i].c_str()));
        }
    }
    return int(St.top());
}

int main()
{
    int n, l, t;
    string A[101], B[101];
    char s[101];

    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%s", s);
        s[strlen(s)-1] = '\0';

        l = str2arr(s, A);
        t = Generate_RPN(l, A, B);

        cout << calculate(t, B) << endl;
    }

    return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  ll n = s.size();
  ll ans = 0;
  for(int i=0;i< 1 << (n-1);i++) {
    string t = {s[0]};
    for(int j=0;j<n-1;j++) {
      if(i >> j & 1)
        t += '+';
      t += s[j+1];
    }

    string sub = "";
    for(int k=0;k<t.size();k++) {
      if(t[k] == '+') {
        ans += stoll(sub);
        sub = "";
      }
      else {
        sub += t[k];
      }
    }
    ans += stoll(sub);
  }
  cout << ans << endl;
}


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

int main() {
  ll n,l;
  cin >> n >> l;
  
  vector<ll> v(n);
  rep(i, n)
    v[i] = l+i;
  
  ll sum = 0;
  rep(i, n)
    sum += v[i];
  
  
  rep(i ,n){
    if(v[i] == 0){
      cout << sum << endl;
      return 0;
    }
  }
  
  sort(v.begin(),v.end());
  
  if(sum >= 0)
    cout << sum - v[0] << endl;
  else
    cout << sum - v[n-1] << endl;
    
}

Measured memory_bytes: 3640