akhauriyash/Code-Regression huggingface dataset:
//#include<iostream>
//using namespace std;
#include<stdio.h>
#include<math.h>
int main()
{
	int a, b, c, d;

	scanf("%d %d %d %d", &a, &b, &c, &d);

	if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <=d))
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}

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

int main()
{
  int n, count;
  bool no_good_result = true;
  int cx, cy, h;
  std::cin >> n;
  int (*coorinates)[3] = new int[n][3];
  for (int i = 0; i < n; i += 1)
    std::cin >> coorinates[i][0] >> coorinates[i][1] >> coorinates[i][2];

  for (cx = 0; cx <= 100 && no_good_result; cx += 1)
    for (cy = 0; cy <= 100 && no_good_result; cy += 1)
    {
      bool all_zero = true, next_coordinate = false;
      for (count = 0; count < n; count += 1)
        if (coorinates[count][2] > 0)
        {
          h = std::abs(cx - coorinates[count][0]) + std::abs(cy - coorinates[count][1]) + coorinates[count][2];
          all_zero = false;
          break;
        }
      if (all_zero)
      {

      }
      for (count = 0; count < n; count += 1)
        if (coorinates[count][2] != std::max(0, h - std::abs(cx - coorinates[count][0]) - std::abs(cy - coorinates[count][1])))
        {
          next_coordinate = true;
          break;
        }
      if (!next_coordinate)
        no_good_result = false;
    }

  std::cout << (cx - 1) << " " << (cy - 1) << " " << h;
  delete[] coorinates;
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>

using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define pw(n) (1ll << (n))

#define equal equalll
#define less lesss
const int N = 5e5 + 10;
const long long INF = 1e9 + 19;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int M = 1000;


int n;
int qtd[N];
const ll mod = 1e9+7;

int main() {
    memset(qtd, 0, sizeof qtd);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int pi = i;
        int val = 2;
        while(pi > 1) {
            int cont = 0;
            while(pi % val == 0) {
                pi/=val;cont++;
            }
            qtd[val] += cont;
            val++;
        }
    }   
    long long ans = 1; 
    for (int i = 1; i < 1000; i++) {
        ans *= (qtd[i]+1);
        ans%=mod;
    }
    cout << ans << endl;  
}




















































Measured memory_bytes: 2176
n, q = map(int, input().split())
s = input()
acc = [0 for _ in range(n)]
for i in range(1, n):
    acc[i] = acc[i - 1]
    if s[i - 1:i + 1] == "AC":
        acc[i] += 1
for _ in range(q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    ans = acc[r] - acc[l]
    print(ans)

Measured memory_bytes: 6160
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  vector<int> vec = {N, N-1};
  for(int i = 2; i*i <= N; i++){
    if(N%i == 0){
      vec.emplace_back(i);
      vec.emplace_back(N/i);
      vec.emplace_back(i-1);
      vec.emplace_back(N/i-1);
    }
  }
  N--;
  for(int i = 2; i*i <= N; i++){
    if(N%i == 0){
      vec.emplace_back(i);
      vec.emplace_back(N/i);
      vec.emplace_back(i-1);
      vec.emplace_back(N/i-1);
    }
  }
  N++;

  sort(ALL(vec));
  vec.resize(unique(ALL(vec))-vec.begin());

  int ans = 0;
  for(auto i : vec){
    if(i == 1) continue;
    int now = N;
    int cur = i;
    while(1){
      if(now%cur == 0) now /= cur;
      else{
        int a = (now+cur-1)/cur*cur-cur;
        now -= a;
      }
      if(now == 1) ans++;
      if(now < cur) break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define xh1(a,b) for(int i=a;i<b;i++)
#define xh2(a,b) for(int j=a;j<b;j++)
#define stlbl(a) for(it=a.begin();it!=a.end();it++)
#define dzkt int T;cin>>T;while(T--)
#define mst(a,i) memset(a,i,sizeof(a))
#define iosks std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=2005,inf=1e9+10,mod=1e9+7;
ll pow2(ll a,ll b) {ll s=1; while(b) {if(b&1) s=(s*a); a=(a*a); b/=2; } return s;}
int gcd(int a,int b) {return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) {return a/gcd(a,b)*b; }
ll prime(ll x) {for(ll i=2;i<=sqrt(x+0.5);i++) if(x%i==0) return 0; return 1; }

char ch[N];
vector<ll> vec;

int main()
{
    iosks;
    char c;
    cin>>c;
    if(c>='a'&&c<='z') cout<<'a'<<endl;
    else cout<<'A'<<endl;
    return 0;
}

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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    string s; cin >> s;
	int n = s.length();
	bool a = 1;
	for(int i=0, j=n-1; i<=j; i++, j--) a = a && s[i] == s[j];
	for(int i=0, j=(n-1)/2-1; i<=j; i++, j--) a = a && s[i] == s[j];
	for(int i=(n+3)/2-1, j=n-1; i<=j; i++, j--) a = a && s[i] == s[j];
	if(a) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
    int N; ll L; scanf("%d %lld",&N,&L);
    vec A(N);
    rep(i,N) scanf("%lld",&A[i]);
    int k=-1;ll M=0;
    rep(i,N-1){
        if(A[i]+A[i+1]>M){
            M=A[i]+A[i+1];
            k=i;
        }
    }
    if(M<L){
        cout<<"Impossible"<<endl;
        return 0;
    }
    cout<<"Possible"<<endl;
    rep(i,k) printf("%d\n",i+1);
    rep(i,N-k-2) printf("%d\n",N-i-1);
    printf("%d\n",k+1);
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define ll long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int N=405;

int a,b;

int main(){
	//fri("in.txt");
	//fro("out.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>a>>b;
	if(a>=10 || b>=10)cout<<-1<<endl;
	else cout<<a*b<<endl;


return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define dbg(x) { cerr<<"> "<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const double eps = 0.0000001;
const double PI = acos(-1.0);
const int MOD = 1e9+7;
const int N  = 1e5+5;

int a[N], dp[N];

signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif  
    IOS;

    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    	cin >> a[i];
    for (int i = 2; i <= n; i++) {
    	dp[i] = inf;
    	for (int j = 1; j <= k; j++) {
    		if (i - j >= 1) {
    			dp[i] = min (dp[i], dp[i-j]+abs(a[i]-a[i-j]));
    		}
    	}
    }
    cout << dp[n];
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;
int main(){
  int a,b;
  cin>>a>>b;
  cout<<a*b;



}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdlib>
using namespace std;

int main()
{
  string str;
  getline(cin, str);
  for (int i = 0; i < str.size(); i++){
    if ('a' <= str[i] && str[i] <= 'z'){
      str[i] += ('A' - 'a');
    }
  }
  cout << str << endl;
  return (0);
}

Measured memory_bytes: 1172
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#include<cstdlib>
#include<cctype>
#include<ctime>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 1e5 + 5;
const ll maxm = 1e3 + 5;
template<class T>
inline T qread(T &IEE){
	register T x = 0, f = 1;
	register char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-'){
			f = -f;
		}
		ch = getchar();
	}
	while(isdigit(ch)){
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return IEE = x * f;
}
template<class T>
inline void qwrite(T a){
	if(!a){
		putchar('0');
		return ;
	}
 	if(a < 0){
		putchar('-');
		a = -a;
	}
	if(a > 9) qwrite(a / 10);
	putchar(a % 10 + 48);
	return ;
}
template<class T>
inline T ab(T a){
	return (a > 0) ? a : -a;
}
template<class T>
inline void swa(T &a, T &b){
	a ^= b ^= a ^= b;
	return ;
}
ll n;
ll f[maxn];
int main(){
//	freopen("1.in", "r", stdin);
//	freopen("1.out", "w", stdout);
	cin >> n;
	f[0] = 2;
	f[1] = 1;
	for(int i = 2;i <= n;i++){
		f[i] = f[i - 1] + f[i - 2];
	}
	cout << f[n] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 100005;
int A[N], B[N], C[N];
LL cnt[N];

int main() {
  int n;
  S(n);
  rep(i,0,n) S(A[i]); sort(A, A + n);
  rep(i,0,n) S(B[i]); sort(B, B + n);
  rep(i,0,n) S(C[i]); sort(C, C + n);

  int j = 0;
  rep(i,0,n) {
    while(j < n && A[j] < B[i]) j++;
    cnt[i] = j;
    if(i) cnt[i] += cnt[i-1];
  }
  LL ans = 0;
  j = 0;
  rep(i,0,n) {
    while(j < n && B[j] < C[i]) j++;
    if(j) ans += cnt[j - 1];
  }
  cout << ans << "\n";
  return 0;
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

int ceil_div(int a, int b) {
  return (a + b - 1) / b;
}

void MAIN() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  int sv = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1) sv = i;
  }
  // x * (k - 1) >= i
  int x = ceil_div(sv, k - 1);
  int ans = x;
  x *= k - 1;
  ans += ceil_div((n - 1) - x, k - 1);
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3900
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) for(int i = 0; i < (a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'
const int MOD = 1e9 + 7;

int dp[1005][1005];
char g[1005][1005];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int h, w;
	cin >> h >> w;
	repn(i, 1, h + 1) repn(j, 1, w + 1){
		cin >> g[i][j];
	}
	dp[1][1] = 1;
	repn(i, 1, h + 1) repn(j, 1, w + 1){
		if(g[i][j] == '#'){
			dp[i][j] = 0;
			continue;
		}
		if((i - 1) && g[i - 1][j] == '.') dp[i][j] = (dp[i][j] + dp[i - 1][j]) % MOD;
		if((j - 1) && g[i][j - 1] == '.') dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
	}
	cout << dp[h][w] << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 5120
#include<stdio.h>
        #include<string.h>
         
        int main(void)
        {
           char a[11], b[11], c[11];
         
           scanf("%s%s%s" , a, b, c);
           
           if ((a[strlen(a) - 1] == b[0])&&(b[strlen(b) - 1] == c[0]))
           printf ("YES\n");
           else printf ("NO\n");
           return 0;
        }

Measured memory_bytes: 128
a,b,k = map(int,input().split())
if k >= (b-a+1)/2:
    for i in range(a,b+1):
        print(i)
        
else:
    for j in range(a,a+k):
        print(j)
    for l in range(b-k+1,b+1):
        print(l)
            
        

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

#define LL long long
#define INF 2147483647

using namespace std;

int main(){
	int n,m,k;
	cin>>n>>m>>k;
	bool find=false;
	for (int r=0;r<=n;r++){
		for (int j=0;j<=m;j++){
			int p=r*j;
			int q=r*m+j*n-p*2;
			//cout<<r<<" "<<j<<" "<<p<<" "<<q<<endl;
			if (q==k) {
				find=true;
				break;
			}
		}
	}
	if (find) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const int SIZE = 300;
const int N = 1000000;
int p[SIZE+1];
int dp1[N+1], dp2[N+1];

void make_pollock (void )
{
	for (int i = 0; i <= SIZE; i++ ){
		ll ans = (ll)i*(i+1LL)*(i+2LL)/6LL;
		p[i] = (int)ans;
	} // end for
}

void make_dp (void )
{
	dp1[0] = 0;
	for (int i = 1; i <= SIZE; i++ ){
		int m = p[i];
		for (int j = m; j <= N; j++ ){
			if (dp1[j] > dp1[j - m] + 1 ){
				dp1[j] = dp1[j - m] + 1;
			} // end if
		} // end for
	} // end for

	dp2[0] = 0;
	for (int i = 1; i <= SIZE; i++ ){
		if (p[i] % 2 == 0 ) continue;
		int m = p[i];
		for (int j = m; j <= N; j++ ){
			if (dp2[j] > dp2[j - m] + 1 ){
				dp2[j] = dp2[j - m] + 1;
			} // end if
		} // end for
	} // end for	
}
	
int main()
{
	memset (p, 0, sizeof (p ) );
	fill (dp1, dp1+N+1, INF );
	fill (dp2, dp2+N+1, INF );

	make_pollock();
	make_dp ();

	int n;
	while (cin >> n && n ){
		cout << dp1[n] << ' ' << dp2[n] << endl;
	} // end while
	
	return 0;
}

Measured memory_bytes: 8564
//ysh_gpta
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
typedef long long ll;
#define vb vector<bool>
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define mkp make_pair
#define pb push_back
#define INF 1000000000000000
#define MOD 1000000007
#define ff first
#define ss second
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//ll gcd( ll a, ll b ){if(b==0) return a; else return gcd( b, a%b );}
//ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}
//void printArray(vi &v){for(int i=0;i<v.size();i++) cout<<v[i]<<endl; cout<<endl; }
int main(){
   FastIO
   ll n,w;
   cin>>n>>w;
   vi wt(n+1),v(n+1);
   for(int i=1;i<=n;i++)
   cin>>wt[i]>>v[i];
   vvi dp(n+1,vi(w+1));
   for(int i=0;i<=n;i++){
       for(int j=0;j<=w;j++){
           if(i==0 || j==0)
           dp[i][j]=0;
           else if(j<wt[i])
           dp[i][j]=dp[i-1][j];
           else{
               dp[i][j] = max(v[i] + dp[i-1][j-wt[i]],dp[i-1][j]);
           }
       }
   }
   cout<<dp[n][w];
   return 0;
}

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

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

    int N;
    cin >> N;
    int N_floor = ceil(N/1.08);
    int ans1 = floor(N_floor*1.08);
    if (ans1 == N) {
        cout << N_floor << endl;
    }
    else {
        cout << ":(" << endl;
    }
}

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

int main(){
    int n, b, f, r, v;
    int num[4][3][10] = {{{0}}};
    cin >> n;
    
    for(int i = 0; i < n; i++){
        cin >> b >> f >> r >> v;
        num[b-1][f-1][r-1] = num[b-1][f-1][r-1] + v;
    }
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 10; k++){
                cout << ' ' << num[i][j][k];
            }
            cout << endl;
        }
        if(i == 3) break;
        for(int l = 0; l < 20; l++){
            cout << '#';
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3080
#include <cstdio>
const int MAXN = 1e5+5;
const int MAXS = 5;
char  out[MAXN];
char    S[MAXN][MAXS];
int C[3];
int N;

bool check(int i, char c) {
  return (S[i][0] == c) || (S[i][1] == c);
}

bool solve() {
  int sum = C[0] + C[1] + C[2];
  if (sum == 0) {
    return false;
  }
  for (int i = 0; i < N; ++i) {
    int u = S[i][0] - 'A';
    int v = S[i][1] - 'A';
    if (!C[u] && !C[v]) {
      return false;
    }
    bool U = C[u];
    if (C[u] && C[v]) {
      int nxt = i+1;
      if ((nxt < N) && !check(nxt, S[i][1])) U = false;
    }
    if (U) {
      out[i] = S[i][1];
      --C[u];
      ++C[v];
    } else {
      out[i] = S[i][0];
      ++C[u];
      --C[v];
    }
  }
  return true;
}

int main() {
  scanf("%d", &N);
  for (int i = 0; i < 3; ++i) {
    scanf("%d", &C[i]);
  }
  for (int i = 0; i < N; ++i) {
    scanf(" %s", S[i]);
  }
  if (solve()) {
    puts("Yes");
    for (int i = 0; i < N; ++i) {
      putchar(out[i]);
      puts("");
    }
  } else {
    puts("No");
  }
  return 0;
}

Measured memory_bytes: 3752
n, k = map(int, input().split())

ans = 0
# サイコロの目は1,2,...,N（等確立）
for i in range(1, n + 1):

    cnt = 0
    temp = i
    # cnt = 何回2倍したらk超えるか
    while temp < k:
        temp *= 2
        cnt += 1
    # サイコロでその目が出る確率は1/n
    # そこから表を出し続けてk越える確率は(1/2)**cnt
    ans += (1 / n) * ((1 / 2)**cnt)
print(ans)

Measured memory_bytes: 9300
import java.util.*;
public class Main{   
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = sc.nextInt();
      long x = (long)Math.min(m,n);
      long y = (long)Math.max(m,n);
      if(x==1&&y==1)System.out.println(1);
      else if(x==1)System.out.println(y-2);
      else System.out.println((x-2)*(y-2));
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}


Measured memory_bytes: 23124
//Name: Square Route
//Level: 3
//Category: データ構造,二分探索
//Note:

/**
 * 縦方向と横方向のそれぞれについて、構成可能な幅をすべて列挙し、それぞれの幅について何通りの構成方法があるかを記録しておく。
 * すると、大きさsである正方形の構成方法は、縦方向と横方向でそれぞれsを構成できればこれらの組み合わせは任意なので、個数の積が組み合わせ数となる。
 * これはmapを使うことで効率的に求められる。
 *
 * オーダーは O(N^2 log M)。
 */
#include <iostream>
#include <map>
#include <vector>

using namespace std;

bool solve() {
    int N, M;
    if(!(cin >> N >> M)) return false;
    if(!N && !M) return false;

    vector<int> hs(N), ws(M);
    for(int i = 0; i < N; ++i) {
        cin >> hs[i];
        if(i > 0) hs[i] += hs[i-1];
    }
    for(int i = 0; i < M; ++i) {
        cin >> ws[i];
        if(i > 0) ws[i] += ws[i-1];
    }

    map<int,int> hmap;
    for(int i = -1; i < N; ++i) {
        const int hi = i >= 0 ? hs[i] : 0;
        for(int j = i+1; j < N; ++j) {
            hmap[hs[j] - hi]++;
        }
    }
    int ans = 0;
    for(int i = -1; i < M; ++i) {
        const int wi = i >= 0 ? ws[i] : 0;
        for(int j = i+1; j < M; ++j) {
            ans += hmap[ws[j] - wi];
        }
    }
    cout << ans << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 19056
#include<bits/stdc++.h>
using namespace std;
vector<double> vi;
int gcd(int a,int b){
    return !b?a:gcd(b,a%b);
}

int main(){
  long long a,b;
  scanf("%lld%lld",&a,&b);
  a-=a/b*b;
  long long thispos=abs(a-b);
  a=thispos;
  long long thisneg=abs(a-b);
  printf("%lld",min(a,thisneg));
   return 0;
}


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

int main(){
  int i,x,n;
  cin >> x;
  long long N[90];
  N[0] = 2;
  N[1] = 1;
  for(i = 2; i < x + 1; i++){
    N[i] = N[i-1] + N[i-2];
  }
  cout << N[x] << endl;
  return 0;
}



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

int main(void) {
    int n, y;
    cin >> n >> y;

    for(int nx = 0; nx <= n; nx++) {
        for(int ny = 0; ny <= n - nx; ny++) {
            int nz = n - nx - ny;
            if(y == nx * 10000 + ny * 5000 + nz * 1000) {
                cout << nx << " " << ny << " " << nz <<endl;
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <chrono>
#include <tuple>
#include <string>
#include <random>
#include <cstdio>
#define ll long long int
// #define endl '\n'
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
const int N = 100001;
vector<pair<ll, ll> > adj[N];

void solve() 
{
    int n;
    cin>>n;

    vector<pair<ll, pair<ll, ll> > > v1, v2;

    rep(i, n)
    {
        int x, y;
        cin>>x>>y;

        v1.pb(mp(x, mp(y, i + 1)));
        v2.pb(mp(y, mp(x, i + 1)));
    }

    sort(all(v1)), sort(all(v2));

    for(int i = 1; i < n; i++)
    {
        adj[v1[i].S.S].pb(mp(v1[i-1].S.S, v1[i].F - v1[i-1].F));
        adj[v1[i-1].S.S].pb(mp(v1[i].S.S, v1[i].F - v1[i-1].F));
    }

    for(int i = 1; i < n; i++)
    {
        adj[v2[i].S.S].pb(mp(v2[i-1].S.S, v2[i].F - v2[i-1].F));
        adj[v2[i-1].S.S].pb(mp(v2[i].S.S, v2[i].F - v2[i-1].F));
    }

    set<pair<ll, ll> > st;

    for(int i = 2; i <= n; i++)
    {
        st.insert(mp(LLONG_MAX, i));
    }

    st.insert(mp(0, 1));

    ll keys[n+1];

    rep(i, n + 1)
    {
        keys[i] = LLONG_MAX;
    }

    keys[1] = 0;

    ll ans = 0;

    // for(auto x:st)
    // {
    //     cout<<x.F<<" "<<x.S<<endl;
    // }
    

    // for(int i = 1; i <= n; i++)
    // {
    //     cout<<i<<endl;
    //     for(auto v:adj[i])
    //     {
    //         cout<<v.F<<" "<<v.S<<endl;
    //     }
    //     cout<<endl;
    // }

    // cout<<st.size()<<endl;

    set<ll> taken;

    while(st.size())
    {
        auto it = st.begin();

        pair<ll, ll> p = *it;
        st.erase(it);
        taken.insert(p.S);

        // cout<<p.F<<" "<<p.S<<endl;

        ans += p.F;

        for(auto v:adj[p.S])
        {
            if(v.S < keys[v.F] && taken.find(v.F) == taken.end())
            {
                st.erase(mp(keys[v.F], v.F));
                st.insert(mp(v.S, v.F));
                keys[v.F] = v.S;
            }
        }

        // cout<<st.size()<<endl;
    }

    cout<<ans<<endl;





}

int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }

    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 26360
from collections import deque
lines = input().split(' ')
m = int(lines[0])
n = int(lines[1])

if m > 1 and n > 1:
    ans = (m-2)*(n-2)
elif m == 1 and n == 1:
    ans = 1
else:
    ans = abs(m-n) - 1
print(ans)

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

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define pfk printf(" ");
#define pf0 printf("0");
#define pf1 printf("1");
#define ll long long
#define ull unsigned long long
#define sfd(n) scanf("%d",&n);
#define sfdd(n,m) scanf("%d%d",&n,&m);
#define sfld(n) scanf("%lld",&n);
#define sfldd(n,m) scanf("%lld%lld",&n,&m);
#define sflf(n) scanf("%lf",&n);
#define sflff(n,m) scanf("%lf%lf",&n,&m);
#define sfc(n) scanf("%c",n);
#define sfcc(n,m) scanf("%c%c",n,m);
#define sfs(n) scanf("%s",n);
#define sfss(n,m) scanf("%s%s",n,m);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));

ll a[200010];
ll b[200010];
ll mode=1e9+7;
ll Pow(ll a, ll b)
{
    ll sum = 1;
    while (b) {
        if (b & 1) {
            sum = (sum * a) % mode;
            b--;
        }
        b /= 2;
        a = (a * a) % mode;
    }
    return sum;
} 
int main(){
	ll n,k;
	cin>>n>>k;
	//c(n-1,i-1)*c(n,i)
	a[0]=1;
	b[0]=1;
	for(int i=1;i<=n-1;i++){
		a[i]=((a[i-1]*(n-i))%mode)*Pow(i,mode-2);
		a[i]%=mode;
		
	}
	for(int i=1;i<=n;i++){
		b[i]=((b[i-1]*(n+1-i))%mode)*Pow(i,mode-2);
		b[i]%=mode;
	}
	ll sum=0;
//	if(k>=n){
//		if((k-n+1)%2==0){
//			k=n-1;
//		}
//		else{
//			k=n-2;
//		}
//	}
	//最小n-k>0?n-k:(k-(n-1)%2==0?1:2)
	//最大k%2==0?n:n-1

	
	for(int i=max(0ll,n-k);i<=n;i++){
		sum+=(a[i-1]*b[i])%mode;
		sum%=mode;
	}
	cout<<sum<<endl;
}

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && b != 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;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(){
  int G[100][100];
  int k,n,i,j;
  int t[100],y[100];
  int w,min,a,b;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    t[i]=1;
    y[i]=0;
    for(j=0;j<n;j++){
      scanf("%d",&G[i][j]);
    }
  }

  y[0]=1;
  t[0]=0;
  j=n-1;
  w=0;
  while(j--){
    min=1000000;
    for(i=0;i<n;i++){
      if(!y[i])
	continue;
      
      for(k=0;k<n;k++){
	if(!t[k])
	  continue;
	
	
	a=G[i][k];

	if(0<=a&&a<min){
	  b=k;
	  min=a;
	}
      }
    }
    y[b]=1;
    t[b]=0;
    w+=min;
  }
  printf("%d\n",w);
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    cin >> N;
    double ret = ((N + 1) / 2) * 1.0 / N;
    cout << fixed << setprecision(10) << ret << endl;
    return 0;
};


Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  while(true){
    if(isPrime(N)){
      myout(N);
      return;
    }
    N++;
  }
}
function isPrime(val){
  if(val == null || val <= 1 || (val != 2 && val % 2 == 0)){
    return false;
  }else if(val == 2){
    return true;
  }
  var root = Math.floor(Math.sqrt(val));
  for(var i = 3; i <= root; i += 2){
    if(val % i == 0){
      return false;
    }
  }
  return true;
}

Measured memory_bytes: 31112
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  int i;
  int n;
  while(cin>>n,n){
    char s[101];
    cin>>s;
    int a[100],b[100];
    for(i=0;i<n;++i){
      cin>>a[i]>>b[i];
      --a[i];
      --b[i];
    }
    for(i=n-1;i>=0;--i){
      char t=s[a[i]];
      s[a[i]]=s[b[i]];
      s[b[i]]=t;
      s[a[i]]=(s[a[i]]-'a'+abs(a[i]-b[i]))%26+'a';
      s[b[i]]=(s[b[i]]-'a'+abs(a[i]-b[i]))%26+'a';
    }
    cout<<s<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        hoge();
        //System.Console.ReadLine();
    }

    public static void hoge()
    {
        var vars = System.Console.ReadLine().Split(' ').Select(decimal.Parse).ToArray();

        System.Console.WriteLine(string.Format("{0:F0}",Math.Floor(vars[0] * vars[1])));
    }
}

Measured memory_bytes: 28316
#include <stdio.h>
int main(void)
{

	char str[20];
	int a;
	int b;
	int c;
	fgets(str, sizeof(str), stdin);
	sscanf(str, "%d %d %d",&a, &b, &c);
	if( a < b && b < c ){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;

}

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

typedef long long ll;
const int mod = 1000000007;

int main(){
    int n;
    cin >> n;

    ll ans = 1;
    vector<int> v(3, -1);
    for(int i = 0; i < n; i++){
        int x;  cin >> x;
        int tim = 0;
        for(int j = 0; j < 3; j++){
            if(x == v[j]+1) tim++;
        }
        if(tim == 0){
            cout << 0 << endl;
            return 0;
        }
        ans *= tim;
        ans %= mod;
        for(int j = 0; j < 3; j++){
            if(x == v[j]+1){
                v[j]++;
                break;
            }
        }
    }

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

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

smaller_value = min(a, b)

divisors = []
for i in range(1, smaller_value // 2 + 1):
    if smaller_value % i == 0:
        divisors.append(i)
divisors.append(smaller_value)

larger_value = max(a, b)
count = 0
for d in reversed(divisors):
    if larger_value % d == 0:
        count += 1
        if count == k:
            print(d)
            break


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N; cin >> N;
  vector<int> dp(N + 1, 1e7); dp[0] = 0;
  for (int i = 0; i < N; ++i)
    {dp[i + 1] = min(dp[i + 1], dp[i] + 1);
    for (auto k : {6, 9}) for (int p = k; i + p <= N; p *= k) dp[i + p] = min(dp[i + p], dp[i] + 1);}
  cout << dp[N] << endl;}

Measured memory_bytes: 3588
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

def solve(a,b,c,d):
  if a < b or d < b:
    return True

  cnt=gcd(b,d)
  mi=a-b
  ma=a-c
  if ma-mi > cnt :
    return True
  elif ma-mi <= 1:
    return False
  elif (mi+cnt)//cnt*cnt < ma:
    return True
  else:
    return False

T=int(input())
for i in range(T):
  A,B,C,D=map(int,input().split())
  if solve(A,B,C,D):
    print("No")
  else:
    print("Yes")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s1,s2;
  cin>>s1;
  for(int i=0;i<s1.size();i++){
    if(s1.at(i)=='0') 
      s2+='0';
    if(s1.at(i)=='1') 
      s2+='1';
    if(s1.at(i)=='B')
      if(s2.size()!=0) s2.erase(s2.size()-1);
  }
  cout<<s2<<endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <limits>
#include <iomanip>
#include <functional>
#include <array>
#include <climits>
#include <cmath>

using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;

int main()
{
    ll a, b, k;
    cin >> a >> b >> k;
    ll count = 0;
    for (ll i = 100; i >= 1; i--)
    {
        if (a % i == 0 && b % i == 0)
        {
            count++;
            if (count == k)
            {
                cout << i;
                break;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define fr first
#define se second
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
ll fac[2000005];
ll power(ll a,ll b){ll res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b=b/2;}return res%mod;}
ll ncr(ll n,ll r){return ((fac[n]*power(fac[r],mod-2))%mod*power(fac[n-r],mod-2))%mod;}
void pre(){fac[0]=1;fac[1]=1;for(int i=2;i<2000005;i++)fac[i]=(i*fac[i-1])%mod;}
signed main()
{   

      senky_bansal
      IIIT_ALLAHABAD
      
      ll t;
     // cin>>t;
      t=1;
      while(t--)
      {
          ll a;
        cin>>a;
        cout<<a*a;
          
          
      }
 

}


















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

using namespace std;
typedef long long ll;
#define pb push_back

const int N = 100007;
const int M = 1e9 + 7;

vector<int> e[N];
int memo[N][2]; // vertice e cor do pai

int solve(int u, int c, int p = -1) {
    int & st = memo[u][c];
    if(st == -1) {
        st = 0;

        // pinta de black
        if(c == 0) {
            ll aux = 1;
            for(int v : e[u]) {
                if(v == p) continue;
                aux = aux * solve(v, 1, u) % M;
            }

            st = (st + aux)%M;
        }

        ll aux = 1;
        for(int v : e[u]) {
            if(v == p) continue;
            aux = aux * solve(v, 0, u) % M;
        }

        st = (st + aux)%M;        
    }
    return st;
}

int main() {
    memset(memo, -1, sizeof memo);
    int n; cin >> n;

    for(int i = 0; i < n-1; ++i) {
        int x, y; cin >> x >> y;
        e[x].pb(y);
        e[y].pb(x);
    }

    cout << solve(1, 0) << endl;
}

Measured memory_bytes: 14848
#include<stdio.h>
main(){
  int i,j,k,l,n,m;
  int a[101][101]={0},b[101][101]={0};
  long c[101][101]={0};

  scanf("%d %d %d",&n,&m,&l);

  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      scanf("%d",&a[i][j]);
    }
  }
/*  for(i=1;i<=n;i++){
    for(j=1;j<m;j++) printf("%d ",a[i][j]);
    printf("%d\n",a[i][m]);
  }
*/
  for(i=1;i<=m;i++){
    for(j=1;j<=l;j++){
      scanf("%d",&b[i][j]);
    }
  }
/*  for(i=1;i<=m;i++){
    for(j=1;j<l;j++) printf("%d ",b[i][j]);
    printf("%d\n",b[i][l]);
  }
*/
  for(i=1;i<=n;i++){
    for(j=1;j<=l;j++){
      for(k=1;k<=m;k++){
        c[i][j]=c[i][j]+a[i][k]*b[k][j];
      }
    }
  }

  for(i=1;i<=n;i++){
    for(j=1;j<l;j++) printf("%ld ",c[i][j]);
    printf("%ld\n",c[i][l]);
  }


  return 0;
}

Measured memory_bytes: 1932
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
ll read()
{
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
struct Point{double x,y;}p1,p2,p;
Point operator +(Point a,Point b){return (Point){a.x+b.x,a.y+b.y};}
Point operator -(Point a,Point b){return (Point){a.x-b.x,a.y-b.y};}
Point operator *(Point a,double b){return (Point){a.x*b,a.y*b};}
double dot(Point a,Point b){return a.x*b.x+a.y*b.y;}
double norm(Point a){return a.x*a.x+a.y*a.y;}
void read(Point &p){p.x=read(),p.y=read();}
void print(Point p){printf("%.10lf %.10lf\n",p.x,p.y);}
Point Project(Point p1,Point p2,Point p)
{
	Point base=p2-p1,hypo=p-p1;
	double r=dot(base,hypo)/norm(base);
	return p1+base*r;
}
Point Reflect(Point p1,Point p2,Point p)
{return p+(Project(p1,p2,p)-p)*2;}
int main()
{
	read(p1),read(p2);
	int q=read();while(q--)
		read(p),print(Reflect(p1,p2,p));
	return 0;
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll n;
    cin>>n;
    ll ans=0;
    for(ll i=1;i<=n;++i){
        if(i%3!=0 and i%5!=0){
            ans+=i;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3596
import java.util.Scanner;

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

		char[] a = "dream".toCharArray();
		char[] b = "dreamer".toCharArray();
		char[] c = "erase".toCharArray();
		char[] d = "eraser".toCharArray();
		StringBuilder sb = new StringBuilder(s);

		while (sb.length() > 0) {
			if (isMatch(sb, a)) {
				sb.delete(sb.length() - a.length, sb.length());

			} else if (isMatch(sb, b)) {
				sb.delete(sb.length() - b.length, sb.length());

			} else if (isMatch(sb, c)) {
				sb.delete(sb.length() - c.length, sb.length());

			} else if (isMatch(sb, d)) {
				sb.delete(sb.length() - d.length, sb.length());

			} else {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}

	static boolean isMatch(StringBuilder sb, char[] str) {
		if (sb.length() < str.length) {
			return false;
		}
		for (int i = 0; i < str.length; i++) {
			if (sb.charAt(sb.length() - str.length + i) != str[i]) {
				return false;
			}
		}
		return true;
	}
}


Measured memory_bytes: 27692
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,sum = 0,m;
    map<int,int>mp;
    vector<int>v;
    cin>>n;
    for(i = 0;i < n;i++)
    {
        cin>>m;

        mp[m]++;

        v.push_back(m);
    }
    for(i = 0;i < v.size();i++)
    {

        if(mp[v[i]]%2!=0)
        {
            sum++;
            mp[v[i]] = 0;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 5368
#include<bits/stdc++.h>
using namespace std;
int p=1e9+7;

int main(){
	int h,w;
	cin>>h>>w;

	char a[h+1][w+1];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>a[i][j];
		}
	}

	long long dp[h][w];
	memset(dp,0,sizeof(dp));

	bool flag=false;
	for(int i=0;i<h;i++){
		if(a[i][0]!='#' && !flag)
			dp[i][0]=1;
		else
			flag=true;
	}
	flag=false;
	for(int j=0;j<w;j++){
		if(a[0][j]!='#' && !flag)
			dp[0][j]=1;
		else 
			flag=true;
	}
	for(int i=1;i<h;i++){
		for(int j=1;j<w;j++){
			if(a[i][j]=='#')
				continue;
			else{
				dp[i][j]=((dp[i-1][j])%p+(dp[i][j-1])%p)%p;
			}
		}
	}
	/*for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/
	cout<<dp[h-1][w-1]<<endl;
	return 0;
}
			


Measured memory_bytes: 9088
from itertools import permutations
import math

n = int(input())
xy = [[int(i) for i in input().split()] for i in range(n)]
d = 0

for p in permutations(range(n)):

    p = list(p)
    sum = 0
    for i in range(n-1):
        xi,yi = xy[p[i]]
        xj,yj = xy[p[i+1]]
        sum += math.sqrt((xi-xj)**2 + (yi-yj)**2)
    d += sum

print(d/math.factorial(n))


Measured memory_bytes: 3064
using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false),in.tie(0),cout.tie(0);
#define input freopen("input.in","right_interval",stdin);
#define output freopen("output.out","w",stdout);
#define e printf("\n");
#define all(it,v) for(it=(v).begin();it!=(v).end();it++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair<ll,ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define si(x) scanf("%d",&x)
#define sf(x) scanf("%f",&x)
#define sl(x) scanf("%lld",&x)
#define pi(x) printf("%d",x);
#define pf(x) printf("%f",x);
#define pl(x) printf("%lld",x);
typedef vector<vector<ll> > mat;
const ll mx=100001;
const ll mod=1000000007;
const ll inf=0x3f3f3f3f;
//ifstream in("input.txt");
//ofstream out("output.txt");
void solve();
int main()
{
  int t=1;
//  si(t);
  rep(i,1,t)
  {
    solve();
    if(i!=t) e
  }
  return 0;
}
int dp[mx];
int ar[mx];
void solve()
{
  int i,j,k,m,K,n;
  dp[0]=0;
  si(n); si(K);
  rep(i,0,n-1) 
  {
    dp[i]=INT_MAX;
    si(ar[i]);
  }
  dp[0]=0;
  dp[1]=abs(ar[0]-ar[1]);
  rep(i,2,n-1)
  {
    for(k=1;k<=K && i-k>=0;k++)
      dp[i]=min(dp[i],dp[i-k]+abs(ar[i]-ar[i-k]));
 //   dp[i]=min(dp[i-1]+abs(ar[i]-ar[i-1]),dp[i-2]+abs(ar[i]-ar[i-2]));
  }
  cout<<dp[n-1];  
}





























Measured memory_bytes: 1024
N = int(input())
L = list(map(int, input().split()))
ans = 0
for i in range(N-2):
  for j in range(i+1, N-1):
    if L[i] == L[j]:
      continue
    for k in range(j+1, N):
      if L[i] + L[j] > L[k] > abs(L[i]-L[j]) and L[j] != L[k] and L[i] != L[k]:
        ans += 1
print(ans)

Measured memory_bytes: 68208
#include <stdio.h>
#include <string.h>
#define N 150
#define M 1000

int LCSLength( char [], char [] );
int main(){
    int n, i, result[N+1];
    char A[N+1][M+1], B[N+1][M+1];

    //input
    scanf("%d", &n);
    for( i=1; i<=n; i++ ) scanf("%s %s", A[i], B[i]);

    //calculate
    for( i=1; i<=n; i++ )
	result[i] = LCSLength( A[i], B[i] );

    //print
    for( i=1; i<=n; i++ ) printf("%d\n", result[i]); 

    return 0;
}

int LCSLength( char A[], char B[] ){
    int i, j, C[M+1][M+1], A_len, B_len;

    //get lengthes
    A_len = strlen( A );
    B_len = strlen( B );

    //initialize
    for( i=1; i<=A_len; i++ ) C[i][0] = 0;
    for( i=1; i<=B_len; i++ ) C[0][i] = 0; 

    //calculate
    for( i=1; i<=A_len; i++ ){
	for( j=1; j<=B_len; j++ ){
	    if( A[i-1] == B[j-1] )
		C[i][j] = C[i-1][j-1] + 1;
	    else if( C[i-1][j] >= C[i][j-1] )
		C[i][j] = C[i-1][j];
	    else 
		C[i][j] = C[i][j-1];
	}
    }
    
    return C[A_len][B_len];
}



Measured memory_bytes: 5792