akhauriyash/Code-Regression huggingface dataset:
N,Y = map(int,input().split())
Y //= 1000
ans = (-1,-1,-1)
for Fuku in range(Y//10+1):
    Zankin = Y - 10*Fuku
    for Higu in range(Zankin // 5+1):
        Nogu = Zankin - 5*Higu
        if Fuku+Higu+Nogu == N:
            ans = (Fuku,Higu,Nogu)
print(*ans)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	int n,k;
	cin >> n >> k;
	vector<int> l(n);
	for(int i=0; i<n; i++){
		cin >> l.at(i);
	}
	sort(l.begin(), l.end());
	int ans=0;
	for(int i=0; i<k; i++){
		ans += l.at(n-1-i);
	}
	cout << ans << endl;
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll H, W;
    cin >> H >> W;
    map<char, ll> A;
    rep(h, H) {
        string temp;
        cin >> temp;
        iter(c, temp) A[c]++;
    }
    priority_queue<ll> Q;
    iter(i, A) Q.push(i.second);
    map<ll, ll> factors;
    while(H) {
        if(H % 2) {
            H--;
            factors[2] += W / 2;
            factors[1] += W % 2;
        } else {
            H -= 2;
            factors[4] += W / 2;
            factors[2] += W % 2;
        }
    }
    for(auto i = factors.rbegin();i != factors.rend();i++) {
        while(i->second) {
            auto c = Q.top();
            Q.pop();
            if(c - i->first < 0) {
                cout << "No" << endl;
                return 0;
            }
            c -= i->first;
            Q.push(c);
            i->second--;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

using namespace std;

constexpr auto none = numeric_limits<int>::max();

int N, M, L;
vector<vector<pair<int, int>>> edges;
vector<vector<pair<int, int>>> costs;

void buildCounts() {
  using Elem = tuple<int, int, int>;
  costs.resize(N + 1, vector<pair<int, int>>(N + 1, make_pair(none, 0)));
  for (int root = 1; root <= N; ++root) {
    priority_queue<Elem, vector<Elem>, greater<Elem>> q;
    q.emplace(0, -L, root);
    costs[root][root] = make_pair(0, -L);
    for (; !q.empty(); q.pop()) {
      int cnt0, neg_fuel0, node;
      tie(cnt0, neg_fuel0, node) = q.top();
      if (costs[root][node].first != cnt0 ||
          costs[root][node].second != neg_fuel0) {
        continue;
      }
      for (auto& edge : edges[node]) {
        int next, cost;
        tie(next, cost) = edge;
        int cnt = cnt0;
        int neg_fuel = neg_fuel0;
        neg_fuel += cost;
        if (0 < neg_fuel) {
          ++cnt;
          neg_fuel = cost - L;
        }
        auto cur = make_pair(cnt, neg_fuel);
        if (cur < costs[root][next]) {
          costs[root][next] = move(cur);
          q.emplace(cnt, neg_fuel, next);
        }
      }
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> M >> L;
  edges.resize(N + 1);
  for (int i = 0; i < M; ++i) {
    int A, B, C;
    cin >> A >> B >> C;
    if (C <= L) {
      edges[A].emplace_back(B, C);
      edges[B].emplace_back(A, C);
    }
  }
  buildCounts();
  int Q;
  cin >> Q;
  for (int i = 0; i < Q; ++i) {
    int s, t;
    cin >> s >> t;
    auto cnt = costs[s][t].first;
    cout << (cnt == none ? -1 : cnt) << endl;
  }
}

Measured memory_bytes: 3012
#include <bits/stdc++.h>
#define N 100005
#define ll long long
using namespace std;
ifstream in("in.txt");
int A[N], B[N];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b, m,ma=(1<<30),s=0;
    cin>>a>>b>>m;
    for(int i=1; i<=a; ++i){
        cin>>A[i];
        ma=min(ma, A[i]);
    }
    s=ma;
    ma=(1<<30);
    for(int i=1; i<=b; ++i){
        cin>>B[i];
        ma=min(ma, B[i]);
    }
    s+=ma;
    while(m--){
        cin>>a>>b>>ma;
        s=min(s, A[a]+B[b]-ma);
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
int n,a[10];
void Solve(){
    int max=0,sum=0;
    int max_i=0;
    cin>>n;
    FOR(i,0,n){ 
        cin>>a[i];
        if(a[i]>max){
            max=a[i];
            max_i=i;
        }
    }
    int flag=0;
    FOR(i,0,n){
        if(i!=max_i) sum+=a[i];
        if(sum>max){
            flag=1;
            break;
        } 
    }
    if(flag==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
int main(){
    Solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	std::string str;
	std::cin >> str;
	for(auto c : str) std::cout << (c == '?' ? 'D' : c);
	std::cout << std::endl;
}

Measured memory_bytes: 3792
#include <iostream>
#include <algorithm>
#include <deque>
using namespace std;
typedef long long lint;
typedef pair<lint,lint> pp;

lint N;
const lint MOD = 1e9+7;
lint dp[61][4];

void init(deque<pp>& a){
	sort(a.begin(),a.end());
	for(int i=1;i<(int)a.size();i++){
		if(a[i-1].first==a[i].first){
			a[i].second += a[i-1].second;
			a[i].second %= MOD;
			a[i-1].first = -1;
		}
	}
	sort(a.begin(),a.end());
	while(!a.empty()&&a[0].first<0)a.pop_front();
}

int main(){
	ios::sync_with_stdio(false);

	cin>>N;
	lint k;
	for(k=1;k<=N;k<<=1);
	k--;

	deque<pp> a;
	a.push_back({k-N,1});
	a.push_back({k-N+1,1});
	a.push_back({k-N+2,1});
	a.push_back({k-N+3,0});
	lint i;
	for(i=1;i<=60;i++){
		for(auto& j:a){
			if(j.first<4){
				dp[i-1][j.first] += j.second;
				dp[i-1][j.first] %= MOD;
				j.first = -1;
			}
			j.first>>=1;
		}
		init(a);
		int l = a.size();
		for(int j=0;j<l;j++){
			a.push_back({a[j].first+1,a[j].second});
			a.push_back({a[j].first+2,a[j].second});
		}
		init(a);

		if((1ll<<i)>k)break;
		for(int j=0;j<2;j++){
			dp[i][j] += dp[i-1][j*2]+dp[i-1][j*2+1]; 
			dp[i][j] %= MOD;
		}
		for(int j=3;j>=0;j--){
			if(j>=2)dp[i][j] += dp[i][j-2];
			if(j>=1)dp[i][j] += dp[i][j-1];
			dp[i][j] %= MOD;
		}
	}

	cout << (dp[i-1][0]+dp[i-1][1])%MOD << endl;
	return 0;
}

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


int main()
{
	ios::sync_with_stdio(false);
	string s,ss;
	string a,b;
	cin>>s;
	int q,cnt=0;
	cin >>q;
	while(q--){
		int t;
		cin >>t;
		if(t==1) cnt++;
		else
		{
			int f;
			cin >>f>>ss;
			if(f==1)
			{
				if(cnt%2) b+=ss;
				else a=ss+a; 
			}
			else
			{
				if(cnt%2) a=ss+a;
				else b+=ss;
			}
		}
	}
	int x=a.size(),y=b.size(),z=s.size();
	if(cnt%2){
		
		for(int i=y-1;i>=0;i--) cout <<b[i];
		for(int i=z-1;i>=0;i--) cout <<s[i];
		for(int i=x-1;i>=0;i--) cout <<a[i];
		
	}
	else{
		for(int i=0;i<x;i++) cout <<a[i];
		for(int i=0;i<z;i++) cout <<s[i];
		for(int i=0;i<y;i++) cout <<b[i];
	}
}

Measured memory_bytes: 1104
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<ll, ll> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}



int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	// freopen("settling.in", "r", stdin);
	// freopen("settling.out", "w", stdout);
	
	const ll mod = 1e9 + 7;
	int n;
	cin >> n;

	ll sum = 0, ans = 0;
	for(int i = 0; i < n; i++){
		ll x;
		cin >> x;
		ans = (ans + x * sum % mod) % mod;
		sum = (sum + x) % mod;
	}

	cout << ans << endl;
	

	return 0;
}


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

int N,Ma,Mb,ans;
int dp[50][500][500];
int inf=1000000000;
vector<int> a(50),b(50),c(50);

int main(){
  for(int i=0;i<=45;i++){
    for(int j=0;j<=480;j++){
      for(int k=0;k<=480;k++){dp[i][j][k]=inf;}
    }
  }
  dp[0][0][0]=0;
  cin >> N >> Ma >> Mb;
  for(int i=0;i<N;i++)cin >> a[i] >> b[i] >> c[i];;
  for(int i=0;i<N;i++){
    for(int j=0;j<=400;j++){
      for(int k=0;k<=400;k++){
        dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
        dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
      }
    }
  }
  int ans=inf;
  for(int j=1;j<=400;j++){
    for(int k=1;k<=400;k++){
      if(Ma*k==Mb*j){ans=min(ans,dp[N][j][k]);}
    }
  }
  if(ans==inf){ans=-1;}
  cout << ans << endl;
}

Measured memory_bytes: 45184
using System;

namespace atcorder
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            atcorder.Happy_Birthday_.Run();
        }
    }
    public class Happy_Birthday_
    {
        public Happy_Birthday_()
        {
        }
        public static void Run(){
            int A,B;
            string s;
            s = Console.ReadLine();
            A = int.Parse(s.Split(' ')[0]);
            B = int.Parse(s.Split(' ')[1]);
            if (A <= 8 && B <= 8) Console.WriteLine("Yay!");
            else Console.WriteLine(":(");
        }
    }
}


Measured memory_bytes: 11092
S = list(input())
ans = "Yes"
if S.count("W") > 0:
  if "E" not in S: ans = "No"
if S.count("E") > 0:
  if "W" not in S: ans = "No"
if S.count("N") > 0:
  if "S" not in S: ans = "No"
if S.count("S") > 0:
  if "N" not in S: ans = "No"
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template< typename T > using matrix = vector< vector< T > >;

vector< int > divisor(int n) {
  vector< int > ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
} 

//FUNCTION  
void solve(void)
{
  int N,M;
  cin>>N>>M;
  map<int,int> mp;
  for (int i = 0; i < M; i++)
  {
    int A,B;
    cin>>A>>B;
    mp[A]++;
    mp[B]++;
  }
  int ANS = 1;
  for (auto itr = mp.begin(); itr != mp.end(); itr++)
  {
    if(itr->second%2 == 1)ANS = 0;
  }
  cout<<(ANS?"YES":"NO")<<endl;
  
  
  
  

  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


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

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


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char s[4],t[4];
    scanf("%s %s",s,t );
    int i,cnt=0;
    for(i=0;i<3;i++){
        if(s[i]==t[i]){
            cnt++;
        }
    }
    printf("%d\n",cnt );
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define INS(x) string (s); cin >> s
#define INL(x) ll (x); cin >> x
#define VINT(a,n) vector<int> a(n,0)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()

int main () {
  IN(n);
  VIN(a, n+1);
  VIN(b, n);
  VINT(c, n+1);
  int temp;
  c[n]=min(b[n-1], a[n]);
  c[n-1]=min(b[n-1]-c[n], a[n-1]);
  for(int i=n-1; i>=0; i--){
    temp = min(a[i]-c[i], b[i-1]);
    c[i]+=temp;
    c[i-1]=min(b[i-1]-temp, a[i-1]);
  }
  
  ll sum;
  sum=accumulate(ALL(c), 0LL);
  cout<<sum;

  
}


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

using namespace std;

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

  long N,M,Q; cin>>N>>M>>Q;

  vector<int> par(N);
  iota(par.begin(), par.end(), 0);
  auto root = [f=[&](auto g, int x) {
    if (par[x] == x)
      return x;
    return par[x] = g(g, par[x]);
  }](int x) {
    return f(f, x);
  };
  auto unite = [&](int x, int y) {
    return root(y) != (par[root(y)] = root(x));
  };

  vector<pair<int, int>> sconds, dconds;
  for (int q = 0; q < Q; q++) {
    int a, b, c; cin>>a>>b>>c;
    if (c == 0)
      sconds.emplace_back(a, b);
    else
      dconds.emplace_back(a, b);
  }
  long c_graph = N;
  for (auto cond : sconds) {
    if (unite(cond.first, cond.second))
      c_graph--;
  }
  for (auto cond : dconds) {
    if (root(cond.first) == root(cond.second)) {
      cout << "No" << endl;
      return 0;
    }
  }
  int c_min = dconds.empty() ? N-1 : N;
  bool ans = (M >= c_min) and (M <= N + c_graph*(c_graph-3)/2);
  cout << (ans ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 1912
// Entrance Examination

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

float t, x;

int main() {
    cin >> t >>x;
    cout << t / x << endl;

    return 0;
}


Measured memory_bytes: 888
import scala.io.StdIn._
object Main {
  def main(args:Array[String]) ={
    val read = readLine().split(' ').map(_.toInt)

    var Tturn = read(2) / read(1)
    if(read(2) % read(1) != 0) Tturn += 1
    var Aturn = read(0) / read(3)
    if(read(0) % read(3) != 0) Aturn += 1
    
    if(Tturn <= Aturn) println("Yes")
    else println("No")
  }
}

Measured memory_bytes: 54536
#include<iostream>

using namespace std;

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

ll n, a, b;
ll x[100000];
ll f;

int main(){
    cin >> n >> a >> b;
    REP(i, n){
        cin >> x[i];
    }

    REP(i, n-1){
        f += min(a*(x[i+1]-x[i]), b);
    }
    cout << f << endl;
}


Measured memory_bytes: 1024
import sys

input = sys.stdin.readline

def main():
    ans = 0
    N = int(input())
    if N%1000 == 0:
      ans = 1000*((N//1000))-N
    else:
      ans = 1000*((N//1000)+1)-N
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9168
#include<bits/stdc++.h>
using namespace std;
long long n,u,v,a[5001],b[5001],c[5001],d[5001][5001],dp[5001][5001],mod=1e9+7;
inline long long read()
{
    long long sum=0,x=1;
    char ch=getchar();
    while (ch<'0'||ch>'9')
	{
        if (ch=='-')
          x=-1;
        ch=getchar();
    }
    while (ch>='0'&&ch<='9')
	{
        sum=sum*10+ch-'0';
        ch=getchar();
    }
    return sum*x;
}
inline void write(long long x)    
{
    if (x<0)
    {
    	putchar('-');
    	x=-x;
	}
	if (x>9)
      write(x/10);
    putchar(x%10+'0');
}
inline void dfs(long long u,long long fa)
{
    a[u]=dp[u][1]=1;
    for (register long long i=1;i<=d[u][0];++i)
	{
        long long v=d[u][i];
        if (v==fa)
		  continue;
        dfs(v,u);
        for (register long long j=0;j<=a[u];++j)
		{
            b[j]=dp[u][j];
            dp[u][j]=0;
        }
        for (register long long j=0;j<=a[u];++j)
          for (register long long k=0;k<=a[v];++k)
            dp[u][j+k]=(dp[u][j+k]+dp[v][k]*b[j]%mod+mod)%mod;
        a[u]+=a[v];
    }
    for (register long long i=0;i<=a[u];i+=2)
      dp[u][0]=(dp[u][0]-dp[u][i]*c[i]%mod+mod)%mod;
}
int main()
{
    n=read();
    for (register long long i=1;i<n;++i)
	{
        u=read();v=read();
        d[u][++d[u][0]]=v;
        d[v][++d[v][0]]=u;
    }   
    c[0]=1;
    for (register long long i=2;i<=n;i+=2)
	  c[i]=(c[i-2]*(i-1)+mod)%mod;
    dfs(1,0);
    write(mod-dp[1][0]);
    return 0;
}

Measured memory_bytes: 112516
while True:
    oddline = ''
    evenline = ''
    h, w = map(int, raw_input().split())
    if h+w==0:
        break
    for y in xrange(w):
        if y%2==0:
            oddline += '#'
            evenline += '.'
        else:
            oddline += '.'
            evenline += '#'
    for x in xrange(h):
        if x%2==0:
            print oddline
        else:
            print evenline
    print ''

Measured memory_bytes: 6436
class Class{
    static void Main(){
        string str = System.Console.ReadLine();
        string[] arr = str.Split(' ');
        
        int[] intArr = new int[arr.Length];
        
        for(int i = 0 ; i < arr.Length;i++){
            int.TryParse(arr[i],out intArr[i]);
        }
        
        int a = intArr[0] * intArr[1];
        int b = intArr[0]*2 + intArr[1]*2;
        
        System.Console.WriteLine(a + " " + b);
                
    }
}


Measured memory_bytes: 15764
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int heart[] = new int[13];
        int diamond[] = new int[13];
        int club[] = new int[13];
        int spades[] = new int[13];
        int n = sc.nextInt();
        int t;
        String c;
        for(int i=0;i<n;i++){
        	c = sc.next();
        	t = sc.nextInt();
        	if(c.equals("S"))spades[t-1]=t;
        	else if(c.equals("H"))heart[t-1]=t;
        	else if(c.equals("D"))diamond[t-1]=t;
        	else if(c.equals("C"))club[t-1]=t;
        	else System.out.println("EEE");
        }

        for(int i=0;i<13;i++)if(spades[i]==0)System.out.println("S "+(i+1));
        for(int i=0;i<13;i++)if(heart[i]==0)System.out.println("H "+(i+1));
        for(int i=0;i<13;i++)if(club[i]==0)System.out.println("C "+(i+1));
        for(int i=0;i<13;i++)if(diamond[i]==0)System.out.println("D "+(i+1));
        sc.close();
    }

}



Measured memory_bytes: 26328
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll r, d, x;
string str;

int main(){
	cin >> r >> d >> x;
	for(ll i = 1; i <= 10; i++){
		x = r*x-d;
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
	int n, m, c[20];
	int dp[50001];

	scanf("%d%d", &n, &m);
	for (int i = 0;i < m;i++) {
		scanf("%d", &c[i]);
	}
	for (int i = 0;i <= n;i++) {
		dp[i] = 1000000;
	}

	dp[0] = 0;
	for (int i = 1;i <= n;i++) {
		for (int j = 0;j < m;j++) {
			if (c[j] <= i) {
				dp[i] = min(dp[i], dp[i - c[j]] + 1);
			}
		}
	}

	printf("%d\n", dp[n]);

	return 0;
}

Measured memory_bytes: 2900
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N,M;
    cin >> N >> M;
    vector<pair<int,bool> > balls(N,make_pair(1,false));
    balls[0].second=true;
    rep(i,M){
        int x,y;
        cin >> x >> y;
        x--;y--;
        balls[x].first--;
        balls[y].first++;
        if(balls[x].second)balls[y].second=true;
        if(balls[x].first==0)balls[x].second=false;
    }
    int res = 0;
    rep(i,N){
        if(balls[i].second)res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

int main(){
  int p, a, b, c, d, flag = 0;
  while(scanf("%d", &p) && p){
    scanf("%d%d%d%d", &a, &b, &c, &d);
    int e, f, g, h;
    e = f = g = h = 0;
    int res = INF;
    rep(i, a+1) rep(j, b+1) rep(k, c+1) rep(l, d+1){
      int change = i*10 + j*50 + k*100 + l*500 - p;
      //      if(j != 20) continue;
      if(change < 0) continue;
      int ca = (change%50)/10, cb = (change%100)/50, cc = (change%500)/100, cd = change/500;
      //      if(((change % 50)/10 && i) || ((change % 100)/50 && j) || ((change % 500)/100 && k) || ((change / 500) && l)) continue;
      if((ca && i) || (cb && j) || (cc && k) || (cd && l)) continue;
      //      printf("%d %d %d %d\n", i, j, k, l);
      //      printf("%d %d %d %d\n", ca, cb, cc, cd);
      //      printf("%d %d\n", res, (a-i+ca) + (b-j+cb) + (c-k+cc) + (d-l+cd));
      if(res > (a-i+ca) + (b-j+cb) + (c-k+cc) + (d-l+cd)){
	//       	printf("price: %d, s %d\n", p, i*10+j*50+k*100+l*500);
	//		printf("shiharai %d %d %d %d\n", i, j, k, l);
	//		printf("change %d\n", change);

	//		printf("maisuu %d %d\n", a-e+b-f+c-g+d-h, a-i+ca+b-j+cb+c-k+cc+d-l+cd);
	//		printf("kokono maisuu%d %d %d %d\n", a-i+ca, b-j+cd, c-k+cc, d-l+cd);

	e = i;
	f = j;
	g = k;
	h = l;
	res = a-e+ca + b-f+cb + c-g+cc + d-h+cd;
      }
    }
    if(flag) puts("");
    if(e) printf("10 %d\n", e);
    if(f) printf("50 %d\n", f);
    if(g) printf("100 %d\n", g);
    if(h) printf("500 %d\n", h);
    flag = 1;
  }
  return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
using ll = long long;

int f(double x){
  int y = x;
  if(x - y >= 0.5){y++;}
  return y;
}

int main(){
  int n;
  cin >> n;
  vector<int> v(n, 0);
  int sum = 0;
  for(int i = 0; i < n; i++){
    cin >> v[i];
    sum += v[i];
  }
  double sum1 = sum;
  double n1 = n;
  double ave = sum1 / n1;
  int res = f(ave);

  int ans = 0;
  for(int i = 0; i < n; i++){
    ans += pow(v[i]-res, 2);
  }
  cout << ans << endl;

}

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

arr = [[[0 for _ in range(101)] for _ in range(101)] for _ in range(101)]

def g(x,y,z):
    return x**2+y**2+z**2+x*y+x*z+y*z

table = [0]*10001

for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            re = g(i,j,k)
            if re <= 10000:
                table[re]+= 1



for i in range(1,n+1):
    print(table[i])

Measured memory_bytes: 84408
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        double ans = 0;
        for (int i = 0; i < n; i++) {
            double x = scanner.nextDouble();
            ans += scanner.next().equals("JPY") ? x : x * 380000;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22612
// ~maqsat~
/*    
**	  “Anyone who has never made a mistake has never tried anything new.”
**    © Albert Einstein
*/

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")

// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define in insert
#define pb push_back
#define eb emplace_back
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define count1 __builtin_popcountl
#define debug(x) cerr << (#x) << " = " << (x) << "\n"
#define ACCELERATE ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> inline void cmin(T &a, T b) { a = min(a, b); }
template <class T> inline void cmax(T &a, T b) { a = max(a, b); }

const int oo = 0x3f3f3f3f;
const ll N = 2e5 + 345;
const ll MOD = 1e9 + 7;
const ll INF = 1e10 + 9;
const db EPS = 1e-9;
const db PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

int main() {
    fre("");
    ACCELERATE;
	
	ll l, r;
	cin >> l >> r;

	if(r - l + 1 > 2019) return !(cout << 0);

	ll ans = oo;
	for(ll i = l; i <= r; i++) {
		for(ll j = i + 1; j <= r; j++) {
			cmin(ans, (i * j % 2019));
			if(!ans) return !(cout << ans);
		}
	}

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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    private static void solve(int n) {
        // solve here
        System.out.println(n%1000 != 0 ? 1000 - (n%1000) : 0);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        solve(n);
    }
}

Measured memory_bytes: 32496
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
    vector<int> a(5);
    for(int i=0;i<5;i++)cin>>a[i];
    int p=0;
    for(int i=1;i<5;i++){
        if(a[i]%10<a[0]%10 && a[i]%10!=0)p=i;
    }
    
    int ans=0;
    for(int i=0;i<5;i++){
        if(i!=p){
            ans+=a[i];
            if(ans%10!=0)ans+=10-ans%10;
        }
    }
    ans+=a[p];
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int N,A,B;
	cin>>N;
	if (N==1){
		cout<<"Hello World"<<endl;
	}else{
		cin>>A;
		cin>>B;
		cout<<A+B<<endl;
	}
	return 0;
}

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


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  vector<int> a1(n);
  vector<int> a2(n);
  for (int i=0; i<n; i++) cin >> a1[i];
  for (int i=0; i<n; i++) cin >> a2[i];

  int ans = accumulate(a1.begin(), a1.end(), a2[n-1]);
  int sum = accumulate(a1.begin(), a1.end(), a2[n-1]);
  for (int i=n-1; i>0; i--) {
    sum = sum - a1[i] + a2[i-1];
    if (sum > ans) ans = sum;
  }

  cout << ans << '\n';
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n,m; cin>>n>>m;
    vector <vector<int>> a(n,vector <int>(m));
    rep(i,n)rep(j,m) {cin>>a[i][j]; a[i][j]--;}
    vector <bool>  list(m, true);
    int ans = INF;
    for(int i=m;i>=1;i--){
        vector <int> cnt(m); 
        rep(j,n){
            rep(k,m){
                int spt = a[j][k];
                if(list[spt]) {cnt[spt]++; break;}
            }
        }
        auto iter = max_element(all(cnt));
        ans = min(ans, *iter);
        list[iter - cnt.begin()] = false;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct seg
{
    struct node
    {
        ll tag, mx;
    };
    int n;
    vector<node> t;
    void init(int _n)
    {
        n = _n;
        t.assign(2 * n - 1, {0, 0});
    }
    void dat(int o, ll v)
    {
        t[o].tag += v;
        t[o].mx += v;
    }
    void push(int o, int z)
    {
        if (t[o].tag) {
            dat(o + 1, t[o].tag);
            dat(z, t[o].tag);
            t[o].tag = 0;
        }
    }
    void pull(int o, int z)
    {
        t[o].mx = max(t[o + 1].mx, t[z].mx);
    }
    void add(int i, int j, ll v, int o, int l, int r)
    {
        if (j <= l || r <= i)
            return;
        if (i <= l && r <= j) {
            dat(o, v);
            return;
        }
        int m = l + (r - l) / 2;
        int z = o + (r - l) / 2 * 2;
        push(o, z);
        add(i, j, v, o + 1, l, m);
        add(i, j, v, z, m, r);
        pull(o, z);
    }
    ll qry(int i, int j, int o, int l, int r)
    {
        if (j <= l || r <= i)
            return LLONG_MIN;
        if (i <= l && r <= j)
            return t[o].mx;
        int m = l + (r - l) / 2;
        int z = o + (r - l) / 2 * 2;
        push(o, z);
        ll ret = qry(i, j, o + 1, l, m);
        return max(ret, qry(i, j, z, m, r));
    }
    void add(int l ,int r, ll v)
    {
        add(l - 1, r, v, 0, 0, n);
    }
    ll qry(int l, int r)
    {
        return qry(l - 1, r, 0, 0, n);
    }
} t;
const int N = 2e5 + 87;
vector<pair<int,int>> ev[N];
ll dp[N];
int main()
{
    int n, m;
    cin >> n >> m;
    t.init(n);
    for (int i = 0; i < m; ++i) {
        int l, r, a;
        cin >> l >> r >> a;
        ev[r].emplace_back(l, a);
    }
    for (int i = 1; i <= n; ++i) {
        for (const auto & p : ev[i])
            t.add(p.first, i, p.second);
        dp[i] = max(0ll, t.qry(1, i));
        t.add(i + 1, i + 1, dp[i]);
    }
    cout << dp[n] << endl;
}


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

int main() {
	map<string,int>mp;
	mp["MON"]=1;
	mp["TUE"]=2;
	mp["WED"]=3;
	mp["THU"]=4;
	mp["FRI"]=5;
	mp["SAT"]=6;
	mp["SUN"]=7;
	string day;
	cin>>day;
	if(day=="SUN") cout<<7;
	else cout<<mp["SUN"]-mp[day];
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath> 
 
using namespace std;
 
int main() 
{
	int n, p;
	scanf("%d %d", &n, &p);
	int k0 = 0, k1 = 0;
	for (int i = 0; i < n; i++) 
	{
    	int a;
    	scanf("%d", &a);
    	if (a % 2 == 0) 
		{
      		k0++;
    	} 
		else 
		{
      		k1++;
    	}
	}
  	long long ans;
  	if (k1 == 0) 
	{
    	ans = (1LL << n);
  	} 
	else 
	{
    	ans = (1LL << (n - 1));
	}
  	if (p == 1) 
	{
    	ans = (1LL << n) - ans;
  	}
  	cout << ans << endl;
  	return 0;
}

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

int main(){
    ll a,b;
    cin>>a>>b;
    ll k=1;
    ll cnt=0;
    while(k<b){
        k=k-1+a;
        cnt++;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#define REP(i,k,n) for(int i=k;i<n;i++)
using namespace std;

int main()
{
	bool first = false;
	int a,b;
	while(cin >> a >> b && a && b)
	{
		if(first)
		{
			cout << endl;
		}
		else
		{
			first = true;
		}

		bool flag = true;
		REP(i,a,b+1)
		{
			if(i%400 == 0)
			{
				flag = false;
				cout << i << endl;
			}
			else if(i%100 != 0 && i%4 == 0)
			{
				flag = false;
				cout << i << endl;
			}
		}

		if(flag)
		{
			cout << "NA" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    s.pop_back();
    s.pop_back();
    for(int i = s.size(); i >= 0; i-=2){
        int t = i/2;
        if(s.substr(0,t)==s.substr(t,t)){
            cout<<i;
            break;
        }
    }
}

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

int main() {
  int X, N; cin >> X >> N;
  int P[N]; for (int i = 0; i < N; i++) cin >> P[i];
  bool C[102]; for (int i = 0; i <= 101; i++) C[i] = false;
  for (int i = 0; i < N; i++) C[P[i]] = true;
  int min_abs = 1000, min_num = 0;
  for (int i = 0; i <= 101; i++) {
    if (!C[i] && abs(i-X) < min_abs) {
      min_abs = abs(i-X);
      min_num = i;
    }
  }
  cout << min_num << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#define INF INT_MAX
using namespace std;

int R;

int main(){
	cin >> R;
	if (R < 1200){
		cout << "ABC" << endl;
	}
	else if (R < 2800){
		cout << "ARC" << endl;
	}
	else{
		cout << "AGC" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

int a,b;

int main(){
    cin>>a>>b;
    cout<<(a+(b-a)*2)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define INF 1 <<29 
int dx[]={1,0,-1,0};
int dy[]={0,-1,0,1};
int dxx[]={1,1,0,-1,-1,-1,0,1};
int dyy[]={0,-1,-1,-1,0,1,1,1};
bool inside(int x,int y,int w,int h){
  return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;


int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n,t;
  cin >>n>>t;
  int a,b,miv=INF,nun=-1;
  FOR(i,n){
    cin >>a>>b;
    if(b<=t&&a<miv){
      miv=a;
      nun=b;
    }
  }
  if(~nun) cout <<miv <<endl;
  else cout <<"TLE\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;
using ll = long long;


int main(){
    double r; cin >> r;
    double pi = 3.141592;
    double ans = 2* r * pi;
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3784
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn ch(s: &String, r: &String) -> bool {
    if s == r {
        true
    } else {
        false
    }
}
fn main() {
    input! {
        s: chars,
    }
    let mut s = s;
    s.pop();
    s.pop();
    while !s.is_empty() {
        let mut f = String::new();
        let mut b = String::new();
        for j in 0..s.len() / 2 {
            f.push(s[j].clone());
        }
        for j in s.len() / 2 ..s.len() {
            b.push(s[j].clone());
        }
        if ch(&f, &b) {
            println!("{}", s.len());
            return;
        } else {
            s.pop();
            s.pop();
        }
    }
    println!("{}", 0);
}

Measured memory_bytes: 4352
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int l,r,d;
    cin>>l>>r>>d;
    int ans=0;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)
        ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(x) (x).begin(), (x).end()

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;
}

typedef long long ll;

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> east(n + 1);
    rep(i, n) east[i + 1] = east[i] + (s[i] == 'E');
    int res = 1e9;
    rep(i, n)
    {
        int tres = 0;
        tres += i - east[i];
        tres += east[n] - east[i + 1];
        chmin(res, tres);
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1812
import math
 
a,b,c,d = map(float,input().split())
 
H = 30
M = 6
 
HM = 0.5
 
kakudo = abs((c*H+d*HM) - d*M)
 
if kakudo == 180:
  print(a+b)
elif kakudo == 0:
  print(abs(a-b))
else:
  print(math.sqrt(pow(a,2) + pow(b,2) - 2*a*b*math.cos(math.radians(kakudo))))

Measured memory_bytes: 9460
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define PI 3.14159265358979323846
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef long double ld;
typedef string st;
const ll MOD = 1e9 + 7 ;
const ll INF=1e14;
ll mpow(ll a,ll b,ll p=MOD){a=a%p;ll res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const ll N=500020;

int main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);

      ll n,m;
      cin>>n>>m;
      ll a[m];
      forn(i,m)
      {
        cin>>a[i];
      }
      sort(a,a+m);
      ll prev=a[0];
      vector<pair<ll,pii>> v;
      v.pb({a[0],{0,0}});
      for(ll i=1;i<m;i++)
      {
        v.pb({a[i]-a[i-1],{i-1,i}});
      }
      sort(rall(v));
      ll mark[m]={0};
      mark[0]=1;
      ll op=1;
      forn(i,m)
      {
          if(v[i].se.se!=0&&op<n)
          mark[v[i].se.se]=1,op++;
      }
      ll ans=0;
      ll cnt=0;
      forn(i,m)
      {
        if(mark[i]==0)
        {
          cnt+=a[i]-a[i-1];
        }
        else{
          ans+=cnt;
          cnt=0;
        }
      }
      ans+=cnt;
      cout<<ans;
}

Measured memory_bytes: 5492
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 200

struct Edge{
	Edge(int arg_to,double arg_length,double arg_people,double arg_value){
		to = arg_to;
		length = arg_length;
		people = arg_people;
		value = arg_value;
	}
	int to;
	double length,people,value;
};

struct Info{
	Info(int arg_node_id,double arg_sum_cost){

		node_id = arg_node_id;
		sum_cost = arg_sum_cost;
	}
	bool operator<(const struct Info &arg) const{
		return sum_cost > arg.sum_cost;
	}
	int node_id;
	double sum_cost;
};

int V,E;
double P,min_cost[NUM];
vector<Edge> G[NUM];

int main(){

	scanf("%d %d %lf",&V,&E,&P);

	int from,to;
	double length,people;

	for(int loop = 0; loop < E; loop++){

		scanf("%d %d %lf %lf",&from,&to,&length,&people);
		from--;
		to--;
		G[from].push_back(Edge(to,length,people,people/length));
		G[to].push_back(Edge(from,length,people,people/length));
	}

	double ans = 0,base_value,base_sum;
	int start = 0;

	priority_queue<Info> Q;
	int next_node;
	double next_cost,tmp_length,tmp_people;

	for(int base_node = 0; base_node < V; base_node++){

		base_value = 0;
		for(int i = 0; i < G[base_node].size(); i++){
			base_value = max(base_value,G[base_node][i].value);
		}

		base_sum = base_value*(P/2);

		for(int i = 0; i < V; i++)min_cost[i] = (double)BIG_NUM;
		min_cost[start] = 0;

		while(!Q.empty())Q.pop();

		Q.push(Info(start,0));

		while(!Q.empty()){

			if(Q.top().node_id == base_node){
				break;
			}else if(Q.top().sum_cost > min_cost[Q.top().node_id]){
				Q.pop();
			}else{

				for(int i = 0; i < G[Q.top().node_id].size(); i++){

					if(G[Q.top().node_id][i].value >= base_value)continue;

					next_node = G[Q.top().node_id][i].to;
					tmp_length = G[Q.top().node_id][i].length;
					tmp_people = G[Q.top().node_id][i].people;
					next_cost = Q.top().sum_cost+(base_value*tmp_length-tmp_people);

					if(min_cost[next_node] > next_cost){

						min_cost[next_node] = next_cost;
						Q.push(Info(next_node,next_cost));
					}
				}
				Q.pop();
			}
		}
		ans = max(ans,base_sum-min_cost[base_node]);
	}

	printf("%.10lf\n",2*ans);

	return 0;
}



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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    string s; std::cin >> s;
    int k; std::cin >> k;
    int len = s.size();
    vector<string> vec;
    rep(i, len) {
        string tmp;
        rep(j, k) if (i+j < len) tmp += s[i+j], vec.pb(tmp);
    }
    sort(rng(vec));
    vec.erase(unique(rng(vec)), vec.end());
    std::cout << vec[k-1] << "\n";
}


Measured memory_bytes: 1660
#include<iostream>
using namespace std;
int main() {
	int a,x,y;
	while (1) {
		cin>>x>>y;
		if (x == 0 && y == 0)break;
		if (x > y) {
			a = x;
			x= y;
			y = a;
		}
                 cout<<x<<" "<<y<<endl;	}
	return 0;

}

Measured memory_bytes: 2956