akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void)
{
  int n;
  double std[40];
  int range[6]={0};

  cin >> n;
  
  for(int i = 0 ; i < n ; i++) {
    cin >> std[i];
    if(std[i] < 165.0) range[0]++;
    else if(std[i] >= 165.0 && std[i] < 170.0) range[1]++;
    else if(std[i] >= 170.0 && std[i] < 175.0) range[2]++;
    else if(std[i] >= 175.0 && std[i] < 180.0) range[3]++;
    else if(std[i] >= 180.0 && std[i] < 185.0) range[4]++;
    else if(std[i] >= 185.0) range[5]++;
  }
  
  for(int i = 0 ; i < 6 ; i++) {
      cout << i+1 << ':';
      while(range[i] != 0) {
	cout << '*';
	range[i]--;
      }
      cout << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long int64;

map< string, int > ff;

void stop()
{
  int ret = 0;
  for(auto &c : ff) {
    if(isalpha(c.first[0])) {
      ++ret;
      printf("%c=%d\n", c.first[0], c.second);
    }
  }
  exit(0);
}


int main()
{
  int N;
  int convert[1001];
  char buff[64], type[50][5], var1[50][5], var2[50][5], var3[50][5];
  memset(convert, -1, sizeof(convert));

  fgets(buff, sizeof(buff), stdin);
  sscanf(buff, "%d", &N);

  for(int i = 0; i < N; i++) {
    int line;
    fgets(buff, sizeof(buff), stdin);
    sscanf(buff, "%d %s %s %s %s", &line, type[i], var1[i], var2[i], var3[i]);
    convert[line] = i;
    ff[var1[i]];
    ff[var2[i]];
    ff[var3[i]];
  }
  for(int i = 0; i < 16; i++) ff[to_string(i)] = i;

  int i = 0;
  for(int c = 0; c < 30000000; c++) {
    if(type[i][0] == 'H') stop();
    int val;
    bool set = true;
    if(type[i][0] == 'A') {
      val = ff[var2[i]] + ff[var3[i]];
    } else if(type[i][1] == 'U') {
      val = ff[var2[i]] - ff[var3[i]];
    } else if(type[i][1] == 'E') {
      val = ff[var2[i]];
    } else {
      set = false;
    }

    if(set && (val < 0 || val >= 16)) stop();
    if(set) ff[var1[i]] = val;

    if(type[i][0] == 'I' && ff[var1[i]] != 0) {
      i = convert[stoi(var2[i])];
    } else {
      i++;
    }

    if(i < 0 || i >= N) stop();
  }

  puts("inf");
}

Measured memory_bytes: 3292
function main(input) {
  var args = input.split("\n");
  var a = parseInt(args[0], 10);
  var b = parseInt(args[1], 10);
  var h = parseInt(args[2], 10);

  var ans = (a + b) * h / 2;
  console.log(ans);
}

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

Measured memory_bytes: 7372
#include <stdio.h>

int main(void){
  int i,j;
  int n,m,a;
  int h,p,q;
  int max_h;
  int amida[1004][104];

  while(1){
    scanf("%d%d%d",&n,&m,&a);
    if(n==0 && m==0 && a==0) break;

    for(i=0;i<1004;i++){
      for(j=0;j<n;j++){
	amida[i][j] = 0;
      }
    }

    max_h = -1;
    for(i=0;i<m;i++){
      scanf("%d%d%d",&h,&p,&q);
      amida[h-1][p-1] = 1;
      amida[h-1][q-1] = 2;
      if(max_h < h){
	max_h = h;
      }
    }

    i = max_h - 1;
    j = a - 1;
    for(; i != -1; i--){
      if(amida[i][j] == 1){
	j++;
      }
      else if(amida[i][j] == 2){
	j--;
      }
    }
    printf("%d\n",j+1);
  }


  return 0;
}

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

#define pb push_back
#define fi first
#define se second


using namespace std;


vector<int> v;

int main()
{
	int c;

	cin>>c;

	if(c>29)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;


	return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main(void){
  int n,m,a[10000],b,c,i;
  scanf("%d %d",&n,&m);
  b=0;
  for(i=0;i<m;i++){
    scanf("%d",&a[i]);
    b=b+a[i];
  }
  c=n-b;
  if(c>=0){
    printf("%d\n",c);
  }else{
    printf("-1\n");
  }
  return 0;
}


Measured memory_bytes: 1716
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll I, O, T, J, L, S, Z;

ll calc(ll i, ll j, ll l){
    ll res=0;
    res+=i-(i%2);
    res+=j-(j%2);
    res+=l-(l%2);
    if(i&&j&&l){
        ll other=0, ii=i, jj=j, ll=l;
        ii--,jj--,ll--;
        other+=3;
        other+=ii-(ii%2);
        other+=jj-(jj%2);
        other+=ll-(ll%2);
        if(res<other) res=other;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>I>>O>>T>>J>>L>>S>>Z;
    
    ll cnt=0;
    cnt+=O;
    cnt+=calc(I,J,L);
    cout1(cnt);
}

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

typedef long long ll;

int main(){
  ll N;
  std::cin >> N;
  std::vector<unsigned long long> A(N);
  unsigned long long resa = 1;
  bool check0 = false;
  for(int i = 0 ; i < N ; i++){
    std::cin >> A[i];
    if(A[i] == 0){
      check0 = true;
    }
  }
  if(check0){
    std::cout << 0 << std::endl;
    return 0;
  }
  ll max = (ll)1e18;
  for(int i = 0 ; i < N ; i++){
    if(max / resa >= A[i]){
      resa *= A[i];
      continue;
    }else{
      std::cout << "-1" << std::endl;
      return 0;
    }
  }
  std::cout << resa << std::endl;
  return 0;
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define ll long long
#define FOR(i,n) for(int i=0;i<n;i++)
//map<key,value>

int main(){
  int a,b;
  cin >> a >> b;
  if((a+b)%2 == 1)cout << "IMPOSSIBLE";
  else cout << (a+b)/2;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mod 1000000007
using namespace  std ;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
ll n,m,k;
ll dp[23][2097160];
ll v[23][23];
ll solve(ll i , ll j)
{
    if(i>=n && j==k)
    {
        return(1);
    }
    if(i==n)
    {
    	return(0);
	}
    if(dp[i][j]!=-1)
    {
        return(dp[i][j]);
    }
    ll ans = 0 ;
    for(ll m=0 ; m<n;  m=m+1)
    {
        if(v[i][m]==1 && !(j&(1<<m)))
        {
            ans=ans+solve(i+1,j^(1<<m));
            ans%=mod;
        }
    }
    dp[i][j] = ans;
    return(ans);
}
int main()
{
    ios_base::sync_with_stdio(false);//this and next two lines for cin cout TLE handling
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(6);
    ll a,b,c,d,e,x,i,j,t,y,w;
    double p,q,r,u,s ;
    string str = "",str1 = "" ;
    /*char ch,chr ;
    ll a1=0,a2=0,b1=0,b2=0 ;*/
    cin>>n;
    k = (1<<n) - 1 ;
    for(i=0 ; i<n+2 ; i=i+1)
    {
    	for(j=0  ; j<k+2 ; j=j+1)
    	{
    		dp[i][j] = -1 ;
		}
	}
    for(i=0 ; i<n ; i=i+1)
    {
        for(j=0 ; j<n ;j=j+1)
        {
        	cin>>v[i][j];
		}
    }
    a = solve(0,0);
    cout<<a;
}

Measured memory_bytes: 377216
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int n; cin>>n;
    string ans = "No";

    for(int i=1; i<10; i++){
        for(int j=1; j<10; j++) if(n==i*j) ans="Yes";
    }

    cout << ans << ln;
    return 0;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    string S; cin >> S;
    REP(i, SZ(S)){
        int x = S[i] - 'A';
        S[i] = 'A' + ((x + N) % 26);
    }
    Out(S);

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
        if(a==b&&b==c){
            if(a%2==0){
                System.out.println(-1);
            } else {
                System.out.println(0);
            }
        } else {
            long ans = 0;
            while(a%2==0&&b%2==0&&c%2==0){
                int tmpA = a,tmpB=b,tmpC =c;
                a = (tmpB+tmpC)/2;
                b = (tmpA+tmpC)/2;
                c = (tmpA+tmpB)/2;
                ans ++;
            }
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        int a, b, c;
        String s = "";
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        if (a < b && b < c) {
            s += "Yes";
        } else {
            s += "No";
        }
        System.out.println(s);
       }
}


Measured memory_bytes: 26136
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double r = sc.nextDouble();
		double S=r*r*Math.PI;
		double T=2*r*Math.PI;
		System.out.printf("%1.6f %1.6f",S,T);
	}	
}

Measured memory_bytes: 28156
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define iii tuple<int, int, int>
#define ii pair<int, int>
#define fi first
#define vi vector<int>
#define vvi vector<vector<int>>
#define se second

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
    int n;
    cin >> n;
    string x;
    map<string, int> a;
    vi b(n), s(n);
    for (int i = 0; i < n; ++i) {
        string t;
        cin >> t >> b[i];
        a[t] = i;
    }
    partial_sum(b.begin(), b.end(), s.begin());
    cin >> x;
    cout << s.back() - s[a[x]] << '\n';
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    // freopen("in", "r", stdin);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換


#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000
using ll = long long;
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-12; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);

}

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

//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	llint ans = 0, n = 0, count = 0, sum = 0, near = 1000, r;
	llint  h, w, k;
	int value_to_remove = 0;
	bool check = false;
	string ss, sss;
	vector<llint> array;
	vector<bool> bo(100001, 0);
	char c;
	cin >> n;
	ans = n - 400;
	ans = ans / 200;

	cout << 8-ans << endl;
	
	please AC;
}



Measured memory_bytes: 3192
n=int(input())
a=[0 for i in range(n)]

for i in range(n):
    a[i]=int(input())

min1=min(a)
id1=a.index(min1)
temp1=a[id1]
a[id1]=99999

min2=min(a)
id2=a.index(min2)
temp2=a[id2]
a[id2]=99999

min3=min(a)
id3=a.index(min3)
temp3=a[id3]
a[id3]=99999

min4=min(a)
id4=a.index(min4)

b1=str(temp1)
b2=str(temp2)
b3=str(temp3)
b4=str(a[id4])

j12=b1+b2
j21=b2+b1
j13=b1+b3
j31=b3+b1
j14=b1+b4
j41=b4+b1

k12=int(j12)
k21=int(j21)
k13=int(j13)
k31=int(j31)
k14=int(j14)
k41=int(j41)

A=[k12,k21,k13,k31,k14,k41]
for i in range(6):
    v=A[i]
    j=i-1
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j=j-1
    A[j+1]=v
print(A[2])



Measured memory_bytes: 5720
#include <stdio.h>
#include <math.h>

#define gc() getchar_unlocked()
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc();
	while (c >= '0');
	return n;
}

int x[102], y[102];

int main()
{
	int n, i, t, t2;
	int d, d1, d2;
	long long d3;
	
	n = in();
	for (i = 0; i < n; i++) x[i] = in();
	for (i = 0; i < n; i++) y[i] = in();
	d = 0, d1 = 0, d2 = 0, d3 = 0;
	for (i = 0; i < n; i++) {
		t = x[i] - y[i];
		if (t < 0) t = -t;
		if (t > d) d = t;
		d1 += t;
		t2 = t*t, d2 += t2;
		d3 += t2*t;
	}
	printf("%d\n", d1);
	printf("%.8lf\n", sqrt((double)d2));
	printf("%.8lf\n", pow((double)d3, 1.0/3));
	printf("%d\n", d);
	return 0;
}



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

using namespace std;

int main(){
    int n, m;
    while(cin >> n >> m, n+m){
        vector<int> f, s, v;
        bool white = false;
        for(int i=0; i < m; i++){int t; cin >> t; if(t != 0) v.push_back(t); else white = true;}
        sort(v.begin(), v.end());
        f.push_back(v[0]); s.push_back(v[0]);
        for(int i=1; i< v.size(); i++){
            if(s[s.size()-1] == v[i]-1) s[s.size()-1] = v[i];
            else {f.push_back(v[i]); s.push_back(v[i]);}
        }
        int ret = 0;
        if(white){
            for(int i=0; i < s.size()-1; i++){
                if(s[i]+2 == f[i+1]) ret = max(ret, s[i]-f[i]+2+s[i+1]-f[i+1]+1);
            }
        } else {
            for(int i=0; i < s.size(); i++){
                ret = max(ret, s[i]-f[i]+1);
            }
        }
        cout << ret << endl;
    }
}

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

using namespace std;

int main(){
    long long N,L[2]={-1,-1};
    long long res;
    scanf("%lld",&N);
    vector<long long> a(N);

    for(int i=0;i<N;i++)
        scanf("%lld",&a[i]);
    
    sort(a.begin(),a.end(),greater<int>());
    
    int l = 0;    
    for(int i=0;i<N-1;i++){
        if(a[i]==a[i+1]){
            L[l] = a[i];
            l++;
            i++;
            if(l==2)
                break;
        }
    }

    if(L[0]==-1 || L[1]==-1){
        res = 0;
    }else{
        res = L[0]*L[1];
    }

    printf("%lld\n",res);
    return 0;
}

Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;

fn main() {
    let mut X:Vec<u32> = read_vec();
    let mut A:u32 = X[0];
    let mut B:u32 = X[1];
    let mut T:u32 = X[2];
    let mut ans:u32 = T/A * B;
    println!("{}", ans);
}
fn read<T: FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)

struct Point {
    int x, y;
    bool operator<(const Point& r) const {
        return (x == r.x) ? (y < r.y) : (x < r.x);
    }
};

int main() {
    int n;
    scanf("%d", &n);
    vector<Point> a(n), b(n);
    rep(i, n) scanf("%d%d", &a[i].x, &a[i].y);
    rep(i, n) scanf("%d%d", &b[i].x, &b[i].y);
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    int ans = 0;
    static bool used[114] = {0};
    rep(i, n) {
        int ymax = -1, id = -1;
        for (int j = n - 1; j >= 0; j--) {
            if (used[j]) continue;
            if (a[j].x < b[i].x && a[j].y < b[i].y && ymax < a[j].y) {
                ymax = a[j].y;
                id = j;
            }
        }
        if (id != -1) {
            used[id] = true;
            ans++;
        }
    }

    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    if (a >= b && c >= d)      cout << b + d << endl;
    else if (a >= b && c <= d) cout << b + c << endl;
    else if (a <= b && c >= d) cout << a + d << endl;
    else                       cout << a + c << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;

int main() {
    int N,X,T;
    cin>>N>>X>>T;

    if(N%X==0){
        cout<<N/X*T<<endl;
    }
      else{
          cout<<(N/X+1)*T<<endl;
      }  
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main() {
int K,S;
cin >> K >> S;


int ans = 0;
for(int x = 0; x <= K; ++x){
for(int y = 0; y <= K; ++y){
int z = S - x - y;
if(0 <= z and z <= K){
ans = ans + 1;
}
}
}

cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  ll A; cin>>A;
  ll ans = 0;
  string B; cin>>B;
  int len = B.length();
  ll base = 1;
  for(int i = len-1;  i >= 0; i--) {
    if(i == len-3) continue;
    ans += A*base*(ll)(B[i] - '0');
    base *= 10LL;
  }
  cout << ans / 100LL << endl;
  return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define S second
#define F first
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(false);cout.tie(0)
#define pb push_back
#define mp make_pair
using namespace std ;
typedef long long ll ;
typedef pair<int,int> pii ;

int main(){
    int n ;
    cin >> n ;
    if(n == 1){
        cout << 0;
    }
    else{
        cout << 1 ;
    }
    return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t a,b,x;
    cin >> a >> b >> x;
    if(x>=a && a+b>=x){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
N=int(input())
lh=list(map(int,input().split()))
cmax=0
ctmp=0
for i in range(N-1):
    if lh[i]>=lh[i+1]:
        ctmp+=1
        #print("ctmp",ctmp)
    else:
        cmax=max(ctmp,cmax)
        ctmp=0
        #print("cmax",cmax)
cmax=max(ctmp,cmax)
print(cmax)


Measured memory_bytes: 15020
#include <iostream>
#include <queue>
#include <climits>
using namespace std;

# define ll long long

int main() {
  int n;
  cin >> n;
  
  ll numbers[3*n + 5], mx[3*n + 5], mn[3*n + 5];
  for(int i=1; i<=3*n; i++) cin >> numbers[i];

  // construct mx
  ll sum = 0;
  priority_queue<ll, vector<ll>, greater<ll>> minHeap;
  for(int i=1; i<=2*n; i++){
    sum += numbers[i];
    minHeap.push(numbers[i]);
    if(minHeap.size() > n){
      sum -= minHeap.top();
      minHeap.pop();
    }
    mx[i] = sum;
  }

  // construct mn
  sum = 0;
  priority_queue<ll> maxHeap;
  for(int i=3*n; i>n; i--){
    sum += numbers[i];
    maxHeap.push(numbers[i]);
    if(maxHeap.size() > n){
      sum -= maxHeap.top();
      maxHeap.pop();
    }
    mn[i] = sum;
  }

  // bruteforce titik potong
  ll ans = LLONG_MIN;
  for(int i=n; i<=2*n; i++)
    ans = max(ans, mx[i] - mn[i+1]);
  cout << ans << endl;
}

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

int main() {
    long long int x;
    cin >> x;
    long long int a = 100;
    int i;
    for(i=0;;i++) {
        a += a*0.01;
        if(a>=x) break;
    }
    cout << i+1 << endl;
}

Measured memory_bytes: 3636
require 'scanf'

EPS = 0.00001**2.0

def eq(a, b)
    (a-b).abs < EPS
end

n_lines = STDIN.gets.to_i
for i in 0..n_lines-1
    str = STDIN.gets
    x1,y1,x2,y2,x3,y3,x4,y4=\
        str.scanf("%f %f %f %f %f %f %f %f") 
    a, b = [x2-x1,y2-y1], [x4-x3,y4-y3]
    op = a[0]*b[1]-a[1]*b[0]
    print(if eq(op,0.0); "YES\n" else "NO\n" end)
end

Measured memory_bytes: 9880
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// << fixed << setprecision
// --------------------------------------
#include <cassert>
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
mint dp[100005][4];
string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> s;
  int sl = s.length();
  dp[0][0] = 1;
  REP(i, sl) {
    REP(j, 4) {
      if(s[i] != '?') dp[i + 1][j] += dp[i][j];
      else dp[i + 1][j] += dp[i][j] * 3;
    }

    if(s[i] == 'A' || s[i] == '?') dp[i + 1][1] += dp[i][0];
    if(s[i] == 'B' || s[i] == '?') dp[i + 1][2] += dp[i][1];
    if(s[i] == 'C' || s[i] == '?') dp[i + 1][3] += dp[i][2];
  }

  cout << dp[sl][3] << endl;
}


Measured memory_bytes: 6916
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <sstream>

using namespace std;

int main() {



int n;
int m;
int l;
 
cin >> n >> m >> l;
  
int sum = 0;
  
for(int i = 1;i <= n;i++){
  
 ostringstream oss;
 oss << i;
  
 string s = oss.str();
  
  int ssum = 0;
  
 for(int i = 0;i < s.size();i++){
  
      int ss = s[i]-'0';
   
      ssum = ssum + ss;
   
   
 }
  
  if(ssum >= m && ssum <= l){
   // cout << i << endl;
    sum = sum + i; //ssum;
    
  }
  
 // cout << ssum << endl;
   
}
  
   //cout << n << endl;
   //cout << m << endl;
   //cout << l << endl;
  
  cout << sum << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<=b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;


int main(){
    INIT;
    int x;
    cin >> x;
    int b = x/100;
    int a = x % 100;
    if(IN(1,a,12) && IN(1,b,12)) cout << "AMBIGUOUS" << "\n";
    else
    if(1 <= b && b <= 12) cout << "MMYY" << "\n";
    else
    if(1 <= a && a <= 12) cout << "YYMM" << "\n";
    else
    cout << "NA" << "\n";
}

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

typedef long long ll;

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

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

    int k; cin >> k;
    ll ans = 0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int a=1;a<=k;a++){
                ll uku = gcd(i,j);
                ans += gcd(uku,a);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3664
import sys

# import re
import math
import collections
# import decimal
import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    s = list(input())
    target = ["A", "B", "C"]
    next = ["B", "C"]

    idx = 0
    ans = 0
    a_cnt = 0

    while len(s) - 3 >= idx:
        if [s[idx], s[idx + 1], s[idx + 2]] == target:
            ans += a_cnt
            ans += 1
            a_cnt += 1

            idx += 3
            while len(s) - 3 >= idx:
                if [s[idx], s[idx + 1], s[idx + 2]] == target:
                    ans += a_cnt + 1
                    idx += 3
                    a_cnt += 1
                else:
                    break

            while len(s) - 2 >= idx:
                if [s[idx], s[idx + 1]] == next:
                    ans += a_cnt
                    idx += 2
                else:
                    break

        elif s[idx] != "A":
            a_cnt = 0
            idx += 1
        elif s[idx] == "A":
            a_cnt += 1
            idx += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 7140
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [s]: string[] = tmp.shift().split(" ");
    return `${s.charAt(2) === s.charAt(3) && s.charAt(4) === s.charAt(5) ? "Yes" : "No"}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 7372
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    a = list(map(int,input().split()))
    dp = [[-1 for _ in range(N)] for _ in range(N)]
    for i in range(N):
        dp[i][i] = a[i]
    
    for i in range(N-1,-1,-1):
        for j in range(i,N):
            if dp[i][j] != -1:
                continue
            dp[i][j] = max(a[i]-dp[i+1][j],a[j]-dp[i][j-1])
            
    print(dp[0][-1])
   
if __name__ == "__main__":
    main()


Measured memory_bytes: 119772
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		while (true)
		{
			int n = sc.nextInt();
			if (n == 0) break;
			int plan[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				plan[i] = sc.nextInt();
			}
			int ohajiki = 31;
			int index = 0;
			System.out.println(ohajiki);
			while (true)
			{
				if (ohajiki > plan[index])
				{
					ohajiki -= plan[index];
					System.out.println(ohajiki);
					ohajiki -= (ohajiki - 1) % 5;
					System.out.println(ohajiki);
					index = (index + 1) % n;
				}
				else
				{
					ohajiki = 0;
					System.out.println(ohajiki);
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
std::string s;
int k;
int ss(ll x){
	int ret=0;
	while (x) ret+=x%10,x/=10;
	return ret;
}
double cal(ll x){
	return x*1.0/ss(x); 
}
int main(){
	scanf("%d",&k);
	ll t=1,ans=0;
	for (int i=1,j=1;i<=k;i++,j++){
		while (cal(ans+t*10ll)<cal(ans+t)) t=t*10ll;
		ans+=t;
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 3772
import java.util.*;
public class Main {
    public static void main (String[] args) {
        Scanner s = new Scanner(System.in);
        int W = s.nextInt();
        int H = s.nextInt();
        int x = s.nextInt();
        int y = s.nextInt();
        int r = s.nextInt();
        if(x - r >= 0 && x + r <= W) {
            if (y - r >= 0 && y + r <= H) {
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
        }else {
            System.out.println("No");
        }
    }
}


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

int main() {
  int n, cnt = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n - 2; i++)
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') cnt++;
  cout << cnt << endl;
}

Measured memory_bytes: 3588
N,Q=list(map(int,input().split()))
edge=[[] for _ in range(N)]

for _ in range(N-1):
    a,b=list(map(int,input().split()))
    
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

visit=[0]*N
pts=[0]*N
ans=['']*N

for _ in range(Q):
    p,x=list(map(int,input().split()))

    pts[p-1]+=x

stack=[[0,0]]

while len(stack)>0:
    u,p=stack.pop()
    visit[u]=1
    p=p+pts[u]
    ans[u]=str(p)

    for v in edge[u]:
        if visit[v]==1:
            continue

        stack.append([v,p])

print(' '.join(ans))

Measured memory_bytes: 78588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) begin(x), end(x)

const int N = 2.1e5;
int n, k, tmin[2 * N], tmax[2 * N], a[N];

int query_min(int l, int r) {
	int res = int(1e9);
	for (l += N, r += N; l <= r; l /= 2, r /= 2) {
		if (l % 2 == 1) {
			res = min(res, tmin[l++]);
		}
		if (r % 2 == 0) {
			res = min(res, tmin[r--]);
		}
	}
	return res;
}

int query_max(int l, int r) {
	int res = int(-1e9);
	for (l += N, r += N; l <= r; l /= 2, r /= 2) {
		if (l % 2 == 1) {
			res = max(res, tmax[l++]);
		}
		if (r % 2 == 0) {
			res = max(res, tmax[r--]);
		}
	}
	return res;
}

int main() {
#ifdef LC
	assert(freopen("input.txt", "r", stdin));
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	copy(a, a + N, tmin + N);
	copy(a, a + N, tmax + N);
    for (int i = N - 1; i > 0; --i) {
		tmin[i] = min(tmin[2 * i], tmin[2 * i + 1]);
		tmax[i] = max(tmax[2 * i], tmax[2 * i + 1]);
	}
	int answer = 0;
	bool flag = 0;
	for (int i = 0; i + k <= n; ++i) {
		//~ cerr << a[i - 1] << " " << query_min(i, i + k - 2) << " " << query_max(i, i + k - 2) << " " << a[i + k - 1] << endl;
		if (i > 0 && a[i - 1] <= query_min(i, i + k - 2) && query_max(i, i + k - 2) <= a[i + k - 1]) {
			continue;
		}
		if (is_sorted(a + i, a + i + k)) {
			flag = true;
			continue;
		}
		++answer;
	}
	answer += flag;
	cout << answer << "\n";
    return 0;
}


Measured memory_bytes: 4352
n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
a = a.map { |x| x - 1 }

visited = Array.new(n, -1)
order = []

nxt = 0
len = 0
while visited[nxt] < 0
    order.push(nxt)
    visited[nxt] = len
    nxt = a[order[-1]]
    len += 1
end

len1 = visited[nxt]
len2 = len - len1

if k <= len1
    puts order[k] + 1
else
    kk = (k - len1) % len2
    puts order[len1 + kk] + 1
end


Measured memory_bytes: 32040
#include <stdio.h>
int g[]={1,4,13,40,121,364,1093,3280,9841,29524,88573,265720,797161,2391484};
int i,n,A[1000000],m,cnt;
void f(int g){
    int i,j,v;
    for(i=g;i<n;i++){
        v=A[i];
        for(j=i-g;j>=0&&A[j]>v;j-=g){
            A[j+g]=A[j];
            cnt++;
        }
        A[j+g]=v;
    }
}
int main(){
    for(scanf("%d",&n);i<n;scanf("%d",A+i++));
    for(m=0;g[m]<=n;m++);
    printf("%d\n",m);
    for(i=0;i<m;f(g[m-i-1]),printf("%d ",g[m-i++-1]));
    printf("\n%d\n",cnt);
    for(i=0;i<n;printf("%d\n",A[i++]));
}

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

int main(){
    int n; cin >> n;
    float t, a;cin >> t >> a;
    float h[n];

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

    float diff = 9999;
    int idx = 0;

    for (int j=0;j<n;j++){
        float tempDiff = abs(a - (t - h[j] * 0.006));
        if (diff > tempDiff) {
            idx = j;
            diff = tempDiff;
        }
    }

    cout << idx+1 << endl;
    return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    
    long long n, x;
    cin >> n >> x;
    
    vector<long long> a(n + n);
    long long ans = 0;
    
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i + n] = a[i];
        ans += a[i];
    }
    
    vector<vector<long long>> minimum(n + n, vector<long long> (n + n, numeric_limits<long long>::max()));
    
    for (int i = 0; i < n + n; i++) {
        minimum[i][i] = a[i];
        for (int j = i + 1; j < n + n; j++) {
            minimum[i][j] = min(a[j], minimum[i][j - 1]);
        }
    }
    
    for (int step = 1; step < n; step++) {
        long long tmp = step * x;
        for (int j = n; j < n + n; j++) {
            tmp += minimum[max(0, j - step)][j];
        }    
        ans = min(ans, tmp);
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 125440
#include<iostream>
using namespace std;
 
bool is_palindrome(string s){
    string t(s.rbegin(),s.rend());
    return s == t;
}
 
int main(){
    string s;
    cin>>s;
    int n=s.size();
    if(is_palindrome(s) && is_palindrome(s.substr(0,(n-1)/2)) && is_palindrome(s.substr((n+1)/2))){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3620
ip = input()
inputNum = int(ip)
totalCount = 0
for i in range(1,inputNum + 1):
    count = 0
    if i % 2 == 1:
        for j in range(1,i+1):
            if i % j == 0:
                count = count + 1
        if count == 8:
                totalCount = totalCount + 1

print(totalCount)

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

int main() {
  int A, B, C, D;
  cin  >> A;
  D = A % 10;
  C = A / 10 % 10;
  B = A / 100 % 10;
  A = A / 1000;
  if (A + B + C + D == 7) {
    cout << A << '+' << B << '+' << C << '+' << D << "=7";
  }
  else if (A + B + C - D == 7) {
    cout << A << '+' << B << '+' << C << '-' << D << "=7";
  }
  else if (A + B - C + D == 7) {
    cout << A << '+' << B << '-' << C << '+' << D << "=7";
  }
  else if (A - B + C + D == 7) {
    cout << A << '-' << B << '+' << C << '+' << D << "=7";
  }
  else if (A + B - C - D == 7) {
    cout << A << '+' << B << '-' << C << '-' << D << "=7";
  }
  else if (A - B + C - D == 7) {
    cout << A << '-' << B << '+' << C << '-' << D << "=7";
  }
  else if (A - B - C + D == 7) {
    cout << A << '-' << B << '-' << C << '+' << D << "=7";
  }
  else {
    cout << A << '-' << B << '-' << C << '-' << D << "=7";
  }
}

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

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(ll, s);
    
    ll t = ceil(sqrt(s));
    ll u = t*t - s;
    Cout(0, " ", 0, " ", t, " ", 1, " ", u, " ", t);
}





Measured memory_bytes: 764
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner stdin = new Scanner(System.in);

		int[][] c = new int[3][];
		for (int i = 0; i < 3; i++) {
			c[i] = new int[3];
			for (int j = 0; j < 3; j++) {
				c[i][j] = stdin.nextInt();
			}
		}

		String result = "No";
		int a2 = c[1][0] - c[0][0];
		int a3 = c[2][0] - c[0][0];
		if ((c[1][1] == (a2 + c[0][1]))
			&& (c[1][2] == (a2 + c[0][2])) && (c[2][1] == (a3 + c[0][1])) && (c[2][2] == (a3 + c[0][2]))) {
			result = "Yes";
		}

		System.out.println(result);
	}

}


Measured memory_bytes: 23636
L = 1000
memo = Array.new(3) {[]}

f1 = ->(n) {(n ** 3 + 6 * n ** 2 + 11 * n + 6) / 6}
f2 = ->(n) {(n ** 2 + 3 * n + 2) / 2}
f3 = ->(n) {n + 1}

f = ->(s, n) {
  case n
  when 1 then f1.(s)
  when 2 then f2.(s)
  when 3 then f3.(s)
  when 4 then 1
  else nil
  end
}

doit = ->(s, n = 1) {
  co = 0
  return f.(s, n) if s <= L
  return 0 if n == 4
  
  return memo[n - 1][s] if memo[n - 1][s]
  
  (0..L).each do |i|
    co += doit.(s - i, n + 1)
  end
  memo[n - 1][s] = co
}

$<.readlines.map(&:to_i).each do |s|
  puts doit.(s)
end


Measured memory_bytes: 7016
#include<stdio.h>
int now[7];
int a,b,c,d;
int count(int e,int f){
	if(f==d){
		int k=1;
		for(int i=0;i<f;i++)k*=now[i];
		int p=0;
		for(int i=0;i<f;i++)p+=k/now[i];
		if(b*p==k*a)return 1;
		else return 0;
	}else{
		int val=1;
		for(int i=0;i<f;i++)val*=now[i];
		int ret=0;
		int k=1;
		for(int i=0;i<f;i++)k*=now[i];
		int p=0;
		for(int i=0;i<f;i++)p+=k/now[i];
		if(b*p==k*a)return 1;
		else if(b*p>k*a)return 0;//a/b<p/k
		else if(a*k*e>p*b*e+(d-f)*b*k)return 0;//a/b>p/k+(d-f)/e
		for(int i=e;(f||b*d>=a*i)&&i*val<=c;i++){
			now[f]=i;
			ret+=count(i,f+1);
		}
		return ret;
	}
}
int main(){
	while(scanf("%d%d%d%d",&a,&b,&c,&d),a+b+c+d){
		printf("%d\n",count(1,0));
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final Station[] stations = new Station[n - 1];
        for (int i = 0; i < n - 1; i++) {
            stations[i] = new Station(scanner.nextInt(), scanner.nextInt(), scanner.nextInt());
        }

        for (int i = 0; i < n - 1; i++) {
            int sum = stations[i].start + stations[i].time;
            for (int j = i + 1; j < n - 1; j++) {
                final Station station = stations[j];
                final int tmp = (sum + station.interval - 1) / station.interval * station.interval;
                sum = Math.max(tmp, station.start) + station.time;
            }
            System.out.println(sum);
        }
        System.out.println(0);
    }

    static class Station {
        int time;
        int start;
        int interval;

        Station(final int time, final int start, final int interval) {
            this.time = time;
            this.start = start;
            this.interval = interval;
        }
    }
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;

int cnt;

void printArr(int A[], int n) {
    for (int i = 0; i < n; ++i) {
        cout << A[i];
        if (i < n-1)
            cout << ' ';
    }
    cout << endl;
}

void selectionSort(int A[], int N) {
    int minj;
    REP(i, N) {
        minj = i;
        FOR(j, i, N) {
            if (A[j] < A[minj])
                minj = j;
        }
        if (minj != i) {
            swap(A[i], A[minj]);
            ++cnt;
        }
    }
}

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

    int n;
    cin >> n;

    int arr[n];
    for (int i = 0; i < n; ++i) cin >> arr[i];

    selectionSort(arr, n);
    printArr(arr, n);
    cout << cnt << endl;
}


Measured memory_bytes: 3220