akhauriyash/Code-Regression huggingface dataset:
def main():
    N = int(input())
    A = list(map(int, input().split()))

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

    A = list(enumerate(A))
    A.sort(key=lambda x: x[1])
    ans = 0
    for z in range(1, N+1):
        tmp = A.pop()
        i = tmp[0]+1
        a = tmp[1]
        for x in range(z+1):
            y = z - x
            if x == 0:
                dp[x][y] = max(dp[x][y-1]+a*abs(i-(N-y+1)), dp[x][y])
            elif y == 0:
                dp[x][y] = max(dp[x-1][y]+a*abs(i-x), dp[x][y])
            else:
                dp[x][y] = max(dp[x][y-1]+a*abs(i-(N-y+1)), dp[x][y], dp[x-1][y]+a*abs(i-x))
            ans = max(ans, dp[x][y])
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 120020
# include <bits/stdc++.h>
# define INF 1e9
using namespace std;

int main(){

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

  int ans = 0;
  while(true){
    bool flag = false;
    int zero = 0;
    for(int i = 0; i < n; i++){
      if(h[i] > 0){
        h[i] -= 1;
        if(!flag) flag = true;
      } else {
        zero++;
        if(flag){
          flag = false;
          ans++;
        }
      }
    }
    if(flag) ans++;
    if(zero == n) break;

  }
  cout << ans << endl;
}

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

using namespace std;

void Main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    vector<int> B(N, 0);
    for (int k = 0; k < K; ++k) {
        for (int i = 0; i < N; ++i) {
            B[max(0, i - A[i])] += 1;
            if (i + A[i] + 1 < N) {
                B[i + A[i] + 1] -= 1;
            }
        }
        for (int i = 1; i < N; ++i) {
            B[i] += B[i - 1];
        }

        bool horizon = true;
        for (int i = 0; i < N; ++i) {
            A[i] = B[i];
            B[i] = 0;
            if (A[i] != N) {
                horizon = false;
            }
        }
        if (horizon) {
            break;
        }
    }

    for (int i = 0; i < N; ++i) {
        if (i > 0) {
            cout << " ";
        }
        cout << A[i];
    }
    cout << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

def main():
    A,B,C = map(int, input().split())
    if A%2==0 or B%2==0 or C%2==0:
        print(0)
        return
    print((A*B*C)//max(A,B,C))

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;

#define PI acos(-1)
typedef long long ll;
#define INF 0x3f3f3f3f
int mod = 1000000007;
char num[55];
int main()
{
	//freopen("in.txt", "r", stdin);
	 int n;
	 while (~scanf("%s", num))
	 {
	 	if (num[0] == num[1] && num[1] == num[2])
	 		puts("Yes");
	 	else if (num[1] == num[2] && num[2] == num[3])
	 		puts("Yes");
	 	else
	 		puts("No");
	 }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
    #include <vector>
    #include <algorithm>
    #include <cmath>
    using namespace std;
     
    int main(){
        int n;
        cin >> n;
        vector<int> a(n+2);
        a[0] = 0;
        a[n+1] = 0;
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        int sum = 0;
        for(int i = 1; i < n+2; i++)
            sum += abs(a[i] - a[i-1]);
        for(int i = 1; i < n+1; i++){
            cout << sum + (abs(a[i+1] - a[i-1]) - (abs(a[i]-a[i-1])+abs(a[i]-a[i+1]))) << endl;
        }
    }

Measured memory_bytes: 1664
/* ****revpro**** */
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl	   '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii	    map<ll,ll>
using namespace std;

#define N  1000005
ll fact[N];
ll expo(ll base, ll exponent, ll mod) {								//return base^exponent modulo modulus
    ll ans = 1;
    while(exponent !=0 ) {
        if((exponent&1) == 1) {
            ans = ans*base ;
            ans = ans%mod;
        }
        base = base*base;
        base %= mod;
        exponent>>= 1;
    }
    return ans%mod;
}
ll add(ll x,ll y,ll mod) { x += y; if(x >= mod) x -= mod; return x;}
ll sub(ll x,ll y,ll mod) { x -= y; if(x < 0) x += mod; return x;}
ll mul(ll x,ll y,ll mod) { return (x * 1ll * y) % mod;}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		ll x,y;
		cin>>x>>y;
		if((x+y)%3) {
			cout<<0;
			return 0;
		}
		ll t=(x+y)/3;
		if((x<t)||(x>2*t)){
			cout<<0;
			return 0;
		}
		fact[0]=1;
		rep(i,1,N) fact[i]=mul(fact[i-1],i,hell);
		cout<<mul(mul(expo(fact[x-t],hell-2,hell),expo(fact[2*t-x],hell-2,hell),hell),fact[t],hell);
	}
	return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#include <math.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int main(){
  int n,d;
  cin >> n >> d;
  int range = 1 + 2*d;
  double ans = (double)n/range;
  ans = ceil(ans);
  printf("%d\n",(int)ans);
  return 0;
}

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

int main(){
  int n,w,h,sup[10][10],wt[10],ht[10],at;
	
	while(1){
		w=0;
		h=0;
		at=0;
		
		cin >> n;
		
		if(n==0) break;
		
		for(h=0; h<n; h++){

			wt[h] = 0;

			for(w=0; w<n; w++){
				if(h==0) ht[w]=0;

				sup[h][w] = 0;

				cin >> sup[h][w];
				
				wt[h] += sup[h][w];
				
				ht[w] += sup[h][w];
			}
		}
		
		for(h=0; h<=n; h++){
			for(w=0; w<=n; w++){
				if(h<n && w<n){
					printf("%5d",sup[h][w]);
					
					at += sup[h][w];
				}
				
				else if(w==n && h<n){
					printf("%5d\n",wt[h]);
				}
				
				else if(h==n && w<n){
					printf("%5d",ht[w]);
				}
				
				else{
					printf("%5d\n",at);
				}
			}
		}
		
	}
  
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
bool ok[3][3];

pair<int , int> appartient[200];
int main()
{
	for (int i = 0 ; i < 200 ; i++)
	{
		appartient[i] = {-1 , -1};
	}
	for (int i = 0 ; i < 3 ; i++)
	{
		for (int j = 0 ; j < 3 ; j++)
		{
			int a;
			cin >> a;
			appartient[a] = {i , j};
		}
	}
	int N;
	cin >> N;
	for (int i = 0 ; i < N ; i++)
	{
		int a;
		cin >> a;
		if  (appartient[a].first != -1)
		{
			ok[appartient[a].first][appartient[a].second]= true;
		}
	}
	for (int i = 0 ; i < 3 ; i++)
	{
		bool est = true;
		for (int j = 0 ; j  < 3 ; j++)
		{
			if (!ok[i][j]) est = false;
		}
		if (est)
		{
			cout<<"Yes"<<endl;
			exit(0);
		}
		est = true;
		for (int j = 0 ; j < 3 ; j++)
		{
			if (!ok[j][i]) est = false;
		}
		if (est)
		{
			cout<<"Yes"<<endl;
			exit(0);
		}
	}
	bool est = true;
	for (int i = 0 ; i < 3 ; i++)
	{
		if (!ok[i][i]) est = false;
	}
	if (est)
	{
		cout<<"Yes"<<endl;
		exit(0);
	}
	est = true;
	for (int i = 0 ; i < 3 ; i++)
	{
		if (!ok[i][2 - i]) est = false;
	}
	if (est)
	{
		cout<<"Yes"<<endl;
		exit(0);
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int N, x, a[100] = {}, c = 0;
    scanf("%d %d", &N, &x);
    for (int i = 0; i < N; i++) {
        scanf("%d", &a[i]);
    }
    
    for (int i = 0; i < N - 1; i++) {
        for (int j = N - 1; j > i; j--) {
            if(a[j - 1] > a[j]) {
                int t = a[j];
                a[j] = a[j - 1];
                a[j - 1] = t;
            }
        }
    }
    
    for (int i = 0; i < N; i++) {
        if(a[i] <= x) {
            c++;
            x -= a[i];
            if(i == N - 1 && x > 0) {
                c--;
            }
        } else {
            break;
        }
    }
    
    printf("%d", c);
    
    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#define LL long long
LL k;
double Cnt(LL i)
{
	LL t=i,cnt=0;
	while(t)
	{
		cnt+=t%10;
		t/=10;
	}
	return 1.0*i/cnt;
}
int main()
{
	scanf("%lld",&k);
	LL x=0,r=1;
	while(k--)
	{
		double x1=Cnt(x+r),x2=Cnt(x+r*10);
		while(1)
		{
			x1=Cnt(x+r),x2=Cnt(x+r*10);
			if(x1<=x2) break;
			r*=10;
		}
		x+=r;
		//printf("%lld ",r);
		printf("%lld\n",x);
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <functional>
typedef long long ll;

using namespace std;

class Edge
{
	public:
	int cost;
	int next;

	Edge(int n,int c)
	{
		next=n;
		cost=c;
	}
};

vector<Edge> g[50];
bool used[50];

int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		g[a].push_back(Edge(b,1));
		g[b].push_back(Edge(a,1));
	}

	for(int i=0;i<n;i++)
		cout<<g[i].size()<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int d,g;
  cin >> d >> g;
  vector<int> p(d), c(d);
  REP(i,d) cin >> p[i] >> c[i];
  int ans = 1e9;
  REP(bit, (1<<d)){
    int cnt = 0;
    int sum = 0;
    int ind;
    REP(i,d){
      if(bit & (1<<i)){
        cnt += p[i];
        sum += (i+1)*100*p[i] + c[i];
      }else{
        ind = i;
      }
    }
    
    if(sum<g){
      FOR(k,1,p[ind]){
        if(sum+(ind+1)*100*k>=g){
          sum += (ind+1)*100*k;
          cnt += k;
          break;
        }
      }
    }
    
	if(sum>=g) ans = min(ans, cnt);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define SZ(x) ((int)(x).size())
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const double pi=acos(-1);


 
int main() {
  long long H,W;
  cin >> H >> W;

  if (H==1 || W==1) {
  cout << 1 << endl;
  }
  else {
  cout << (H*W+1)/2 << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,l,k,s,t,d[100][100];

void ch(){
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      for(int k=0;k<n;k++)d[j][k]=min(d[j][k],d[j][i]+d[i][k]); 
}

int main(){
  while(cin>>n>>m>>l>>k>>s>>t,n){
    vector<int> v;
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)d[i][j]=(i==j?0:1e9);
    bool e[100]={};
    e[s]=e[t]=1;
    for(int i=0,x;i<l;i++)cin>>x,e[x]=1;
    for(int i=0,x,y,c;i<k;i++)cin>>x>>y>>c,d[x][y]=c,d[y][x]=c;
    ch();
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)
	if(!e[i]||!e[j]||d[i][j]>m)d[i][j]=1e9;
    ch();
    if(d[s][t]==1e9)cout<<"Help!"<<endl;
    else if(0||d[s][t]<m)cout<<d[s][t]<<endl;
    else cout<<d[s][t]*2-m<<endl;
  }
  return 0;
}


Measured memory_bytes: 3112
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int main () {
  int N,M;
int P[100000],Y[100000]; 
  vector<int> yd[100001];
scanf("%d%d",&N,&M); 
  rep(i,M)scanf("%d%d",&P[i],&Y[i]),yd[P[i]].push_back(Y[i]); 
  rep(i,N)sort(yd[i+1].begin(),yd[i+1].end()); 
  rep(i,M)printf("%012lld\n",ll(P[i])*1000000+int(lower_bound(yd[P[i]]. begin(),yd[P[i]].end(),Y[i])-yd[P[i]].begin())+1);
}

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

typedef long long int ll;
typedef vector<int> vi;            typedef vector<ll> vl;
typedef vector<vi> vvi;         typedef vector<vl> vvl;
typedef pair<int, int>     pii;    typedef pair<ll, ll> pll;
typedef vector<pii> vii;         typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define in insert
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
const ll INFL = 1e18;
const int INFI = 1e9;
#ifdef KARAN
    #include "../../trace.h"
#else
    #define trace(args...)
#endif

ll div_floor(const ll &a,const ll &b) { return a / b - (((a ^ b) < 0) and a % b);}
ll div_ceil(const ll &a,const ll &b) { return a / b + (((a ^ b) >= 0) and a % b);}
ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
    while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
    int n; cin>>n;
    n = n%10;
    if(n==2||n==4||n==5||n==7||n==9)
        cout<<"hon"<<endl;
    else if(n==0||n==1||n==6||n==8)
        cout<<"pon"<<endl;
    else
        cout<<"bon"<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifdef KARAN
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        freopen("err.txt", "w", stderr);
    #endif
    int t=1;
    while(t--)
        solve();
}

Measured memory_bytes: 3612
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
//#include <unordered_map>
//#include <unordered_set>
using namespace std;

typedef long long ll;
#define eps 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int dx4[5] = { 0,-1,0,1,0 };
const int dy4[5] = { 0,0,1,0,-1 };
const int dx8[9] = { 0,-1,0,1,0,1,1,-1,-1 };
const int dy8[9] = { 0,0,1,0,-1,1,-1,1,-1 };
const int maxn = 1e5 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }
void YES() { puts("YES"); exit(0); }
void Yes() { puts("Yes"); exit(0); }
void NO() { puts("NO"); exit(0); }
void No() { puts("No"); exit(0); }
void one() { puts("-1"); exit(0); }

struct no
{
	int id;
	int ai;
}node[maxn];

int n;
bool cmp(no a, no b)
{
	return a.ai < b.ai;
}
ll ai[maxn], res[maxn], sum[maxn];

void solve()
{
	sa(n);
	repp(i, 1, n)
	{
		//sa(ai[i]);
		scanf("%lld", &ai[i]);
	}
	sort(ai + 1, ai + n + 1);
	repp(i, 1, n)
	{
		sum[i] = sum[i - 1] + ai[i];
	}
	int cnt = 1;
	repp(i, 1, n)
	{
		ai[i] = sum[i];
		if (2*ai[i] >= ai[i + 1])
		{
			res[i] = cnt;
		}
		else
		{
			cnt++;
		}
	}
	int r = 0;
	repp(i, 1, n)
	{
		if (res[i] == res[n])r++;
	}
	printf("%d\n", r);
}

int main()
{

	solve();
	//system("pause");
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#pragma warning(disable:4996)
using namespace std;

int main()
{
	double a, b, t;
	cin >> a >> b >> t;
	t += 0.5;
	int count = 0;
	count = t / a;
	printf("%d", (int)count*(int)b);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
bool judge(int N,int p[],int pd[]){
	for (int i = 0; i < N; i++){
		if (p[i] != pd[i])return false;
	}
	return true;
}
int main(){
	int N;
	cin >> N;
	int p[50],pd[50];
	for (int i = 0; i < N; i++){
		cin >> p[i];
		pd[i] = p[i];
	}
	sort(pd,pd+N);
	for (int i = 0; i < N-1; i++){
		for (int k = i; k < N; k++){
				swap(p[i], p[k]);
			
			if (judge(N, p, pd)){
				cout << "YES" << endl;
				return 0;
			}
			else swap(p[i], p[k]);
		}
	}
	cout << "NO" << endl;
	return 0;			

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,a,b;
  ll x[100009];
  cin>>n>>a>>b;
  for(int i=0;i<n;i++){
    cin>>x[i];
  }

  ll d=0,idx;
  for(int i=0;i<n-1;i++){
    if(d<x[i+1]-x[i]){
      d=x[i+1]-x[i];
      idx=i;
    }
  }

  ll s=b;
  for(int i=0;i<n-1;i++){
    if(i==idx)continue;
    s+=min((x[i+1]-x[i])*a,b);
  }

  ll t=0;
  for(int i=0;i<n-1;i++){
    t+=min((x[i+1]-x[i])*a,b);
  }

  cout<<min(s,t)<<endl;

  return(0);
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int a[200010], A[200010];
int main()
{
	int N;
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> a[i];
	int ans = 0;
	for (int i = N; i > 0; i--) {
		int num = 0;
		int j = 2;
		while (i * j <= N) {
			num = (num + A[i * j]) % 2;
			j++;
		}
		if (a[i] != num) A[i] = 1;
		if (A[i] == 1) ans++;
	}
	cout << ans << endl;
	for (int i = 1; i <= N; i++) {
		if (A[i] == 1) cout << i << " ";
	}
	cout << endl;
}

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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    if (K == 0) {
        cout << N * N << endl;
        return 0;
    }
    FOR(i, K + 1, N) {
        ans += (N / i) * (i - K);
        ans += max((ll) 0, N % i - K + 1);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	H, W := ReadInt(), ReadInt()
	grid := make([]string, H)
	for i := 0; i < H; i++ {
		grid[i] = ReadString()
	}

	hs := make(map[int]bool)
	for h := 0; h < H; h++ {
		containsBlack := false
		for w := 0; w < W; w++ {
			if grid[h][w] == '#' {
				containsBlack = true
				break
			}
		}
		if containsBlack {
			hs[h] = true
		}
	}

	ws := make(map[int]bool)
	for w := 0; w < W; w++ {
		containsBlack := false
		for h := 0; h < H; h++ {
			if grid[h][w] == '#' {
				containsBlack = true
				break
			}
		}
		if containsBlack {
			ws[w] = true
		}
	}

	for h := 0; h < H; h++ {
		if !hs[h] {
			continue
		}
		for w := 0; w < W; w++ {
			if !ws[w] {
				continue
			}
			fmt.Printf("%c", grid[h][w])
		}
		fmt.Println("")
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll h,w;
    cin >> h >> w;//h>=Wとしてよい
    if(w>h){
        swap(h,w);
    }//hが長辺

    if((h*w)%3 == 0){
        cout << 0 << endl;
    }else{
        ll ans1=10000000002,ans2=10000000002,ans3=10000000002;
        
        for(ll i=h/3;i <= (h+3)/3;i++){
            for(ll j=2*h/3;j <= (2*h+3)/3;j++){
                ans1= min(ans1,max(w*i,max(w*(j-i),w*(h-j)))-min(w*i,min(w*(j-i),w*(h-j))));
            }
        }//長辺側から３分割する場合

        for(ll i=h/3;i <= (h+3)/3;i++){
            for(ll j=w/2;j <= (2+w)/2 ;j++){
                ans2=min(ans2,max(w*i,max((h-i)*(w-j),(h-i)*j))-min(w*i,min((h-i)*(w-j),(h-i)*j)));
            }   
        }//まず長辺側で切り、次に短辺側で切る

        swap(h,w); 

        for(ll i=h/3;i <= (h+3)/3;i++){
            for(ll j=w/2;j <= (w+2)/2;j++){
                ans3=min(ans3,max(w*i,max((h-i)*(w-j),(h-i)*j))-min(w*i,min((h-i)*(w-j),(h-i)*j)));
            }   
        }//まず短辺側で切り、次に長辺側で切る

        cout << min(ans1,min(ans2,ans3)) << endl;
    }
}

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()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int H1,M1,H2,M2,K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    H1*=60;
    H2*=60;
    int ans = H2+M2-(H1+M1)-K;

    cout << ans << endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
  ll n,m;cin >> n >> m;
  priority_queue<ll> que;
  for(ll i=0;i<n;++i) {
    ll a;cin >> a;
    que.push(a);
  }
  while(m>0){
    auto tmp = que.top();
    que.pop();
    tmp /= 2LL;
    --m;
    que.push(tmp);
  }
  ll out = 0;
  while(!que.empty()){
    out += que.top();
    que.pop();
  }
  cout << out << endl;
  return 0;
}

Measured memory_bytes: 1400
#define _GLIBCXX_DEBUG
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <random>
#include <utility>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <bitset>
#include <sstream>

using namespace std;

#define REP(i, x) for (int i = 0; i < (x); i++)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define MOD 1'000'000'007
int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

ll ku2(int n)
{
    if (n == 1)
        return 2;
    if (n % 2 == 1)
    {
        return 2 * ku2(n - 1);
    }
    else
    {
        return (ll)powl(ku2(n / 2), 2) % MOD;
    }
}

// 逆元の存在条件(aとmが互いに素)に注意
ll minv(ll a, ll m)
{
    ll b = m, u = 1, v = 0;
    while (b)
    {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

int main(int argc, const char *argv[])
{
    int n, a, b;
    cin >> n >> a >> b;

    ll all = ku2(n) - 1;
    int k = max(a, b) + 2;
    vector<ll> nl(k);
    REP(i, k)
    {
        if (i == 0)
        {
            nl[i] = 1;
        }
        else if (i == 1)
        {
            nl[i] = n;
        }
        else
        {
            ll ii = minv(i, MOD);
            nl.at(i) = nl[i - 1] * (n - i + 1) % MOD * ii % MOD;
        }
    }
    ll ans = (all - nl.at(a)) % MOD;
    ans = (ans - nl.at(b)) % MOD;
    if (ans < 0)
        ans += MOD;

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


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static long[] ReadLongArray()
    {
	return ReadLine().Split().Select(x => long.Parse(x)).ToArray();
    }

    public static long Gcd(long a, long b)
    {
	if (a < b){ return Gcd(b, a); }
	while (b != 0)
	{
	    var r = a % b;
	    a = b;
	    b = r;
	}
	return a;
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadLongArray();
	long a = tmp[0], b = tmp[1];
	long n = Gcd(a, b);

	var ls = new List<long>();
	for (long i = 1; i * i <= n; i++)
	{
	    if (n % i == 0) 
	    {
		ls.Add(i);
		if (i*i != n) ls.Add(n/i);
	    }
	}

	long[] d = ls.ToArray();
	Array.Sort(d);

	int ans = 1;
	int S = d.Length;
	for (int i = 1; i < S; i++) // skip 1
	{
	    long x = d[i];
	    if (x < 0) continue;

	    ans++;

	    for (int j = i+1; j < S; j++)
	    {
		long y = d[j];
		if (y > 0 && y%x == 0) d[j] = -1;
	    }
	}
	
	WriteLine(ans);
    }
}


Measured memory_bytes: 13472
fun main(args: Array<String>) {
    val init = 10000000000L
    val (N, W) = readLine()!!.split(" "). map { it.toInt() }
    var dp = LongArray(100001) {init}
    dp[0] = 0
    for(i in 0 until N) {
        val dp2 = dp.clone()
        val (w, v) = readLine()!!.split(" "). map { it.toLong() }
        val v2 = v.toInt()
        for (j in 0 .. 100000) {
            if (dp[j] != init) dp2[j + v2] = Math.min(dp[j + v2], dp[j] + w)
        }
        dp = dp2
    }
    for (i in 100000 downTo 0) {
        if (dp[i] <= W) {
            println("$i")
            return
        }
    }
}

Measured memory_bytes: 67544
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int L = Integer.parseInt(sc.next());

		int ans = 0;
//		(N + L -1) < 0ならすべて負の値→最大の値
//		L > 0 ならすべて正の値→最小の値
		if((N+L-1) < 0) {//all number minus
//			数列的に考えたい → O(1)のはず
			ans = (L + (N  + L - 1)) * N / 2 - (N  + L - 1);
		}else if(L > 0) {//all number plus
			ans = (L + (N + L - 1)) * N / 2 - L;
		}else {
			ans = (L + (N + L - 1)) * N / 2;
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 35560
// At Corder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
	int a;
	int b;
	cin >> a;
	cin >> b;
	int c=6-a-b;
		
		cout << c << endl;
	return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

ll gcd(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (ll r = a % b)
		a = b, b = r;
	return b;
}

ll combi(ll n, ll k)
{
	if (k >= n || k <= 0)
		return 1;
	ll r = 1;
	for (ll i = 1; i <= k; i++, n--)
		r *= n, r /= i;
	return r;
}

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b)
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

int main()
{
	int h, a;
	cin >> h >> a;
	int r = h / a;
	if (h %a != 0)
		r++;
	printf("%d", r);

	return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
double a[200005];
int n, k;
double ans;
int main() 
{
	cin >> n >> k;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
		a[i] = (1 + a[i]) / 2.0;
	}
	for(int i = 0; i < k; i++)
		ans += a[i];
	double x = ans;
	for(int i = k;i < n; i++)
	{
		x = x + a[i] - a[i - k];
		ans = max(x,ans);
	}
	printf("%0.10lf\n", ans);
	return 0;
	
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fast_io                                                                \
    ios::sync_with_stdio(false);                                               \
    cin.tie(0)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf = 0x3f3f3f3f;
const int N = (int)1e3 + 5;
const int M = (int)1e5 + 5;
const int mod = (int)1e9 + 7;
const double esp = 1e-8;
int T;
//------------------------------
int a[N][2];
int main() {
    fast_io;
    int n;
    cin >> n;
    int flag = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i][0];
        cin >> a[i][1];
        if (flag != 3) {
            if (a[i][0] == a[i][1])
                ++flag;
            else
                flag = 0;
        }
    }
    if (flag == 3) {
        cout << "Yes" << endl;
    } else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() { 
    int n;
    cin >> n;
    vector<int> vt(n + 1, 0);
    int s = 0;
    for (int i = 1; i <= n; i++) {
        cin >> vt[i];
        s += vt[i];
    }
    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
        int p, x;
        cin >> p >> x;
        cout << s - vt[p] + x << endl;
    }
}




Measured memory_bytes: 3604
#include <iostream>

using namespace std;

int main(void) {
  int N, i;
  cin >> N;
  for(i=1;i<10;i++) {
    if (N % i == 0 && N / i < 10) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define YES 1
#define NO 0

int check(int,int, int*);

int solve(int,int,int,int*);

int main(){
  int n,i=0,q,YorN;

  scanf("%d",&n);

  int A[n];

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&q);

  int M[q];

  for(i=0;i<q;i++){
    scanf("%d",&M[i]);
  }

  for(i=0;i<q;i++){
    YorN=check(M[i],n,A);

    if(YorN==YES) printf("yes\n");
    else if(YorN==NO) printf("no\n");
  }
  
  return 0; 
}

int check(int m,int n,int *A){
  int i=0,res=-1;

  res=solve(i,m,n,A);

  return res;

}

int solve(int i,int m,int n,int *A){
  int res=-1;
  if(m==0) return YES;
  
  if(i>=n) return NO;
  
  if(res!=YES)res=solve(i+1,m,n,A);
  
  if(res!=YES)res=solve(i+1,m-A[i],n,A);

  return res;
}



Measured memory_bytes: 2052
#include<bits/stdc++.h>
#define fo(i, a, b) for (Re int i = (a); i <= (b); ++i)
#define fd(i, a, b) for (Re int i = (a); i >= (b); --i)
#define edge(i, u) for (Re int i = head[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define Re register
#define pb push_back
#define F first
#define S second
#define ll long long
#define lowbit(x) (x & -x)
#define N 105
int n, a, b;
int main ()
{
    scanf("%d %d %d", &n, &a, &b);
    printf("%d %d", std::min(a, b), std::max(a + b - n, 0));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[1000005];
int main(){
	scanf("%s",s+1);int n=strlen(s+1);
	if (s[n]=='1'){printf("-1");return 0;}
	for (int i=1;i<n;i++) if (s[i]!=s[n-i]){printf("-1");return 0;}
	if (s[1]=='0'){printf("-1");return 0;}
	int last=1;
	for (int i=2;i<=n;i++){
		if (s[i]=='1'){
			for (int j=last;j<i;j++) printf("%d %d\n",j,i);
			last=i;
		}
	}
	for (int j=last;j<n;j++) printf("%d %d\n",j,n);
}

Measured memory_bytes: 1536
main = interact $ unlines . map (show . dirichlet . map read . words) . takeWhile (/= "0 0 0") . lines

dirichlet [a,d,n] = (intersect' (iterate (+d) a) primes) !! (n-1)

intersect' xxs@(x:xs) yys@(y:ys)
 | x < y = intersect' xs yys
 | x > y = intersect' xxs ys
 | otherwise = x : intersect' xs ys

primes = 2:3:[x | i<-[1..], j<-[-1,1], let x = 6*i+j, isPrime x]
 where isPrime n = null [i | i<-takeWhile (\x -> x*x <= n) primes, rem n i == 0]

Measured memory_bytes: 10448
#include <stdio.h>
#define MAX 5000000

int H;
int A[MAX+1];

void swap(int *x,int *y){
  int temp;
  temp = *x;
  *x = *y;
  *y = temp;
}

void maxHeapify(int i){
  int l,r,largest;
  int temp;
  l = 2 * i;
  r = 2 * i + 1;

  if(l <= H && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= H && A[r] > A[largest]) largest = r;

  if(largest != i){
    swap(&A[i],&A[largest]);
    maxHeapify(largest);
  }
}



int main(){
  int i;

  scanf("%d",&H);
  for(i=1 ; i<=H ; i++) scanf("%d",&A[i]);
  for(i=H/2 ; i>=1 ; i--) maxHeapify(i);
  for(i=1 ; i<=H ; i++) printf(" %d",A[i]);
  printf("\n");

  return 0;
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define 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};


int main(){
    string s;
    cin >> s;
    int ans = 0;
    int n = s.size();
    rep(i, n) {
        if (i==0) continue;
        if (s[i]!=s[i-1]) ans++;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3692
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int t[110];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",t+i);
	int b;scanf("%d",&b);
	for(int i=0;i<b;i++){
		int p,q;scanf("%d%d",&p,&q);
		p--;
		int ret=0;
		for(int j=0;j<a;j++){
			if(p==j)ret+=q;
			else ret+=t[j];
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int a,n;
int main()
{
	cin>>n>>a;
	n %= 500;
	if(a>=n)
	{
		cout<<"Yes";
		return 0;
	}
	if(a<n)
	{
		cout<<"No";
		return 0;
	}
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        // int[] a = new int[3];
        // int five = 0;
        // int seven = 0;

        // for(int i = 0; i < a.length; i++){
        //     // System.out.println(i + "文字目を入力してください");
        //     a[i] = sc.nextInt();
        // }
        // for(int i = 0; i < a.length; i++){
        //     if(a[i] == 5){
        //         five++;
        //     } else if(a[i] == 7){
        //         seven++;
        //     }
        // }
        // if(five == 2 && seven == 1){
        //     System.out.println("YES");
        // }else{
        //     System.out.println("NO");
        // }
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int five = 0;
        int seven = 0;

        if(a == 5){
            five++;
        }else if(a == 7){
            seven++;
        }
        if(b == 5){
            five++;
        }else if(b == 7){
            seven++;
        }
        if(c == 5){
            five++;
        }else if(c == 7){
            seven++;
        }
        if(five == 2&&seven == 1){
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 20564
#include <bits/stdc++.h>
#define ll long long
#define fr(i,n) for(ll i=0;i<n;i++)
using namespace std;
const ll mod=1e6+7;


int main() {
ll n,m,g,ans=1;
cin>>n>>m;
vector<bool> prime(mod, true);

prime[0]=false;prime[1]=false;
g=__gcd(n,m);
for(ll i=2;i<mod;i++){
    if(prime[i]==false)continue;
    for(ll j=i*2;j<mod;j+=i)
    prime[j]=false;
    if(g%i)continue;
    while(g%i==0)g/=i;
    ans++;

    }
    if(g!=1)ans++;
cout<<ans;
}


Measured memory_bytes: 3736
// Copyright 2020 yaito3014
#include <bits/stdc++.h>

int main() {
  using namespace std;
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<int> H(N);
  for (auto& e : H)cin >> e;
  vector<bool> ans(N, true);
  for (int i = 0; i < M; ++i) {
    int A, B;
    cin >> A >> B, --A, --B;
    ans[A] = ans[A] && H[A] > H[B];
    ans[B] = ans[B] && H[B] > H[A];
  }
  cout << count(cbegin(ans), cend(ans), true);
}


Measured memory_bytes: 3724
import sys


def decrypt(c, i):
    """ ????????¶????????? """
    if c.isalpha():
        t = ord(c) - i
        if t < ord('a'):
            t += 26
        return chr(t)
    else:
        return c


if __name__ == '__main__':
    # ??????????????\???
    for line in sys.stdin:

        # ?????????????????????
        found = ''  # ?????????????????????
        for i in range(0, 26):
            decrypted = ''.join([decrypt(x, i) for x in line.strip()])
            # print(decrypted)
            if ' the ' in decrypted or ' this ' in decrypted or ' that ' in decrypted or \
                    decrypted.startswith('the ') or decrypted.startswith('this ') or decrypted.startswith('that '):
                found = decrypted
                break

        # ???????????????
        if found:
            print(found)

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

using namespace std;

int main() {
    int A,B;
    bool C = false;
    cin >> A >> B;

    for (double i = 1;i < 1001;i++) {
        if (floor(i * 0.08) == A && floor(i * 0.1) == B) {
            cout << floor(i) << endl;
            C = true;
            break;
        }
    }
    if (!C) {
        cout << -1 << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 2000000
#define INFTY 10000000

int H,A[MAX+1];

void maxHeapify(int i){
  int l,r,largest,tmp;
  l=2*i;
  r=2*i+1;

  if(l<=H && A[l]>A[i]) largest = l;
  else largest = i;
  if( r<= H && A[r]>A[largest]) largest = r;
  if( largest!=i ){
    tmp=A[i];
    A[i]=A[largest];
    A[largest]=tmp;
    maxHeapify(largest);
  }
}

int extract(){
  int maxv;
  if(H<1) return -INFTY;
  maxv=A[1];
  A[1]=A[H--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key){
  int tmp;
  if(key<A[i]) return;
  A[i] = key;
  while(i>1 && A[i/2] < A[i]){
    tmp=A[i];
    A[i]=A[i/2];
    A[i/2]=tmp;
    i=i/2;
  }
}

void insert(int key){
  H++;
  A[H]=-INFTY;
  increaseKey(H,key);
}

int main(){
  int key;
  char com[10];

  while(1){
    scanf("%s",com);
    if(com[0]=='e' && com[1]=='n') break;
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
    }else{
      printf("%d\n",extract());
    }
  }

  return 0;
}



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

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

int N;
string s;

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

    cin >> N;
    cin >> s;

    if (N & 1)
    {
        cout << "No\n";
    }
    else
    {
        bool ans = true;
        for (int i = 0; i < N / 2 && ans; ++i)
        {
            if (s[i] != s[i + N/2])
            {
                ans = false;
            }
        }
        if (ans) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}



Measured memory_bytes: 256
function Main(input: string):void {
    const [A, B] = input.split(' ').map((num:string) => parseInt(num));
    if ((A & 1 * B & 1) === 1) { // both A and B are odd number
        console.log('Yes');
    } else {
        console.log('No');
    }
}

import * as fs from 'fs';
Main(fs.readFileSync("/dev/stdin", "utf8"));


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



int main() {
  int K; cin >> K;
  int ans = K/2 * (K - K/2);
  cout << ans << endl;


	return 0;
}



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

int main() {
  int h , w;
  cin >> h >> w;
  for (int i = 0; i < w + 2; i++) {
    cout << "#";
  }
  cout << endl;
  for (int i = 0; i < h; i++) {
    string a;
    cin >> a;
    cout << "#" + a + "#" << endl;
  }
  for (int i = 0; i < w + 2; i++) {
    cout << "#";
  }
  cout << endl;
}


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

//#define int long long
//typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif



signed main() {
    int n, m, d;
    cin >> n >> m >> d;

    double ans;
    if(d==0)
     ans = (double)1.0*(n-d)/n/n*(m-1);
    else
        ans = (double)2.0*(n-d)/n/n*(m-1);

    cout << setprecision(15) << ans << endl;

}



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

int main() {
  int a,b,c;
  cin >> a >> b;
  
  c = a*b;
  
  if (c%2 == 0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H.at(i);
  sort(H.begin(), H.end());
  int ans = 1000000000;
  for (int i = 0; i < N-K+1; i++) {
    ans = min(ans, H.at(i+K-1) - H.at(i));
  }
  cout << ans << endl;
}

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

bool solve() {
  int n, m; cin >> n >> m;
  vector<set<int>> g(n);
  while(m--) {
    int u, v; cin >> u >> v; u--, v--;
    g[u].insert(v);
    g[v].insert(u);
  }
  for (int i = 1; i < n-1; i++) {
    if (g[0].count(i) && g[i].count(n-1)) return true;
  }
  return false;
}

int main() {
  if (solve()) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 28416
#include<iostream>
#include<string>
#include<cstring>
#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;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int main(){
  ll N; cin >> N; ll ans = 0;
  for(ll i=1; i*i<=N; i++){
    if((N-i)%i==0 && (N-i)/i>i) ans+=(N-i)/i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
a, b, c = map(int, input().split())

l = []

s = 0
s += abs(b - a)
s += abs(c - b)
l.append(s)

s = 0
s += abs(c - a)
s += abs(b - c)
l.append(s)

s = 0
s += abs(a - b)
s += abs(c - a)
l.append(s)

s = 0
s += abs(c - b)
s += abs(a - c)
l.append(s)

s = 0
s += abs(a - c)
s += abs(b - a)
l.append(s)

s = 0
s += abs(b - c)
s += abs(a - b)
l.append(s)

print(min(l))

Measured memory_bytes: 9232
import java.util.Scanner;

public class Main{
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int intTate = sc.nextInt();
		int intYoko = sc.nextInt();

		//??¢???????±???????
		int intArea = intTate * intYoko;

		//??¨?????????????±???????
		int intSyuu = (intTate + intYoko) * 2;

		System.out.println(intArea + " " + intSyuu);
	}
}

Measured memory_bytes: 25988
#include<stdio.h>

int main(){
	int W,H;
	int x,y,r;

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if(x>=r){
	if(x<=W-r){
		if(y>=r){
			if(y<=H-r){
				printf("Yes\n");
			}else{
				printf("No\n");
			}
		}else{
			printf("No\n");
		}
	}else{
		printf("No\n");
	}
}else{
	printf("No\n");
}

return 0;
}


Measured memory_bytes: 2092