akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (long long)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

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; // Be careful not to overflow
}

ll fib(ll n){
    vll a(n+1);
    a[0] = 1;
    a[1]  = 1;

    REP(i,2,n+1){
        a[i] = a[i-1] + a[i-2];
        a[i] %= mod;
    }

    return a[n-1];
}

int main()
{
    ll n;
    cin >> n;
    map<ll, ll> s;
    rep(i,n){
        ll a;
        cin >> a;
        s[a]++;
    }

    ll ans = 0;
    ll m;
    cin >> m;
    rep(i,m){
        ll b;
        cin >> b;
        if(s[b] > 0)ans++;
    }

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


Measured memory_bytes: 3180
import java.util.*;
import java.io.*;
public class Main extends PrintWriter {
    Main()
    {
        super(System.out);
    }
    public static void main(String args[]) {
      Main o=new Main();
      o.main();
      o.flush();
      o.close();
    }
    void main()
    {
        Scanner sc=new Scanner(System.in);
        int mod=sc.nextInt();
        int val=7%mod;
            int i;
            for(i=1;i<=mod;i++)
            {
                if(val==0)
                {
                    println(i);
                    return ;
                }
                val=((val*10)+7)%mod;
            }
            println(-1);
            
        
        sc.close();
    }
}

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

int main(){
  string x,y;
  cin >> x >> y;
  if(x > y) cout << '>' << endl;
  else if(x <y) cout << '<' << endl;
  else cout <<'='<< endl;
  
  return 0;
}

Measured memory_bytes: 256
import sys
n = int(input())
x, y = [], []
for _i in range(n):
    s = input()
    p = 0
    m = 0
    for j in range(len(s)):
        if s[j]=="(":
            p += 1
        else:
            p -= 1
            m, _m = sorted([p, m])
    if p > 0:
        x.append([m, p])
    else:
        y.append([m-p, -p])

x.sort(reverse=True)
y.sort(reverse=True)
r = 0
for s, t in x:
    if r+s < 0:
        print("No")
        sys.exit()
    r += t
result = 0
for s, t in y:
    if result+s < 0:
        print("No")
        sys.exit()
    result += t
if r-result == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 187052
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
bool isPrime(int x){
    if(x < 2) return false;
    else if(x == 2) return true;
    else if(x%2 == 0) return false;
    for(int i=3; i*i<=x; i+=2){
        if(x % i == 0) return false;
    }
    return true;
}
int main(){
    int a,d,n;
    while(1){
        int num[100000];
        cin >> a >> d >> n;
        if(a == 0 && d == 0 && n == 0) break;
        int cnt = 0;
        while(a < 1000000){
            if(isPrime(a)){
                num[cnt] = a;
                cnt++;
            }
            a += d;
        }
        cout << num[n-1] << endl;
    }
    return 0;
}



Measured memory_bytes: 3300
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const ll MOD=1e9+7;
    static const int MAXN=1e5+10;
    int n;
    char S[MAXN];
    ll dp[MAXN][16];
    void solve(){
        ios::sync_with_stdio(false);
        cin>>S;
        n=strlen(S);
        dp[0][0]=1;
        for(int u=0;u<n;u++){
            ll v=S[u]-'0';
            if(S[u]=='?')v=-1;
            for(ll d=0;d<10;d++){
                for(ll m=0;m<13;m++){
                    if(v!=-1&&v!=d)continue;
                    dp[u+1][(m*10+d)%13]+=dp[u][m];
                }
            }
            for(int m=0;m<13;m++)dp[u+1][m]%=MOD;
        }
        cout<<dp[n][5];
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

Measured memory_bytes: 12928
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

struct vertex{
    int X;
    int Y;
};

int	gcd(int	a, int b){
    while( b ){
        int	m = a % b;
        a = b;
        b = m;
    }
    return a;
}

int	lcm(int a, int	b){
    return (a*b)/gcd(a,b);
}

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //????????????

    int n,m;
    cin >> n >> m;
    
    if(n==1){
        cout << m << endl;
        return 0;
    }
    if(n==2){
        cout << "0 0"  << endl;
        return 0;
    }

    if(n%2==0){
        for(int i=1;i<=n/2+1;i++){
            cout << 0 << " ";
        }
        for(int i=n/2+2;i<n;i++){
            cout << m << " ";
        }
        cout << m << endl;
        return 0;
    }
    if(n%2==1){
        for(int i=1;i<=(n+1)/2;i++){
            cout << 0 << " ";
        }
        for(int i=(n+1)/2+1;i<n;i++){
            cout << m << " ";
        }
        cout << m << endl;
        return 0;
    }
    

    
    //???????????§
    //cout << "ans" << endl;????????????
    //printf("%.7f",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

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

using namespace std;

int main()
{
    float a,b,c,d;
    cin >>a>>b>>c>>d;
    if (ceil(a/d)>= ceil (c/b) )
    {
        cout << "Yes"<<endl;
    }
    else
    {
        cout<< "No"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3736
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int cnt = sc.nextInt();
        double answer = 0;

        for (int i = 0; i < cnt; i++) {
            float amount =sc.nextFloat() ;
            String type = sc.next();
            if(type.equals("JPY")) answer += amount;           
            if(type.equals("BTC")) answer += amount * 380000.0;
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 24660
#include <bits/stdc++.h>
#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 srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);

int main () {
  int a, b;
  cin >> a >> b;
  int ans = dup(b-1,a-1);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*
गिरते हैं शहसवार ही मैदान-ए-जंग में ।
वो तिफ़्ल क्या गिरे जो घुटनों के बल चले ।।
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
#define int     long long int
#define ull     unsigned int
#define ld      long double
#define pb      push_back
#define pa      pair<int,int>
#define ppa     pair<pair<int,int>,int>
#define pap     pair<int,pair<int,int>>
#define v1d     vector<int>
#define v2d     vector<vector<int> >
#define vpa     vector<pair<int,int>>
#define M       1000000007
#define MN      LLONG_MIN
#define MX      LLONG_MAX
#define ff      first
#define ss      second
#define endl    "\n"
#define v1s     vector<string>
#define all(v)  v.begin(),v.end()
#define S(v)    sort(v.begin(),v.end())
#define RS(v)   sort(v.rbegin(),v.rend())
#define R(v)    reverse(v.begin(),v.end())
#define mxpq(T)    priority_queue <T>
#define mnpq(T)    priority_queue<T,vector<T>,greater<T>>
#define T       int tc;cin>>tc;while(tc--)
#define p2d(v)     for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)      for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v)      for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define sz(v)       (int)(v.size())
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define qqq 400005


void Weapons19(){
    int n;cin>>n;
    while(n){
        if(n%10==7){cout<<"Yes";return;}
        n/=10;
    }
    cout<<"No";
























}

int32_t main(){

    /*
    त्यक्तवाधर्मं च लोभं च
    मोहंचो द्यमास्थिता।
    युद्ध्यध्वमनहंकारा
    यतो धर्मस्ततो जयः।।
    */

    cout<<fixed<<setprecision(16);
    cin.sync_with_stdio(false);
    cin.tie(0);cout.tie(0);

   // #i/

    Weapons19();
    
}


Measured memory_bytes: 3652
// https://atcoder.jp/contests/abc144/tasks/abc144_c

#include "algorithm"
#include "iostream"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

void solve() {
  ll N;
  cin >> N;

  ll res = 1e17;
  repf(i, 1, 1000005) {
    if (N % i == 0) {
      ll j = N / i;
      chmin(res, i + j - 2);
    }
  }

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


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

using namespace std;

int main(void){
    int n, a, b;
    cin >> n >> a >> b;
    cout << ((a*n >= b) ? b : a*n) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
  string S,T,G,K;
  ll hantei=0,s,c=0;
  cin >> S >> T;
  G=S;
  G[0]='~';
  rep(i,S.size()-T.size()+1){
    hantei=0;
    rep(j,T.size()){
      if(S[i+j]!=T[j] && S[i+j]!='?'){
        hantei=1;
        break;
      }
    }
    if(hantei==0){
      c++;
      K=S;
      rep(j,i){
        if(S[j]=='?'){
          K[j]='a';
        }
        else{
          K[j]=S[j];
        }
      }
      for(int k=i;k<=i+T.size();k++){
        K[k]=T[k-i];
      }
      for(int k=i+T.size();k<S.size();k++){
        if(S[k]=='?'){
          K[k]='a';
        }
        else{
          K[k]=S[k];
        }
      }
    }
    if(hantei==0 && G>K){
      G=K;
    }
  }
  if(c==0){
    cout << "UNRESTORABLE" << endl;
    return 0;
  }
  cout << G << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;

int N;
ll h[100005];
ll dp[100005];

int main() {
	
	cin >> N;
	for(int i=1;i<=N;++i) cin >> h[i];
	
	dp[1] = 0;
	dp[2] = abs(h[2]-h[1]);
	for(int i=3;i<=N;++i) dp[i] = min( dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]) );
	
	cout << dp[N] << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

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

#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)

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return 1;
    }
    return 0;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return 1;
    }
    return 0;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;

int N;
vector<double>t(200),v(200,0);
vector<double>r(200,0),l(200,0);

double func(double a){
    double minimum=100000;
    for(int i=0; i<N+2; i++) {
        if (a>=r[i]){
            minimum=min(minimum, a-r[i]+v[i]);
        }else if(a<=l[i]){
            minimum=min(minimum, l[i]-a+v[i]);
        }else{
            minimum=min(minimum,v[i]);
        }
    }
    return minimum;
}

int main(){
    double ans=0;
    cin >> N;
    for(int i=1; i<=N; i++){
        cin >> t[i];
        l[i]=r[i-1];
        r[i]=l[i]+t[i];
    }

    for(int i=1; i<=N; i++){
        cin >> v[i];
    }
    l[N+1]=r[N+1]=r[N];
    for(double a=0; a<r[N];){
        ans+=0.25*(func(a)+func(a+0.5));
        a+=0.5;
    }

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  
  cin >> N;
  
  int t = N, sum = 0;
  
  while (t > 0) {
    sum += t % 10;
    t /= 10;
  }
  
  if (N % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
// MPC-A.cpp :
//#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
    int m1,d1,m2,d2;
	cin >> m1 >> d1 >> m2 >> d2;
	int ans;
	// m1+1がm2でd2が1なら月末日
	if ((m1+1)==m2&&d2==1)
	{
		cout << "1" << endl;
	}
	// それ以外は月末日ではない
	else {
		cout << "0" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,sen,hyaku ,jyu,ichi;
  cin >> N;
  sen = N/1000;
  hyaku = (N-sen*1000)/100;
  jyu=(N-sen*1000-hyaku*100)/10;
  ichi=N-sen*1000-hyaku*100-jyu*10;
  if ((sen == hyaku && hyaku ==jyu )||(jyu == ichi && hyaku ==jyu)) {
  	cout << "Yes" <<endl;
  }
  else{
  	cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
using namespace std;

long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
void indexsort(long* first, long* last ,long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {

	long res = 1;
	long N; cin >> N;
	long H[1000]; for (int i = 1; i <= N; i++) cin >> H[i];
	long B = H[1];

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

		if (H[i] >= B) { res++; B = H[i]; }

	}

	cout << res << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int[] v = new int[n];
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			v[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
		}
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (v[i] - c[i] > 0) {
				ans += v[i] - c[i];
			}
		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 21716
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
tate = 0
yoko = 0
i = 0
while i < (N - 1):
    if A[i] == A[i + 1]:
        if tate == 0:
            tate = A[i]
        else:
            yoko = A[i]
        if tate > 0 and yoko > 0:
            break
        i += 1
    i += 1
print(tate * yoko)



Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define REP(i,n) for (long i=0;i<(n);i++)
#define FOR(i,a,b) for (long i=(a);i<(b);i++)
#define RREP(i,n) for(long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x)  cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } 
#define llINF (long long) 9223372036854775807
#define loINF (long) 2147483647
#define shINF (short) 32767
#define SORT(c) sort((c).begin(),(c).end())
#define DEBUG

using namespace std;
typedef vector<long> VI;
typedef vector<VI> VVI;
typedef pair<long,long> pr;
typedef map<double,pr> mp;

short N;

int main(void){
    cin >> N;
    cout << (N - (N % 3)) / 3;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(void)
{
 
string y;
string r;
 
cin>>y;
cin>>r;
 
int ans = 0;
 
for(int i=0;i<3;i++){
if(y[i]==r[i]) ans ++;
}
 
cout<<ans<<endl;
}
 
 

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
#define sz(x) ((int)(x).size())
#define int ll
#define el '\n'
typedef long long ll; typedef long double ld; typedef double dd;typedef vector<int> vi; typedef pair<int, int> pii;typedef pair<ll,ll> pll;
const ll INFLL=0x7f7f7f7f7f7f7f7f, MOD=1e9+7; const int INF=0x7f7f7f7f;
///if(///////////////// DEBUG /////////////////////////////////////////
#define D(x) cerr<<#x<<" is:\t"<<x<<'\n';
#define DD(x,y) cerr<<'('<<#x<<','<<#y<<") are:\t"<<x<<' '<<y<<'\n';
#define DDD(x,y,z) cerr<<'('<<#x<<','<<#y<<','<<#z<<") are:\t"<<x<<' '<<y<<' '<<z<<'\n';
/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vv<vv<int>> adj; vi vis, color; 
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
inline ll mexp(ll x,ll n,ll m=MOD){ll res=1;x%=m;while(n){if(n&1)res=(res*x)%m;n>>=1;x=(x*x)%m;}return res;}
inline ll gcd(ll a, ll b){while (a>0 && b>0){if(a>b)a%=b;else b%=a;}return a+b;}


///////////////////// MAIN STARTS //////////////////////////////////
int32_t main(void){
ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
cout<<fixed;cerr<<fixed; cout<<setprecision(10); cerr<<setprecision(3);
mt19937 genr(chrono::high_resolution_clock::now().time_since_epoch().count());


int h,w,n; cin>>h>>w>>n;
vector<int> v(n); for(int i=0;i<n;++i) cin>>v[i];
int pos=0;
int mat[h][w];
for(int i=0;i<h;++i){
	if(i%2==0){
		for(int j=0;j<w;++j){
			if(v[pos]==0) pos++;
			mat[i][j]=pos+1;
			v[pos]--;
		}
	} else{
		for(int j=w-1;j>=0;j--){
			if(v[pos]==0) pos++;
			mat[i][j]=pos+1;
			v[pos]--;
		}
	}
	cout<<el;
}
for(int i=0;i<h;++i) for(int j=0;j<w;++j) cout<<mat[i][j]<<" \n"[j==w-1];

return 0;
}


Measured memory_bytes: 512
s = input()
list_s = list(s)

a_num = -1
z_num = -1

for i in range(len(s)):
    if list_s[i] == "A":
        a_num = i
        break

for j in range(len(s)):
    if list_s[j] == "Z":
        z_num = j

print(z_num - a_num + 1)

Measured memory_bytes: 4840
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    X = list(map(int, input().split()))
    assert N == len(X)
    P = round(sum(X)/len(X))
    print(sum([(i-P)**2 for i in X]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S, T = input().split()
A, B = MAP()
U = input()
if U == S:
	print(A - 1, B)
if U == T:
	print(A, B - 1)


Measured memory_bytes: 5260
#include <bits/stdc++.h>
using namespace std;
int a[200000];
int main() 
{
  int n; scanf("%d", &n);
  for(int i = 0; i < n; ++i) 
  {
    scanf("%d", a + i);
  }
  sort(a, a + n);
  reverse(a, a + n);
  long long ans = a[0];
  for(int i = 0; i < n - 2; ++i) 
  {
    ans += a[i / 2 + 1];
  }
  cout << ans << endl;
  return 0;
}

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

int main(void)
{
    double r;
    scanf("%lf", &r);
    double a, c;

    a = (M_PI * r * r);
    c = (2 * M_PI * r);

    printf("%lf %lf\n", a, c);

    return 0;
}



Measured memory_bytes: 2056
while True:
    n,s,e = input().split()
    n = int(n)
    s = int(s)
    e = int(e)
    if not n+s+e:
        break
    s = s//100*60+s%100
    e = e//100*60+e%100
    t = [0]*(60*24+1)
    for i in range(n):
        m = int(input())
        g = input().split()
        j = 0
        for o in g:
            a = int(o)
            if j%2:
                t[a//100*60+a%100] += 1
            else:
                t[a//100*60+a%100] -= 1
            j += 1
    cnt = n
    ans = 0
    ma = -1
    for i in range(e):
        cnt += t[i]
        if i < s:
            continue
        if cnt:
            ans += 1
        else:
            if ma < ans:
                ma = ans
            ans = 0
    print(ma if ma > ans else ans)

Measured memory_bytes: 7616
#!/usr/bin/perl
use Data::Dumper;
my ($n) = map { $_ - 0 } split(/\s+/,<STDIN>);

my @d=(); $#d = 9;
foreach my $i (1..9){
  my @dd = ();
  $#dd = 9;
  $d[$i] = \@dd;
}

for(my $i=1;$i<=$n;$i++){
  my $d_min = $i % 10;
  my $d_max = $i;
  if( $i >= 100000 ){
    $d_max = int($i / 100000);
  } elsif( $i >= 10000 ){
    $d_max = int($i / 10000);
  } elsif( $i >= 1000 ){
    $d_max = int($i / 1000);
  } elsif( $i >= 100 ){
    $d_max = int($i / 100);
  } elsif( $i >= 10 ){
    $d_max = int($i / 10);
  }
  $d[$d_min]->[$d_max] ++;
}

my $s = 0;
for(my $i=1;$i<=9;$i++){
  for(my $j=1;$j<=9;$j++){
    $s += $d[$i]->[$j] * $d[$j]->[$i];
  }
}
print "$s\n";

exit(0);



Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n; cin >> n;
    ll ans = 0;
    for (int i = 1; i <= sqrt(n); i++)
    {
        ans = i*i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np

n , p = map(int, input().split())
a = np.array(list(map(int, input().split())))

a = a%2

one = np.count_nonzero(a)
zero = n - one

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

ans = 0

for i in range(one+1):
    if i % 2 == p:
        ans += cmb(one, i)
        # print(ans)

ans *= 2**zero

print(ans)



Measured memory_bytes: 12444
#include <bits/stdc++.h>
#define repi(i, a, b) for (int i = (int)(a) ; i < (int)(b) ; i++)
#define rep(i, n) repi(i, 0, n)
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
// using P = pair<int, int>;
struct Vec{
    double x, y;
};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
     return false;
}
using namespace std;

int dp[100001];

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    repi(i, 2, n){
        dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
        for (int l = i - 2 ; l >= i - k && l >= 0 ; l--){
            dp[i] = min(dp[l] + abs(h[i] - h[l]), dp[i]);
        }
    }
    cout << dp[n - 1] << endl;

    
    return 0;
}

Measured memory_bytes: 4044
import heapq
 
N, M = list(map(int, input().split()))
A = input().split(" ")
neg_A = [-int(a) for a in A]
 
heapq.heapify(neg_A)
 
for t in range(M):
    heapq.heappush(neg_A, -(-heapq.heappop(neg_A)//2))
print(-sum(neg_A))

Measured memory_bytes: 72020
#include <iostream>
#include <cstdint>
#include <algorithm>

int const MAXN = 200000;
int const MAXNN = 1<<18;
int64_t const INF = (int64_t)1<<59;

int N;
int64_t C, h[MAXN];

int64_t ic[MAXN-1], sl[MAXN-1];
int64_t dp[MAXN];

// calc value of line-i at h[j]
inline int64_t calc_f(int i, int j) {
  int64_t x = h[j];
  return sl[i]*x + ic[i];
}

int deq[MAXN], head, tail;

void init() {
  head = 0;
  tail = 0;
}

// sl[f1] > sl[f2] > sl[f3]
bool removeF2(int f1, int f2, int f3) {
  int64_t a2 = sl[f2], b2 = ic[f2];
  int64_t a1 = sl[f1] - a2, b1 = ic[f1] - b2;
  int64_t a3 = sl[f3] - a2, b3 = ic[f3] - b2;
  return b1*a3 >= a1*b3;
}

int main() {
  std::cin >> N >> C;
  for(int i = 0; i < N; ++i) std::cin >> h[i];
  init();

  dp[0] = 0;
  for(int i = 1; i < N; ++i) {
    sl[i] = -h[i-1]*2;
    ic[i] = dp[i-1] + h[i-1]*h[i-1];
    // update(i)
    while(head+1 < tail && removeF2(deq[tail-2], deq[tail-1], i)) --tail;
    deq[tail++] = i;
    while(head+1 < tail && calc_f(deq[head], i) >= calc_f(deq[head+1], i)) ++head;

    dp[i] = calc_f(deq[head], i) + h[i]*h[i] + C;
  }
  std::cout << dp[N-1] << std::endl;
  return 0;
}


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

int main() {
  int n, t;
  cin >> n >> t;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
  vector<int> ord, oth;
  for (int i = 0; i < n; ++i) {
    if (a[i] > 0) ord.push_back(i);
    else oth.push_back(i);
  }
  sort(ord.begin(), ord.end(), [&](int i, int j) {
    // T + a[i] * T + b[i] + a[j] * (T + a[i] * T + b[i] + 1) + b[j]
    // T + a[j] * T + b[j] + a[i] * (T + a[j] * T + b[j] + 1) + b[i]
    return 1LL * a[j] * b[i] + a[j] < 1LL * a[i] * b[j] + a[i];
  });
  vector<int> dp(40, t + 1);
  dp[0] = 0;
  for (int i = 0; i < ord.size(); ++i) {
    vector<int> nxt(dp.begin(), dp.end());
    for (int j = 1; j < 40; ++j) {
      int v = dp[j - 1];
      int64_t tk = v + 1 + 1LL * a[ord[i]] * (v + 1) + b[ord[i]];
      if (tk <= t) nxt[j] = min(nxt[j], (int)tk);
    }
    dp = nxt;
  }
  sort(oth.begin(), oth.end(), [&](int i, int j) { return b[i] < b[j]; });
  int res = 0;
  for (int i = 0; i < 40; ++i) {
    if (dp[i] <= t) res = i;
  }
  int64_t sum = 0;
  for (int i = 0; i < oth.size(); ++i) {
    sum += b[oth[i]];
    for (int j = 0; j < 40; ++j) {
      if (dp[j] > t) break;
      if (sum + dp[j] + i + 1 <= t) res = max(res, i + 1 + j);
    }
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<functional>
#include<queue>
#include<cmath>

using namespace std;

#if 0
所用時間:

感想:

#endif

int N, TIME=0, TIME_KEEP[100+5][2]={}; //TIME_KEEP[VERTEX] = [DISCOVER, FINISHED]
vector<int> vertices[100+5];
bool visited[100+5] = {};

void dfs(int cur);
bool check(int& remain, int N);

int main(){
    cin >> N;
    for(int i = 0; i < N; ++i){
        int index, itr;
        cin >> index >> itr;
        for(int i = 0; i < itr; ++i) {
            int buff;
            cin >> buff;
            vertices[index].push_back(buff);
        }
    }
    dfs(1);
    int remain;

    while(!check(remain, N)){//未発見のものがないか?
        //cout << "DETECTED" << endl;
        dfs(remain);
    }

    for(int i = 1; i <= N; ++i){
        cout << i << " " << TIME_KEEP[i][0] << " " << TIME_KEEP[i][1] << endl;
    }
}

void dfs(int cur){
    visited[cur] = true;
    TIME++;
    int discover = TIME;
    for(auto itr = vertices[cur].begin(); itr!=vertices[cur].end(); itr++)
        if(!visited[*itr]){
            dfs(*itr);
            visited[*itr] = true;
        } 
    TIME++;
    int finish = TIME;
    //cerr << "VERTEX:" << cur << " DISCOVER: " << discover << " FINISHED: " << finish << endl;
    TIME_KEEP[cur][0] = discover;
    TIME_KEEP[cur][1] = finish;
}

bool check(int& remain, int N){
    for(int i = 1; i <= N; ++i){
        if(!visited[i]) {
            remain = i;
            //cout << "remain:" << remain  << endl;
            return false;
        }
    }
    return true;
}


Measured memory_bytes: 3136
a,b = map(int,input().split());c = 0
if a >= b:
    c += a
    a = a - 1
    if a >= b:
        c += a
    
    else:
        c += b
    
else:
    c += b
    b = b - 1
    if a >= b:
        c += a
    else:
        c += b
        
print(c)


Measured memory_bytes: 2940
#include <algorithm>　　　 //STL 通用算法
#include <bitset>　　　　　//STL 位集容器
#include <cctype>         //字符处理
#include <cerrno> 　　　　 //定义错误码
#include <cfloat>　　　　 //浮点数处理
#include <ciso646>         //对应各种运算符的宏
#include <climits> 　　　　//定义各种数据类型最值的常量
#include <clocale> 　　　　//定义本地化函数
#include <cmath> 　　　　　//定义数学函数
#include <complex>　　　　 //复数类
#include <csignal>         //信号机制支持
#include <csetjmp>         //异常处理支持
#include <cstdarg>         //不定参数列表支持
#include <cstddef>         //常用常量
#include <cstdio> 　　　　 //定义输入／输出函数
#include <cstdlib> 　　　　//定义杂项函数及内存分配函数
#include <cstring> 　　　　//字符串处理
#include <ctime> 　　　　　//定义关于时间的函数
#include <cwchar> 　　　　 //宽字符处理及输入／输出
#include <cwctype> 　　　　//宽字符分类
#include <deque>　　　　　 //STL 双端队列容器
#include <exception>　　　 //异常处理类
#include <fstream> 　　　 //文件输入／输出
#include <functional>　　　//STL 定义运算函数（代替运算符）
#include <limits> 　　　　 //定义各种数据类型最值常量
#include <list>　　　　　　//STL 线性列表容器
#include <locale>         //本地化特定信息
#include <map>　　　　　　 //STL 映射容器
#include <memory>         //STL通过分配器进行的内存分配
#include<new>            //动态内存分配
#include <numeric>         //STL常用的数字操作
#include <iomanip> 　　　 //参数化输入／输出
#include <ios>　　　　　　 //基本输入／输出支持
#include <iosfwd>　　　　　//输入／输出系统使用的前置声明
#include <iostream> 　　　//数据流输入／输出
#include <istream>　　　　 //基本输入流
#include <iterator>        //STL迭代器
#include <ostream>　　　　 //基本输出流
#include <queue>　　　　　 //STL 队列容器
#include <set>　　　　　　 //STL 集合容器
#include <sstream>　　　　 //基于字符串的流
#include <stack>　　　　　 //STL 堆栈容器
#include <stdexcept>　　　 //标准异常类
#include <streambuf>　　　 //底层输入／输出支持
#include <string>　　　　　//字符串类
#include <typeinfo>        //运行期间类型信息
#include <utility>　　　　 //STL 通用模板类
#include <valarray>        //对包含值的数组的操作
#include <vector>　　　　　//STL 动态数组容器
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n,k;cin >>n>>k;
    vector<ll>p(n);vector<ll>c(n);
    for (int i = 0; i < n; ++i){
        cin >>p[i];
        p[i]--;
    }
    for (int i = 0; i < n; ++i)cin >>c[i];
    vector<bool>used(n,false);
    vector<vector<ll>>ss;
    ll ans=-INFll;
    for (int i = 0; i < n; ++i) {
        if(used[i])continue;
        vector<ll>s;
        int now=i;
        while(!used[now]){
            s.push_back(c[now]);
            used[now]=true;
            now=p[now];
        }
        ss.push_back(s);
    }
    for(auto v:ss){
        ll loop=v.size();
        vector<ll>sum(2*loop+1,0);
        for (int i = 0; i <loop*2; ++i)sum[i+1]=sum[i]+v[i%loop];
        vector<ll>mx(loop,-INFll);
        for (int i = 0; i < loop; ++i) {
            for (int j = 0; j < loop; ++j) {
                mx[j]=max(mx[j],sum[i+j]-sum[i]);
            }
        }
//        for (int i = 0; i < loop; ++i) {
//            cout<<i<<" "<<mx[i]<<" ";
//        }
//        cout <<endl;
        for (int r = 0; r <loop; ++r) {
            if(r>k)continue;
            ll q=(k-r)/loop;
            if(r==0&&q==0)continue;
            if(sum[loop]>0)ans=max(ans,mx[r]+sum[loop]*q);
            else if(r>0)ans=max(ans,mx[r]);
        }
    }
    cout <<ans <<endl;
}


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

int main(){
  int k, x, i;
  cin >> k >> x;
  for(i=x-k+1; i<=x+k-1; i++){
   if(i>1000000 || i<-1000000) cout << ""; 
   else cout << i << " ";
  }
  cout << endl;
}

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

bool isPrime(int num){
    if(num < 2) return false;
    else if(num == 2) return true;
    else if(num % 2 == 0) return false;
    
    for (int i = 3; i < (num / 2); i += 2){
      if(num % i == 0) return false;
    }
    return true;
  }
int main() {
  int x;
  cin >> x;
  
  while(true){
    if(isPrime(x)) break;
    x++;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <stdio.h>
#include <string>


using namespace std;
int main()
{
    int intNum,intInOne,intInTwo;
    int intCount = 0;

    cin >> intNum;

    for (int i = 0; i < intNum; i++)
    {
        cin >> intInOne>> intInTwo;

        if (intInOne == intInTwo)
        {
            intCount++;

            if (intCount >= 3)
            {
                cout << "Yes" << endl;

                return 0;
            }
        }
        else
        {
            intCount = 0;
        }
    }

   

        cout << "No" << endl;

        return 0;
    

    


}



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

int main() {
	string S;
	cin >> S;
	string T = S.substr(0, (S.size() - 1) / 2);
	string RS = S, RT = T;
	reverse(RS.begin(), RS.end()), reverse(RT.begin(), RT.end());
	if (RS == S && RT == T) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 384
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int timecount =0;
		int count = sc.nextInt();
		int max   = sc.nextInt();

		Queue<String> queName = new LinkedList<String>();
		Queue<Integer> queTime = new LinkedList<Integer>();

		for(int i=0; i<count; i++) {
			queName.add(sc.next());
			queTime.add(sc.nextInt());
		}

		while(queName.size() !=0) {
			if(queTime.peek()-max>0) {
				queName.add(queName.poll());
				queTime.add(queTime.poll()-max);
				timecount +=max;
			}else {
				timecount += queTime.poll();
				System.out.println(queName.poll()+" "+timecount);
			}

		}




	}
}




Measured memory_bytes: 74536
/**
 * Author: Deb Natkh Maxim (debnatkh@gmail.com)
 */

#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define getbit(x, i) (((x) >> (i)) & 1)
using namespace std;
typedef pair<int, int> pii; 

const int MAXN = 1e5;
int arr[MAXN];

signed main() {
	int a, b;
	cin >> a >> b;
	a--;
	b--;
	cout << (b + a - 1) / a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll>p(n);
    vector<double>num(n+1,0);
    for(ll i=0;i<n;i++){
        cin >> p[i];
        num[i]=(p[i]+1.0)/2.0;
    }
    vector<double>dp(n+1,0);
    for(ll i=0;i<n;i++){
        dp[i+1]=dp[i]+num[i];
    }
    double ans=0;
    for(ll i=0;i<=n-k;i++){
        double x=dp[i+k]-dp[i];
        ans=max(ans,x);
    }
    cout << fixed << setprecision(10);
    cout << ans << endl;
}


Measured memory_bytes: 7992
let () =
    let main n =
        let s = n in
        let x1 = 0 in
        let y1 = 0 in
        let sq = int_of_float (ceil (sqrt (float (s)))) in
        let rec loop offs =
            let x2 = sq + offs in
            let y3 = sq - offs in
            let sq2 = x2 * y3 - s in
            if x2 > 1_000_000_000 || sq2 < 0 then failwith "??" else
                let rec loop_2 sq3 count =
                    if count > 1000000 || sq3 < 1 then loop (offs + 1) else
                    if sq2 mod sq3 = 0 then
                        let x3 = sq3 in
                        let y2 = sq2 / sq3 in
                        x1, y1, x2, y2, x3, y3
                    else loop_2 (sq3 - 1) (count + 1)
                in
                if sq2 = 0 then x1, y1, x2, 0, 0, y3 else
                let sq3 = int_of_float (floor (sqrt (float (sq2)))) in
                loop_2 sq3 0
        in
        loop 0
    in
    let x1, y1, x2, y2, x3, y3 = main (int_of_string (read_line ())) in
    Printf.printf "%d %d %d %d %d %d\n" x1 y1 x2 y2 x3 y3

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
class Solve{
    int H,W;
    bool[,] b;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();
        int count = 0;
        for(int i=0;i<H;i++){
            int j;
            bool d = false;
            for(j=0;j<count;j++){
                if(b[i,j]){
                    Console.WriteLine("Impossible");
                    return;
                }
            }
            if(!b[i,j]){
                Console.WriteLine("Impossible");
                return;
            }
            j++;
            for(;j<W;j++){
                if(!b[i,j]){
                    count = j-1;
                    d = true;
                    j++;
                    break;
                }
            }
            if(!d){
                count = W-1;
            }
            for(;j<W;j++){
                if(b[i,j]){
                    Console.WriteLine("Impossible");
                    return;
                }
            }
        }
        Console.WriteLine("Possible");
    }
    void getinput(){
        string[] str = Console.ReadLine().Split(' ');
        H = int.Parse(str[0]);
        W = int.Parse(str[1]);
        b = new bool[H,W];
        string s;
        for(int i=0;i<H;i++){
            s = Console.ReadLine();
            for(int j=0;j<W;j++){
                if(s[j] == '#'){
                    b[i,j] = true;
                }
                else{
                    b[i,j] = false;
                }
            }
        }
    }    
}

Measured memory_bytes: 2648
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define p 998244353

int MOD(int a){
	return (a %= p) >= 0 ? a : a + p;
}

int power(int a, int N){
	if(N == 0) return 1;
	else if(N % 2 == 0) return power(MOD(a * a), N / 2);
	else return MOD(a * power(a, N - 1));
}

int inverse(int a){
	return power(a, p - 2);
}

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

int lcm(int a, int b){
	return (a / gcd(a, b)) * b;
}

signed main(){
	int N, i, j;
	scanf("%lld", &N);
	vector<int> A(N);
	int Amax = 0;
	for(i = 0; i < N; i++){
		scanf("%lld", &A[i]);
		Amax = max(Amax, A[i]);
	}
	vector<int> Anum(Amax + 1, 0);
	for(i = 0; i < N; i++){
		Anum[A[i]]++;
	}
	vector<int> B(Amax + 1, 0);
	for(i = 1; i <= Amax; i++){
		for(j = 1; i * j <= Amax; j++){
			B[i] += i * j * Anum[i * j];
		}
		B[i] = MOD(MOD(B[i]) * MOD(B[i]));
	}
	vector<int> C(Amax + 1, 0);
	for(i = Amax; i >= 1; i--){
		C[i] = B[i];
		for(j = 2; i * j <= Amax; j++){
			C[i] = MOD(C[i] - C[i * j]);
		}
	}
	int ans = 0;
	for(i = 1; i <= Amax; i++){
		ans = MOD(ans + C[i] * inverse(i));
	}
	for(i = 0; i < N; i++){
		ans = MOD(ans - A[i]);
	}
	ans = MOD(ans * inverse(2));
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 25216
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=200010;
const ll mod=1e9+7;


int main(){
  ll a,b;
  cin >> a >> b;
  if(abs(a-b)<=1){
    cout << "Brown" << ln;
  } else {
    cout << "Alice" << ln;
  }
  return 0;
}

Measured memory_bytes: 3628
a, b, c, d = [int(e) for e in input().split()]

def gcd(a, b):
  while True:
    t = b % a
    if t == 0:
      return a
    b, a = a, t

def f(a, b, n):
  return b // n - (a - 1) // n

acc = 0
acc += f(a, b, c)
acc += f(a, b, d)
acc -= f(a, b, c * d // gcd(c, d))
print(b - a + 1 - acc)


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

int main()
{
  string S, T;
  cin >> S >> T;
  int n = S.size(), m = T.size(), ans = 2000;
  for (int i = 0; i < n - (m - 1); i++)
  {
    int cnt = 0;
    for (int j = 0; j < m; j++)
    {
      if (S.at(i + j) != T.at(j))
      {
        cnt++;
      }
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<queue>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
  int s1,s2;
  cin >>s1;
  cin >>s2;
  

  cout << (s2*2 - s1);
    return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
    int k, s;
    cin >> k >> s;
    int x, y, z;
    int cnt=0;
    for(x=0; x<=k; x++) {
        for(y=0; y<=k && x+y<=s; y++) {
            if(x+y+k>=s) cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    String data;

    for (int i = 0;i<n ;i++ ) {
      data = sc.next();

      if(data.equals("AC")){
        ac++;
      }else if(data.equals("WA")){
        wa++;
      }else if(data.equals("TLE")){
        tle++;
      }else{
        re++;
      }

    }
    System.out.println("AC x "+ac);
    System.out.println("WA x "+wa);
    System.out.println("TLE x "+tle);
    System.out.println("RE x "+re);

  }
}


Measured memory_bytes: 58884
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
	string str, order, buf;
	int q, a, b;
	
	cin >> str >> q;

	for (int i =0;i<q;i++){
		cin >> order >> a >> b;
		if (order == "print") {
			cout << str.substr(a, b - a + 1) << "\n";
		}
		else if (order == "reverse") {
			buf = str.substr(a, b - a + 1);
			reverse(buf.begin(), buf.end());
			str = str.replace(a, b - a + 1, buf);
		}
		else if (order == "replace") {
			cin >> buf;
			str.replace(a, buf.length(), buf);
		}
	}
	return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
using namespace std;
int main()
{
		ll n;
		cin>>n;
		ll m;cin>>m;
		char ch[n][m];
		for(ll i=0;i<n;i++)
		{
			for(ll j=0;j<m;j++)
			cin>>ch[i][j];
		}
		ll dp[n][m];
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(ll i=0;i<n;i++)
		{
			for(ll j=0;j<m;j++)
			{
				if(ch[i][j]!='#')
				{
					if(i-1>=0&&j-1>=0)
					dp[i][j]=(dp[i-1][j]%MOD+dp[i][j-1]%MOD)%MOD;
					else if(i-1>=0)
					dp[i][j]=dp[i-1][j];
					else if(j-1>=0)
					dp[i][j]=dp[i][j-1];
				}
			}
		}
		cout<<dp[n-1][m-1]%MOD<<endl;
		return 0;
	}
		

Measured memory_bytes: 12388
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long wt[110],val[110],v[110][110000];
    int n;
    long long w;
    cin>>n>>w;
    for(int i=1;i<=n;i++)
        cin>>wt[i]>>val[i];

    for(int i=0;i<=n;i++)
        for(int j=0;j<=w;j++)
            v[i][j]=0;

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(wt[i]>j)
            v[i][j]=v[i-1][j];
            else
            v[i][j]=max(v[i-1][j],val[i]+v[i-1][j-wt[i]]);
        }
    }
    cout<<v[n][w];
return 0;
}




Measured memory_bytes: 88960