akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) ll(i.size())
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
// const ll MAXN = 

ll n,ans;
/********** Good Luck :) **********/
int main()
{
    IOS();
    cin >> n;
    REP (i,n) {
        ll a;
        cin >> a;
        ans = __gcd(a,ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
   long long a,b,c,d;
   long long arr[4];
   long long max;

   cin>>a>>b>>c>>d;
   arr[0] = a*c;
   arr[1] = a*d;
   arr[2] = b*c;
   arr[3] = b*d;
  
   max = arr[0];
   for (int i = 1; i < 4; i++)
   {  
      if(max < arr[i])
         max = arr[i];
   }
     cout<<max<<endl; 
   


}

Measured memory_bytes: 3580
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
inline int X(int x)
{
	int sum=0;
	while(x)
		sum+=x%10,x/=10;
	return sum;
}
int main()
{
	int ans=99999;
	scanf("%d",&n);
	for(int i=1;i<=n/2;i++)
		ans=min(ans,X(i)+X(n-i));
	printf("%d\n",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
bool dpx[8003][8003];
bool dpy[8003][8003];

int main(){
    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;
    int n = s.size();
    string ans = "Yes";
    bool gox = true;
    vector<int> vx;
    vector<int> vy;
    rep(i, n) {
        if (s[i]=='T') gox = !gox;
        else {
            if (gox) {
                if (vx.size()==0 || s[i-1]=='T') {
                    vx.push_back(1);
                }
                else {
                    vx.back()++;
                }
            }
            else {
                if (vy.size()==0 || s[i-1]=='T') {
                    vy.push_back(1);
                }
                else {
                    vy.back()++;
                }
            }
        }
    }
    if (s[0]=='F') {
        x -= vx[0];
        vx.erase(vx.begin());
    }
    int sumx = 0;
    int sumy = 0;
    for (int e: vx) {
        sumx += e;
    }
    for (int e: vy) {
        sumy += e;
    }
    sumx -= x;
    if (sumx>=0 && sumx%2==0) {
        sumx /= 2;
    }
    else {
        cout << "No" << endl;
        return 0;
    }
    sumy -= y;
    if (sumy>=0 && sumy%2==0) {
        sumy /= 2;
    }
    else {
        cout << "No" << endl;
        return 0;
    }
    dpx[0][0] = true;
    dpy[0][0] = true;

    for (int i=1; i<=vx.size(); i++) {
        rep(j, 8001) {
            dpx[i][j] |= dpx[i-1][j];
            if (j-vx[i-1]>=0) dpx[i][j] |= dpx[i-1][j-vx[i-1]];
        }
    }
    if (!dpx[vx.size()][sumx]) {
        cout << "No" << endl;
        return 0;
    }

    for (int i=1; i<=vy.size(); i++) {
        rep(j, 8001) {
            dpy[i][j] |= dpy[i-1][j];
            if (j-vy[i-1]>=0) dpy[i][j] |= dpy[i-1][j-vy[i-1]];
        }
    }
    if (!dpy[vy.size()][sumy]) {
        cout << "No" << endl;
        return 0;
    }


    
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 34812
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
int c = sc.nextInt();

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

	}
}

Measured memory_bytes: 21204
import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		long X = keyboard.nextLong();
		long K = keyboard.nextLong();
		long D = keyboard.nextLong();
		long XX = Math.abs(X);
		
		long ans = 0;
		long count = XX/D;
		
		if(count>=K) {
			ans = XX - K*D;
		}else {
			ans = Math.abs(XX%D-(K-count)%2*D);
		}
		
		System.out.print(ans);
		keyboard.close();
	}
}

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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

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

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

  ll yma, ymi;
  ll xma, xmi;
  yma = xma = INT_MIN;
  ymi = xmi = INT_MAX;

  ll uma, umi;
  ll dma, dmi;
  ll rma, rmi;
  ll lma, lmi;
  uma = dma = rma = lma = INT_MIN;
  umi = dmi = rmi = lmi = INT_MAX;

  rep(i, n) {
    ll x, y; cin >> x >> y;
    x*=2; y*=2;
    char d; cin >> d;
    if (d=='U') {
      chmax(xma, x);
      chmin(xmi, x);
      chmax(uma, y);
      chmin(umi, y);
    } else if (d=='D') {
      chmax(xma,x);
      chmin(xmi,x);
      chmax(dma,y);
      chmin(dmi,y);
    } else if (d=='R') {
      chmax(rma,x);
      chmin(rmi,x);
      chmax(yma,y);
      chmin(ymi,y);
    } else {
      chmax(lma,x);
      chmin(lmi,x);
      chmax(yma,y);
      chmin(ymi,y);
    }
  }

  ll ans = LLONG_MAX;
  rep(i, 4e+8+1) {
    ll x1 = INT_MAX;
    chmin(x1, xmi);
    chmin(x1, rmi+i);
    chmin(x1, lmi-i);
    ll x2 = INT_MIN;
    chmax(x2, xma);
    chmax(x2, rma+i);
    chmax(x2, lma-i);
    ll y1 = INT_MAX;
    chmin(y1, ymi);
    chmin(y1, umi+i);
    chmin(y1, dmi-i);
    ll y2 = INT_MIN;
    chmax(y2, yma);
    chmax(y2, uma+i);
    chmax(y2, dma-i);
    auto x = abs(x2-x1);
    auto y = abs(y2-y1);
    chmin(ans, x*y);
  }
  cout << setprecision(15) << (double)ans/4 << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  if(a>=k)
    cout<<k<<endl;
  else
  {
    if(a+b>=k)
    {
      cout<<a<<endl;
    }
    else
    {
      cout<<a-(k-(a+b))<<endl;

    }
  }
  return 0;
}

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

jobs = []
for x in range(n):
	a, b = map(int, input().split())
	jobs.append([a, b])

jobs.sort(key=lambda x:x[1])

cumulative_times = []
t = 0
for job in jobs:
	t += job[0]
	cumulative_times.append(t)

flag = True
for job, c in zip(jobs, cumulative_times):
	if c > job[1]:
		flag = False

if flag:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 42736
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

using namespace std;

int main(){
  int a[3];
  for(int i=0;i<3;i++)cin>>a[i];
  sort(a,a+3);

  a[2] -= a[0];
  a[1] -= a[0];
  a[0] = 0;

  //cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
  int ans = 0;
  ans += a[1]/2;
  ans += ((a[2]-a[1])/2)*2;

  a[2] = (a[2]-a[1]) % 2;
  a[1] = a[1] % 2;
  a[2] += a[1];

  if( a[1] == 0){
    if(a[2] == 0){
      ans += 0;
    } else {
      ans += 1;
    }
  } else {
    if(a[2] == 1){
      ans += 2;
    } else {
      ans += 3;
    }
  }

  cout<<ans<<endl;

  return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
	int N,l,r;
	vector<int> X;
	cin >> N;
	X.resize(N);
	for (int i = 0; i < N; i++) cin >> X.at(i);
	vector<int> x(X);
	sort(x.begin(), x.end());
	l = x.at(N / 2 - 1);
	r = x.at(N / 2);
	for (int i = 0; i < N; i++) {
		if (X.at(i) <= l) {
			cout << r << endl;
		}
		else {
			cout << l << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include<iomanip>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF long long int(1e18+1)
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

int main()
{
	int h, w;
	cin >> h >> w;
	vector<vector<char>>s(h, vector<char>(w));
	rep(i, 0, h)
		rep(j, 0, w)cin >> s[i][j];

	queue<pair<int, int>>que;
	vector<pair<int, int>>move={ {1,0},{0,1},{0,-1},{-1,0} };
	vector<vector<int>>ans(h, vector<int>(w, 0));

	rep(i,0,h){
		rep(j, 0, w) {
			if (s[i][j] == '#')continue;
			vector<vector<int>>distance(h, vector<int>(w, 0));
			vector<vector<bool>>been(h, vector<bool>(w, 0));
			que.push({ i,j });
			been[i][j] = true;
			while (!que.empty()) {
				int beforeh = que.front().first;
				int beforew = que.front().second;
				que.pop();
				rep(k, 0, 4) {
					int nowh = beforeh + move[k].first;
					int noww = beforew + move[k].second;
					if (nowh >= 0 && noww >= 0 && nowh < h && noww < w) {
						if (been[nowh][noww])continue;
						if (s[nowh][noww] == '#')continue; 
						been[nowh][noww] = true;
						que.push({ nowh,noww });
						distance[nowh][noww] = distance[beforeh][beforew] + 1;
					}
				}
			}
			rep(nowi, 0, h)
				rep(nowj, 0, w)ans[nowi][nowj] = max(ans[nowi][nowj], distance[nowi][nowj]);
		}
	}

	int longest = 0;
	rep(i, 0, h)rep(j, 0, w)longest = max(longest, ans[i][j]);
	cout << longest << endl;
}




Measured memory_bytes: 3612
#include <iostream>

using namespace std;

int main(void){
    int n;
    int a, b;

    cin >> n;

    if(n == 1){
        cout << "Hello World" << endl;
    }else if(n == 2){
        cin >> a >> b;
        cout << a+b << endl;
    }

    return 0;
}

Measured memory_bytes: 256
def LIS(L):
  from bisect import bisect
  seq=[]
  for i in L:
    pos=bisect(seq,i)
    if len(seq)<=pos:
      seq.append(i)
    else:
      seq[pos]=i
  return len(seq)
 
import math 
x1,y1,x2,y2=map(int,input().split())
N=int(input())
W=abs(x2-x1)
H=abs(y2-y1)
xsgn=2*(x2>x1)-1
ysgn=2*(y2>y1)-1
XY=[]
for i in range(N):
  x,y=map(int,input().split())
  if (x-x1)*(x-x2)<=0 and (y-y1)*(y-y2)<=0:
    XY+=[[xsgn*(x-x1),ysgn*(y-y1)]]
short=20-5*math.pi
long=10*math.pi-20
straight=100*(W+H)
 
XY.sort()
Y = [y for x,y in XY]
 
fountain=LIS(Y)
 
if fountain<min(W,H)+1:
  print(straight-short*fountain)
else:
  print(straight-short*(fountain-1)+long)

Measured memory_bytes: 40168
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int counter = 0;
		for (int i=0; i<s.length(); i++) {
			if ( s.charAt(i) == '1') counter++;
		}
		System.out.println(counter);
	}

}


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

int main() {
    string s;
    cin >> s ;
    if(s[2]!=s[3]){
      cout << "No" << endl;
      return 0;
    }else if(s[4]!=s[5]){
      cout << "No" << endl;
      return 0;
    }
    cout << "Yes" << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n;
    while(cin >> n,n){
        int t[86500] = {0};
        rep(i,n){
            int h,m,s;
            char g;
            cin >> h >> g >> m >> g >> s;
            t[h * 3600 + m * 60 + s]+=1;
            cin >> h >> g >> m >> g >> s;
            t[h * 3600 + m * 60 + s]-=1;
        }
        int ans = 0, train = 0;
        rep(i,86500){
            train+=t[i];
            ans = max(ans, train);
        }
        cout << ans << endl;
    }
}

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

int n,m,a[1005]; bool bo[1005]; long long ans;
void calc(){
	int i,mx=0; long long tmp=0;
	for (i=1; i<=n; i++){
		if (bo[i] && a[i]<=mx){
			tmp+=mx+1-a[i]; mx++;
		}
		mx=max(mx,a[i]);
	}
	ans=min(ans,tmp);
}
void dfs(int k,int s){
	if (k>m){
		calc(); return;
	}
	int i;
	for (i=s+1; i<=n-m+k; i++){
		bo[i]=1;
		dfs(k+1,i);
		bo[i]=0;
	}
}
int main(){
	scanf("%d%d",&n,&m);
	int i;
	for (i=1; i<=n; i++) scanf("%d",&a[i]);
	ans=1000000000000000000ll;
	dfs(1,0);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()
#define MOD 1000000007
#define INF INT_MAX

using namespace std;
typedef long long ll;

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

template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}


int main(void) {
    ll n,m;
    cin>>n>>m;
    vector<vector<ll>>G(n);
    rep(i,m){
        ll a,b;
        cin>>a>>b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }


    vector<ll>s(n,-1);
    ll ans=0;
    rep(i,n){
        if(s[i]!=-1){ //visited
            continue;
        }

        queue<ll>que;
        que.push(i);
        s[i]=0;
        ++ans;

        while(!que.empty()){
            ll now=que.front();
            que.pop();

            for(ll next:G[now]){
                if(s[next]!=-1){
                    continue;
                }

                s[next]=1;
                que.push(next);
            }
        }
    }
    cout<<ans-1;
}


/*
a - b
c - d
*/

Measured memory_bytes: 10116
import Control.Applicative
import Control.Monad
import Data.List

f :: Int -> [Int] -> Int
f x ys = iter 0 ys
  where
    iter n [a]      = n
    iter n (a:b:as)
        | a + b <= x = iter n (b:as)
        | otherwise  = let k = n + ad + bd
                        in k `seq` iter k ((b - bd) : as)
      where
        ov = a + b - x
        bd = min b ov
        ad = min a (ov - bd)

main :: IO ()
main = do
    [_, x] <- fmap read . words <$> getLine :: IO [Int]
    as <- fmap read . words <$> getLine :: IO [Int]
    let ans = f x as
    print ans


Measured memory_bytes: 36220
#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;

// --------------------------------------
int n, m;
int a[10];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int cost[10] { 0,2,5,5,4,5,6,3,7,6 };

  cin >> n >> m;
  REP(i, m) cin >> a[i];

  sort(a, a + m);

  int dp[12][10005];
  REP(i, m + 1) REP(j, n + 1) dp[i][j] = -1;
  REP(i, m + 1) dp[i][0] = 0;

  REP(i, m) {
    REP(j, n + 1) {
      if(j - cost[a[i]] >= 0 && dp[i + 1][j - cost[a[i]]] >= 0) {
        dp[i + 1][j] = max(dp[i + 1][j - cost[a[i]]] + 1, dp[i][j]);
      } else {
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j]);
      }
    }
  }

  int d = dp[m][n];
  int y = m, x = n;

  while(d > 0) {
    if(x - cost[a[y - 1]] >= 0 && dp[y][x - cost[a[y - 1]]] == d - 1) {
      printf("%d", a[y - 1]);
      x = x - cost[a[y - 1]];
      d--;
    } else {
      y--;
    }
  }
}


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

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define PI acos(-1.0)
const int N=2e5 + 5;
const int M=1e5 + 5;


int main()
{
	ios_base::sync_with_stdio(false);
	int n,i,s[N],dp[N];
	cin>>n;
	bool dn[N];
	for(i=0;i<n;i++){
		cin>>s[i];
		dp[s[i]]=1;
		dn[s[i]]=false;
	}

	for(i=0;i<n;i++){
		dn[s[i]]=true;
		if(s[i]==1) continue;
		if(dn[s[i]-1]) dp[s[i]]=1+dp[s[i]-1];
	}
	int ans=1;
	for(i=1;i<=n;i++) ans=max(ans,dp[i]);
	cout<<n-ans<<endl;	
	
		
	return 0;
}

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

#define sz(a) ((int)a.size())
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define forse(i,s,e) for(int i=(int)s;i<(int)e;i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

using dbl=double;
using ll=long long;
using pii=pair<int, int>;
using pll=pair<ll, ll>;

dbl PI=3.141592653589793;


void solve(){
	int n;
	cin >> n;
	cout << n+n*n+n*n*n;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int T=1;
//	cin >> T;
	for(int c=1;c<=T;c++){
		solve();
	}
}


Measured memory_bytes: 3600
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.IO.Pipes;

public class HelloWorld
{
    static bool res = false;
    static public void Main()
    {
        //var NL = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var N = long.Parse(Console.ReadLine());
        long ans = 0;
        for (int C = 1; C < N; C++)
        {
            var aim = N - C;

            //foreach (var item in dic)
            //{
            //    sum *= (item.Value + 1);
            //}
            ans += PrimeFactorization(aim);
        }
        //for (int C = 1; C < N; C++)
        //{
        //    var aim = N - C;
        //    for (int A = 1; A <= aim; A++)
        //    {
        //        if (aim % A == 0) ans++;
        //    }
        //}

        Console.WriteLine(ans);
    }

    public static long PrimeFactorization(long n)
    {
        var sum = 1L;
        for (long i = 2; i * i <= n; i++)
        {
            if (n % i != 0) continue;
            long exponents = 0;

            // 割り続ける
            while (n % i == 0)
            {
                exponents++;
                n /= i;
            }

            sum *= (exponents + 1);
        }

        // 素数が残っている場合
        if (n > 1) sum *= 2;
        return sum;
    }
}


Measured memory_bytes: 27544
#include <iostream>
#include <vector>
using namespace std;
using ll=long long;

int good(string s){
  int N=s.size();
  if(N%2==1) return 0;
  if(N%2==0){
    string X=s.substr(0, N/2);
    string Y=s.substr(N/2, N/2);
    if(X==Y) return 1;
    else return 0;
  } //偶数
}

int main() {
  string S; cin>>S;
  int N=S.size();
  if(N%2==0){
    for(int i=N-2; i>=2; i-=2){
      string s=S.substr(0, i);
      if(good(s)==1){
        cout<<i<<endl;
        break;
      } //good
    } //for
  } //偶数
  if(N%2==1){
    for(int i=N-1; i>=2; i-=2){
      string s=S.substr(0, i);
      if(good(s)==1){
        cout<<i<<endl;
        break;
      } //good
    } //for
  } //奇数
}


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

int main() {
	int a, b, x;
	a = b = x = 0;
	cin >> a >> b >> x;

	if (a > x) {
		cout << "NO" << endl;
	}
	else if(a==x){
		cout << "YES" << endl;
	}
	else {
		if (a + b >= x) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main()
{
    string S;
    cin >> S;
    
    if(S == "SUN"){
        cout << 7 << endl;
    }
    else if(S == "MON"){
        cout << 6 << endl;
    }
    else if(S == "TUE"){
        cout << 5 << endl;
    }
    else if(S == "WED"){
        cout << 4 << endl;
    }
    else if(S == "THU"){
        cout << 3 << endl;
    }
    else if(S == "FRI"){
        cout << 2 << endl;
    }
    else if(S == "SAT"){
        cout << 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
 double a,b,f;
 int d,r;
 scanf("%lf%lf", &a,&b);
 d = a/b;
 r = (int)a% (int)b; 
 f = a/b;
 printf("%d %d %f\n", d, r, f);
return 0;
}
 

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n);++i)
const int INF =1001001001;
using ll=long long;
using P = pair<int,int>;
using Graph =vector<string>;
Graph field;
queue<P> q;

int main() {
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  ll ans=0;
  rep(i,k){
    ans+=a[i];
  }
  cout<<ans<<endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

int main(int argc, char **argv) {
	string s;
	cin >> s;
	ll res = 0, a = 0;
	set<char> c;
	REP(i, 4) c.insert("ACGT"[i]);
	REP(i, s.length()) if (c.count(s[i]) != 0) res = max(res, ++a); else a = 0;
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3632
# D - Knapsack 1
N,W=map(int,input().split())
w,v=[],[]
for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)

dp=[[0]*(W+1) for i in range(N+1)]

for i in range(N):
    for j in range(W+1):
        # 選ぶ場合
        if j-w[i]>=0:
            dp[i+1][j]=dp[i][j-w[i]]+v[i]
        dp[i+1][j]=max(dp[i+1][j],dp[i][j])
print(dp[N][W])

Measured memory_bytes: 121308
#include <iostream>
#include<cstdio>
#include<deque>
#include<string>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int maxn=2e5+100;
int n,m,a[10],s,c;
map<int,int>mp;
int main()
{

    cin>>n>>m;
    int flag=1;
    memset(a,-1,sizeof(a));
    while(m--)
    {
        cin>>s>>c;
        if(mp.count(s)==0){
            mp[s]=c;
            a[s]=c;
        }
        else{
            if(mp[s]!=c) flag=0;
        }
    }
    if(a[1]==0 && n>1) flag=0;
    if(flag==0) printf("-1");
    else{
        if(n>1){
            for(int i=1;i<=n;i++){
                if(a[i]==-1 && i==1) cout<<1;
                else if(a[i]==-1 && i>1) cout<<0;
                else cout<<a[i];
            }
        }
        else{
            if(a[1]==-1) cout<<0;
            else cout<<a[1];
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int V=sc.nextInt();//頂点数
			int E=sc.nextInt();//辺の数
			int s;//頂点
			int t;//頂点
			double[][] dist=new double[V+1][V+1];//辺の長さ(st距離)
			double[][] dp=new double[1<<V][V];
			double INF=1e100;
			
			for(int i=0; i<V; i++) {
				for(int j=0; j<V; j++) {
					dist[i][j]=INF;
				}
			}
			
			for(int i=0; i<E; i++) {
				s=sc.nextInt();
				t=sc.nextInt();
				dist[s][t]=sc.nextInt();
			}
			for(int i=0; i<(1<<V); i++) {
				for(int j=0; j<V; j++) {
					dp[i][j]=INF;
				}
			}
			dp[1][0]=0;//頂点0からスタートだから
			
			for(int i=0; i<(1<<V); i++) {
				for(int j=0; j<V; j++) {//現在いる頂点j
					if(dp[i][j]==INF) continue;
					for(int k=0; k<V; k++) {//次の行き先頂点k
						if((1&i>>k)==1) continue;//すでに訪れてるとき
						else if(dist[j][k]==INF) continue;//辺がないとき
						int nexti = i| (1<<k);//bitごとのOR演算(今まで通ってきた頂点に次の頂点を足せる) 
						//System.out.printf("nexti=%d\n", nexti);
						double nextd=dp[i][j]+dist[j][k];
						dp[nexti][k]=Math.min(dp[nexti][k], nextd);
					}
				}
			}
//			for(int i=0; i<(1<<V); i++) {
//				for(int j=0; j<V; j++) {
//					System.out.printf("dp[%d][%d]=%f\n", i, j, dp[i][j]);
//				}
//			}
			int all=(1<<V)-1;//最後の全部bitたっている状態
			double ret=INF;
			for(int i=0; i<V; i++) {//最後頂点0に戻る分の距離を足す
				if(dp[all][i]==INF) {
					continue;
				}
				else if(dist[i][0]==INF) continue;//頂点0にもどれないとき
				double temp = dp[all][i]+dist[i][0];
				ret=Math.min(ret, temp);
			}
			if(ret==INF) {
				ret=-1;
			}//bitが全部たたない
			System.out.println((int)ret);
			

		}
	}
}


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

constexpr int LEN = 10005;
vector<P> a[LEN];

void dikstra(const int n){
	int d[n];
	bool check[n] = {0};
	memset(d, 1, sizeof(d));
	priority_queue<P, vector<P>, greater<P> > h;

	d[0] = 0;
	h.push(make_pair(d[0], 0));
	check[0] = 1;

	while(h.size()){
		P f = h.top(); h.pop();
		int u = f.second;
		int uc = f.first;
		check[u] = 1;
		for(P vf : a[u]){
			int v = vf.second;
			int vc = vf.first;
			if(!check[v]){
				if((uc + vc) < d[v]){
					d[v] = uc + vc;
					h.push(make_pair(d[v], v));
				}
			}
		}
	}

	rep(i, n) cout << i << ' ' << d[i] << endl;
	return;
}

int main(){
	int n; cin >> n;
	rep(i, n){
		int u, k; cin >> u >> k;
		rep(j, k){
			int v, c; cin >> v >> c;
			a[u].push_back(make_pair(c, v));
		}
	}

	dikstra(n);
	return 0;
}



Measured memory_bytes: 8000
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

bool Red[500][500] = {}, Blue[500][500] = {};
int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  ll h,w;cin>>h>>w;
  vector<string> A(h);
  rep(y,h){
    cin>>A[y];
  }

  rep(x,w){
    Red[0][x] = true;
  }
  rep(x,w){
    Blue[h-1][x] = true;
  }
  rep(y,h-1){
    Red[y][0] = true;
  }
  //奇数列は全部青塗り
  rep(x,w-1){
    if(x == 0) continue;
    rep(y,h-1){
      if(y == 0) continue;
      if(x%2 == 0){
        Red[y][x] = true;
        if(A[y][x] == '#'){
          Blue[y][x] = true;
        }
      }else{
        Blue[y][x] = true;
        if(A[y][x] == '#'){
          Red[y][x] = true;
        }
      }
    }
  }

  rep(y,h){
    rep(x,w){
      cout << (Red[y][x] ? "#" : ".");
    }
    cout << endl;
  }
  cout << endl;
  rep(y,h){
    rep(x,w){
      cout << (Blue[y][x] ? "#" : ".");
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		String s = sc.next();
		sc.close();
		
		for(int i=0; i<n; i++){
			switch(s.charAt(i)){
			case 'a':
				if(a>0){
					System.out.println("Yes");
					a--;
				}else if(b>0){
					System.out.println("Yes");
					b--;
				}else{
					System.out.println("No");
				}
				break;
			case 'b':
				if(b>0){
					System.out.println("Yes");
					b--;
				}else{
					System.out.println("No");
				}
				break;
			case 'c':
				System.out.println("No");
				break;
			}
		}
	}

}

Measured memory_bytes: 23720
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }
        int ans = 0;
        int c = 1;
        while(c < n){
            c+= k-1;
            ans ++;
        }
        System.out.println(ans);
    }
}

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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

class DirectedGraph
{
public:
    DirectedGraph() {}
    DirectedGraph(int n)
    : g(vector< vs32 >(n)), dist(vs32(n, -1))
    {}
    ~DirectedGraph() {}

    void bfs(int u)
    {
        int d = 0;
        dist[u]  = 0;
        queue<int> q;
        q.push(u);
        while (!q.empty())
        {
            int n = q.size();
            ++d;
            rep (i, n)
            {
                int v = q.front();
                q.pop();
                rep (j, g[v].size())
                {
                    if (dist[g[v][j]] < 0)
                    {
                        dist[g[v][j]] = d;
                        q.push(g[v][j]);
                    }
                }
            }
        }
    }

    vector< vs32 > g;
    vs32 dist;
};

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

    int n;
    cin >> n;

    DirectedGraph dg(n);
    int u, v;
    int c;
    rep (i, n)
    {
        cin >> u >> c;
        --u;
        dg.g[u].resize(c);
        rep (j, c)
        {
            cin >> v;
            --v;
            dg.g[u][j] = v;
        }
    }

    dg.bfs(0);

    rep (i, n)
    {
        cout << i + 1 << " " << dg.dist[i] << "\n";
    }
    return 0;
}




Measured memory_bytes: 3144
def main():

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

    v = []
    for i in range(N):
        v.append(p[i]*(p[i]+1)/p[i]/2)

    # print(v)
    u = sum(v[:K])
    max_u = u
    # print(u)
    for i in range(K, N):
        u += v[i] - v[i-K]
        # print(u)
        max_u = max(max_u, u)
    return max_u


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 25060
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  int64_t ans=1;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  for(int i=0;i<N;i++){
  int64_t a=A.at(i);
    
   if(a==0) {ans=0;break;}
    else{
    if((1000000000000000000/a)<ans){ans=-1;break;}
      else
        ans*=a;
    
    }
  
  }for(int i=0;i<N;i++){
  if(A.at(i)==0){
    ans=0;break;
  }
  }
  cout<<ans<<endl;
  
   return 0;
}


Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin>>s;
	if(s[0]==s[s.size()-1]) {
		if(s.size()%2==0) {
			cout<<"First"<<endl;
		} else {
			cout<<"Second"<<endl;
		}
	}
	if(s[0]!=s[s.size()-1]) {
		if(s.size()%2==1) {
			cout<<"First"<<endl;
		} else {
			cout<<"Second"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int a['z' + 1] = {};
	for (string s; cin >> s;)
		for (int i = 0; i < s.size(); i++)
			a[s[i]]++;

	for (char c = 'a'; c <= 'z'; c++) 
		cout << c << " : " << a[c] + a[c - 32] << endl;

	return 0;
}

Measured memory_bytes: 1180
N, C, K = [int(i) for i in input().split()]
T = sorted([int(input()) for i in range(N)])
ans = 1
limit = 0
ti = T[0]
for i in range(N - 1):
    limit += 1
    if ti + K < T[i + 1] or limit == C:
        ti = T[i + 1]
        ans += 1
        limit = 0
print(ans)


Measured memory_bytes: 8280
A, = [list(map(int, s.split())) for s in open(0)][0]

ans = 0
num_digits = len(str(A))
if num_digits == 1:
    ans += A 
else:
    if num_digits % 2 != 0:
        ans += A - 10 ** (num_digits - 1) + 1
    for i in range(3, num_digits, 2):
        ans += 10 ** i - 10 ** (i - 1) 
    ans += 9
print(int(ans))

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

int main(){
  int n;
  cin >> n;
  int s[n];
  
  for(int i=0;i<n;++i){
    cin >> s[i];
  }
  int g=0;
  int h=0;
  for(int i=0;i<n;++i){
  if(g < s[i]){
    g=s[i];
    h=i;
    }
  }
  int sum=0;
  for(int i=0;i<n;++i){
    if(i == h)continue;
    sum += s[i];
  }
  
  if(sum > g){
  cout << "Yes" << endl;}else{cout << "No" << endl;}
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct Precision{
  Precision(){
    cout<<fixed<<setprecision(12);
  }
}precision_beet;

//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;
  double ans=0;
  for(Int i=1;i<=n;i++){
    double p=1.0/n;
    Int x=i;
    while(x<k){
      x*=2;
      p/=2;
    }
    ans+=p;
  }  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define sz(x) (int)(x.size())
#define lt(x) (int)(x.length())
#define MOD 1000000007 
#define mx 100003

vector<int> kmp(const string &T, const string &P) {
  if (P.empty()) return {};
  vector<int> pi(P.size(), 0);
  for (int i = 1, k = 0; i < P.size(); ++i) {
    while (k && P[k] != P[i]) k = pi[k - 1];
    if (P[k] == P[i]) ++k;
    pi[i] = k;
  }
  return pi;
}


int main(){
	string ss;
	cin >> ss;
	int n = sz(ss);
	set<char> isi;
	for(auto i : ss)
		isi.insert(i);
	if(sz(isi) == 1){
		cout << n << endl << 1 << endl;
		return 0;
	}
	bool ada = false;
	int mini;
	for(int i = 1; i < n; i++){
		if(n % i > 0)
			continue;
		bool ya = true;
		for(int j = 0; j < n - i; j++){
			if(ss[j] != ss[j + i]){
				ya = false;
				break;
			}
		}
		if(ya){
			ada = true;
			mini = i;
			break;
		}
	}
	if(!ada){
		cout << 1 << endl << 1 << endl;
		return 0;
	}
	int jaw = 0;
	vector<int> satu = kmp("", ss);
	reverse(ALL(ss));
	vector<int> dua = kmp("", ss);
	reverse(ALL(ss));
	for(int i = 0; i < n - 1; i++){
		int x = satu[i];
		int y = dua[n - i - 2];
		bool a = false;
		bool b = false;
		if(x == 0)
			a = true;
		if(y == 0)
			b = true;

		if((i + 1) % (i + 1 - x) != 0){
			// debug(i);
			// jaw += 1;
			a = true;
		}
		if((n - i - 2 + 1) % (n - i - 2 + 1 - y) != 0)
			b = true;
		if(a && b)
			jaw += 1;
	}
	// assert(false);
	cout << 2 << endl << jaw << endl;
}

Measured memory_bytes: 4740
#include <iostream>
#include <stack>

int main(){
	int a;
	std::stack<int> stack;

	while(std::cin >> a){
		if(a > 0){
			stack.push(a);		//push
		} else{
			std::cout << stack.top() << std::endl;	//表示
			stack.pop();		//pop
		}
	}

	return 0;
}


Measured memory_bytes: 3016
H,W = map(int,input().split())
grid = [[]] * H

for i in range(H):
  c = list(input())
  grid[i] = c
  
black = "#"
white = "."

ans = "Yes"

for i in range(H):
  for j in range(W):
    if grid[i][j] == black:
      around = ""
      #ヨコ
      for t in range(max(0,j - 1),min(W,j + 2)):
        if t != j:
          around += grid[i][t]
      #タテ
      for k in range(max(0,i - 1),min(H,i + 2)):
        if k != i:
          around += grid[k][j]
      
      if all([s == white for s in around]):
        ans = "No"
        break
  if ans == "No":
    break
      
print(ans)


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

using namespace std;

#define ll long long

int N, X, M[105], minv = 100000000;

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

    for(int i = 0; i < N; i++){
        cin >> M[i];
        minv = min(minv, M[i]);
        X -= M[i];
    }

    cout << N + X/minv << endl;
}


Measured memory_bytes: 256
n = int(input())
s = [0]*n
for i in range(n):
    s[i] = int(input())

total = sum(s)
if total%10 != 0:
    ans = total
else:
    s.sort()
    for i in range(n):
        if s[i]%10 != 0:
            ans = total-s[i]
            break
    else:
        ans = 0
print(ans)
        

Measured memory_bytes: 3060
s = input()
n = len(s)

if s != s[::-1]:
    print('No')
    exit()

s1 = s[:(n - 1) // 2]
if s1 != s1[::-1]:
    print('No')
    exit()

s2 = s[(n + 3) // 2 - 1:]
if s2 != s2[::-1]:
    print('aaa')
    print('No')
    exit()

print('Yes')

Measured memory_bytes: 9116
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
//const int MAX=;

int main(){
	int a,b;
	cin>>a>>b;
	if(a<=b)cout<<a;
	else cout<<a-1;
}

Measured memory_bytes: 256
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353



A = list(map(int, sys.stdin.buffer.readline().split()))
s = A[0] + A[1] + A[2]
if s >= 22:
    print('bust')
else:
    print('win')



Measured memory_bytes: 23160
// B - Two Anagrams

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	string ans;

	if (s < t) ans = "Yes";
	else ans = "No";

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
const int dr[] = {+1, -1, +0, +0, +1, -1, +1, -1};
const int dc[] = {+0, +0, +1, -1, +1, -1, -1, +1};
const int kx[] = {+1, +2, -1, -2, +1, +2, -1, -2};
const int ky[] = {+2, +1, +2, +1, -2, -1, -2, -1};
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
inline void fastIO(){
  ios_base::sync_with_stdio(0);cin.tie(0);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__)
#else
#define debug(...) 47
#endif
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482
double mind(double a,double b){
  if(a<b){
    return a;
  }
  return b;
}
int main(){
  fastIO();
  cout<<fixed;
  cout<<setprecision(32);
  double a,b,h,m;
  cin>>a>>b>>h>>m;
  double xA=a*cos(pi/2 - ((pi*(h*60+m))/360));
  double yA=a*sin(pi/2 - ((pi*(h*60+m))/360));
  double xB=b*cos(pi/2 - (pi*m)/30);
  double yB=b*sin(pi/2 - (pi*m)/30);
  cout<<sqrt(pow(xA-xB,2)+pow(yA-yB,2))<<endl;
  return 0;
}


Measured memory_bytes: 4012
#include <bits/stdc++.h>
#define DEBUG false
#define coutd if(DEBUG) cout
#define debugf if(DEBUG) printf
#define ff first
#define ss second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define FOR(i, x) for(int i=0; i<x; i++)
#define FOR1(i, x) for(int i=1; i<=x; i++)
#define REAP(i, x) for(int i=x-1; i>=0; i--)
#define REAP1(i, x) for(int i=x; i>0; i--)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const double PI = acos(-1);
const double EPS = 1e-9;

ll solve(ll N){
	ll acc=0;
	ll i=1;
	while(i*i<=N){
		if(N%i==0){
			ll res=(N/i)-1;
			coutd << "res: "<< res << endl;
			if(res>i){
				acc+=res;
				coutd << "i: " << i << " res: " << res << endl;
			}
		}
		i++;
	}
	return acc;

}

int main(){
	ios_base::sync_with_stdio(0);
	ll n;
	cin >> n;
	cout << solve(n) << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc= new Scanner(System.in);
        int t = sc.nextInt();
        if (t < 1200) System.out.println("ABC");
        else if (t < 2800) System.out.println("ARC");
        else System.out.println("AGC");     
     }
}

Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <map>
using namespace std;
typedef long long LL;

LL n,flg = 0;
LL s[500005];
LL stk[2][500005] = {0};

LL chk(LL x){
	LL tp = 0;
	for(LL i = 1;i <= n;i ++){
		if(s[i - 1] >= s[i]){
			while(stk[0][tp] > s[i]) tp --;
			LL now = s[i];
			while(1){
				if(stk[0][tp] != now || stk[1][tp] < x - 1){
					if(stk[0][tp] != now){ stk[0][++ tp] = now; stk[1][tp] = 0; }
					stk[1][tp] ++; break;
				}
				else{ tp --; now --; }
				if(now <= 0) return 0;
			}
		}
	}
	return 1;
}

int main(){
	cin >> n;
	for(LL i = 1;i <= n;i ++) cin >> s[i];
	for(LL i = 1;i < n;i ++) if(s[i] >= s[i + 1]) flg = 1;
	if(!flg){ cout << 1 << '\n'; return 0; }
	
	LL l = 2,r = n,mid,ans;
	while(l <= r){
		mid = (l + r) >> 1;
		if(chk(mid)){
			ans = mid;
			r = mid - 1;
		}
		else l = mid + 1;
	}
	cout << ans << '\n';
	return 0;
}

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

const int N = 5e5 + 5;

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

    int a,b,c;
    cin>>a>>b>>c;

    if(a==b && a!=c) cout<<"Yes"<<endl;
    else if(a==c && a!=b) cout<<"Yes"<<endl;
    else if(b==c && a!=b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>

using namespace std;

const int MAXN=10005;
int a[MAXN];
int G[105][105];

int main()
{
    int h,w;
    while(scanf("%d%d",&h,&w)!=EOF)
    {
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;++i)
            scanf("%d",&a[i]);
        int cnt=1;
        for(int i=1;i<=h;++i)
        {
            if(i&1)
            {
                for(int j=1;j<=w;++j)
                {
                   if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                   else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }else
            {
                for(int j=w;j>=1;--j)
                {
                    if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=w;++j)
            {
                if(j!=w) printf("%d ",G[i][j]);
                else printf("%d\n",G[i][j]);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 384
HP=0
r=0
n=int(input())
d=list(map(int,input().split()))
for x in range(n):
    for y in range(n):
        HP=HP+d[x]*d[y]

for z in range(n):
    r+=d[z]*d[z]
    
print((HP-r)//2)
        

Measured memory_bytes: 3060
import math

def input_from_console():
    n, d = map(int, input().split())
    x_matrix = []
    for i in range(n):
        x = map(int, input().split())
        x_matrix.append(list(x))
    return n, d, x_matrix


def solve(n, d, x_matrix):
    result = 0
    for i in range(n):
        for j in range(n - i -1):
            distance = math.sqrt(sum([(p1 - p2) ** 2 for p1, p2 in zip(x_matrix[i], x_matrix[j + i + 1])]))
            if distance == int(distance):
                result += 1
    return result


def main():
    n, d, x_matrix = input_from_console()
    print(solve(n, d, x_matrix))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


Measured memory_bytes: 3064