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

typedef long long ll;
#define M 1000000007

int main(){
	
	ll a,b;
	cin>>a>>b;
	
	if(a ==1 && b == 2 || a == 2 && b == 1)
		cout<<3<<endl;
	else if(a == 2 && b == 3 || a==3 && b==2)
		cout<<1<<endl;
	else
		cout<<2<<endl;
	
}

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(){
    int n;
    cin >> n;
    vector <ll> h(n);
    rep(i,n){
        cin >> h[i];
    }

    ll k,max2;
    k=0;
    max2=-1;
    --h[0];

    rep(i,n-1){
        if(h[i+1]>h[i]){
            --h[i+1];
        }
        if(h[i+1]<h[i]){
            k=1;
            break;
        }
    }

    if(k==0){
        cout << "Yes" << endl;
    }
    else{
         cout << "No" << endl;
    }
    

    return 0;
}

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

using namespace std;

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

	while(n >0)
	{
		int k=n%10;
		if(k==7){
			
			cout<<"Yes"<<endl;
			return 0;
		}
		
		n = n/10;
	}

	
	cout<<"No"<<endl;	
		

	return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

int main()
{
    FAST_IO;

    int a, b;
    scanf("%d %d", &a, &b);
    if (a < 6)
        printf("0\n");
    else if (a < 13)
        printf("%d\n", b/2);
    else
        printf("%d\n", b);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

int main(){
	int N,K;
	cin >> N >> K;
	vector<int> D;
	int tmp1;
	rep(i,0,K){
		cin >> tmp1;
		D.push_back(tmp1);
	}
	bool tmp = true;
	int ans=N;
	while(tmp){
		tmp1 = ans;
		while(tmp1 != 0){
			int tmp2 = tmp1%10;
			tmp = false;
			rep(i,0,D.size()){
				if(tmp2 == D[i]){
					tmp = true;
					break;
				}
			}
			if(tmp) break;
			tmp1/=10;
		}
		ans++;
	}
	cout << ans-1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ACC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mod 1000000007
#define MAXN 10000001
//string alpha="abcdefghijklmnopqrstuvwxyz";
//int dx[]={1,-1,0,0};
//int dy[]={0,0,1,-1};
//int dx8[]={1,-1,0,0,1,1,-1,-1};
//int dy8[]={0,0,1,-1,1,-1,1,-1};
/*int spf[MAXN];
void sieve()
{
	int i,j;
	for(i=0;i<MAXN;i++)
	spf[i]=i;
	for(i=4;i<MAXN;i+=2)
	spf[i]=2;
	for(i=3;i*i<MAXN;i++)
	{
		if(spf[i]==i)
		{
			for(j=i*i;j<MAXN;j+=i)
			{
				if(spf[j]==j)spf[j]=i;
			}
		}
	}
}*/
/*bool isvowel(char c)
{
    switch(c)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':return true;
        default : return false;
    }
}*/
/*bool isValid(int x,int y,int n,int m)
{
    if(x<0||x>n-1||y<0||y>m-1)return false;
    return true;
}*/
/*
bool comp(pair<int,int> x,pair<int,int> y)
{
    if(y.second==x.second)
        return y.first<x.first;
    return y.second<x.second;
}*/
int32_t main()
{
    ACC
    int T;
    T=1;
    //cin>>T;
    while(T--)
    {
        int n,i;
        cin>>n;
        vector<int> v;
        vector<int> v1;
        for(i=0;i<n;i++)
        {
            int x,y;
            cin>>x>>y;
            v.pb(x+y);
            v1.pb(x-y);
        }
        sort(v.begin(),v.end());
        sort(v1.begin(),v1.end());
        int ans=max(v[n-1]-v[0],v1[n-1]-v1[0]);
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 6616
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define LL long long
#define PLL pair<LL, LL>
#define LD long double
#define VI vector<int>
#define VPII vector<PII>
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define pb pop_back
#define FOR(a,s,d) for (int a = (s); a <= (int)(d); ++a)
#define FORD(a,s,d) for (int a = (s); a >= (int)(d); --a)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RE(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ALL(x) x.begin(), x.end()
#define siz(x) ((int)x.size())
#define Sim template <class s
Sim, class d> ostream & operator<<(ostream &os, pair<s,d> x){return os << "<" << x.F << ", " <<
  x.S << "> ";}
Sim> auto operator<<(ostream &os, s x) -> typename enable_if<!is_same<s,string>::value,
  decltype(x.begin(), os)>::type
{ int o = 0; os << "{"; for (auto c : x) {if(o++) os << ", "; os << c;}return os << "} ";}
void dor() {cerr << endl;}
Sim, class ...t> void dor(s x, t...y) {cerr << x << " "; dor(y...);}
#ifdef DEB
#define debug(c...) dor(__FUNCTION__, ":", __LINE__, ": ", c)
#else
#define debug(...)
#endif
const int M = 1024 * 256;

int n, T[M], pos[M], dp[M];

int main()
{
  //ios_base::sync_with_stdio(0);
  //cin.tie(0);
  scanf("%d", &n);
  int res = 1;
  REP(i, n)
  {
    scanf("%d", T + i);
    pos[T[i]] = i;
  }
  dp[1] = 1;
  for (int i = 2; i <= n; i++)
  {
    if (pos[i] > pos[i - 1])
    {
      dp[i] = dp[i - 1] + 1;
    }
    else
    {
      dp[i] = 1;
    }
    res = max (res, dp[i]);
  }
  printf("%d\n", n - res);
  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll memo[3005][3005];

ll sol(ll arr[], int i, int j)
{
	if (i == j)
		return arr[i];
	if (i + 1 == j)
		return max(arr[i], arr[j]);
	if (memo[i][j] == 0)
	{
		ll start = arr[i] + min(sol(arr, i + 2, j),
								sol(arr, i + 1, j - 1));
		ll end = arr[j] + min(sol(arr, i + 1, j - 1),
						sol(arr, i, j - 2));
		memo[i][j] = max(start, end);
	}
	return memo[i][j];
}
int main()
{
	int n; cin >> n;
	ll arr[n];
	for(int i=0; i<n; i++) cin >> arr[i];
	ll sum = 0;
	for(int i=0; i<n; i++) sum += arr[i];
	ll ans = sol(arr, 0, n-1);
	cout << 2 * ans - sum << endl;
	return 0;
}

Measured memory_bytes: 70144
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n,m;
  cin >> n;
  vector<string> s(n);
  rep(i,n) cin >> s[i];
  
  cin >> m;
  vector<string> t(m);
  rep(i,m) cin >> t[i];
  
  int x = 0;
  
  rep(i,n){
    int score = 0;
    rep(j,n) if(s[i] == s[j]) score++;
    rep(k,m) if(s[i] == t[k]) score--;
    x = max(x,score);
  }
  
  cout << x;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <boost/foreach.hpp>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    long long n, k;
    cin >> n >> k;
  vector<int>h(n);
  for(int i; i<n; i++) cin >> h[i];
  if(n<=k){
    cout << 0 << endl;
    exit(0);
  }
  long long rsl=0;
  if(n>k){
    sort(h.begin(), h.end());
    for(int i=0; i<n-k; i++){
      rsl += h[i];
    }
    cout << rsl << endl;
  }
}

Measured memory_bytes: 1024
import collections
n=int(input())
a=map(int,input().split())
b=list(collections.Counter(a).items())
lst=[]
Lst=[]
for i in range(len(b)):
  if b[i][1]>1:
    lst.append(int(b[i][0]))  
    if b[i][1]>3:
      Lst.append(int(b[i][0]))
if len(lst)<2 and len(Lst)==0:
  print(0)
else:
  if len(lst)==1:
    Lst.sort(reverse=True)
    print(Lst[0]**2)
  else:
    if len(Lst)>0:
      lst.sort(reverse=True)
      Lst.sort(reverse=True)
      print(max(lst[0]*lst[1],Lst[0]**2))     
    else:
      lst.sort(reverse=True)
      print(lst[0]*lst[1])
  


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

void chmin(int& a, int b){
    a = min(a, b);
}

int main(){
    int N;
    cin >> N;
    vector<int> X(N), Y(N);
    vector<char> U(N);
    for(int i=0; i<N; i++) cin >> X[i] >> Y[i] >> U[i];

    const int INF = 1e8;
    int ans = INF;

    map<int, vector<pair<int, char>>> x2y, y2x;
    for(int i=0; i<N; i++){
        x2y[X[i]].emplace_back(Y[i], U[i]);
        y2x[Y[i]].emplace_back(X[i], U[i]);
    }
    for(auto& [_, v] : x2y){
        sort(v.begin(), v.end());
        int x1 = -INF;
        for(auto& [x, d] : v){
            if(d == 'U') x1 = x;
            if(d == 'D') chmin(ans, 5*(x-x1));
        }
    }
    for(auto& [_, v] : y2x){
        sort(v.begin(), v.end());
        int x1 = -INF;
        for(auto& [x, d] : v){
            if(d == 'R') x1 = x;
            if(d == 'L') chmin(ans, 5*(x-x1));
        }
    }

    for(int t=0; t<2; t++){
        map<int, vector<pair<int, char>>> V;
        for(int i=0; i<N; i++) V[X[i]+Y[i]].emplace_back(X[i], U[i]);
        for(auto& [_, v] : V){
            sort(v.begin(), v.end());
            // R->U, D->L
            int xr = -INF, xd = -INF;
            for(auto& [x, d] : v){
                if(d == 'R') xr = x;
                if(d == 'D') xd = x;
                if(d == 'U') chmin(ans, 10*(x-xr));
                if(d == 'L') chmin(ans, 10*(x-xd));
            }
        }
        for(int i=0; i<N; i++){
            Y[i] = 200000-Y[i];
            if(U[i] == 'U'){
                U[i] = 'D';
            }else if(U[i] == 'D'){
                U[i] = 'U';
            }
        }
    }
    if(ans == INF){
        cout << "SAFE" << endl;
    }else{
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 70032
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
    string S;
    cin>>S;
    int n=S.size();
    int len=n;
    for(int i=1; i<n; i++)
    {
        if(S[i]!=S[i-1])
            len=min(len,max(i,n-i));
    }
    cout<<len<<endl;
    return 0;
}


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

const int INF = 1001001001;
//const ll INF = 1000000000000000000;

int main() {
	int n;
	ll d;
	cin >> n >> d;
	
	int ans = 0;
	rep(i,n) {
		ll x, y;
		cin >> x >> y;
		if (x*x + y*y <= d*d) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void solve(){
    int h,w;
    static int c[1400][1400];
    cin >> h >> w;
    rep(i,0,h) rep(j,0,w) cin >> c[i][j];
    
    static int dp[1400][1400];
    int ans=0;
    rep(i,0,h) rep(j,0,w){
        if(!c[i][j]) dp[i][j]=1;
        ans|=dp[i][j];
    }
    
    rep(i,1,h) rep(j,1,w){
            if(c[i][j]) continue; 
            dp[i][j]=min({dp[i-1][j],dp[i][j-1],dp[i-1][j-1]})+1;
            ans=max(ans,dp[i][j]);
    }
    
    cout << ans*ans << endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 15912
# 169A
# A × B を整数として出力せよ。

# 1. 入力をプログラムで扱えるように受け取ること
a, b = map(int, input().split())
# print(a, b)

# 2. 受け取った入力値を使って、適切に処理(計算)すること
answer = a * b

# 3. 計算した結果を出力すること
print(answer)



Measured memory_bytes: 9108
s=input()
ss = list(str(s))
import sys

for i in range(len(ss)):
  if ((i+1) % 2 == 1) and (s[i]=='L'):
    print('No')
    sys.exit()
  if ((i+1) % 2 == 0) and (s[i]=='R'):
    print('No')
    sys.exit()
  
print('Yes')

Measured memory_bytes: 38384
// but in the end its me & I

#include <bits/stdc++.h>
#include <vector>

#define s second
#define f first
#define pb push_back
//#define int ll

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const long long MAX=2e6,INF=1e9+1,mod=998244353;

int n,m,k,a[MAX],dp[MAX];
string s;
vector <int> v;
bool mark[MAX];

main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> k;
    fill (dp,dp+MAX,INF);
    dp[0]=0;
    cin >> a[0];
    for(int i=1;i<n;i++)
    {
        cin >> a[i];
        int x = a[i];
        for(int j=1;j<=k && i-j >=0 ;j++)
        {
            dp[i]=min(dp[i],dp[i-j]+abs(x-a[i-j]));
            //cout << i << ' ' << i-j << ' ' << dp[i] << endl;
        }
    }
    cout << dp[n-1];
    return -0;
}


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

int main(){
    int N;
    cin>>N;
    vector <int>A(N);
    for(int i=0 ; i<N ; i++){
        cin>>A[i];
    }

    for(int i=0 ; i<N ; i++){
        A[i] -= i;
    }

    sort(A.begin(), A.end());
    long long center = A[N/2];
    long long ans = 0;
    for (int i = 0 ; i < N ; i++) {
        ans += abs(center - A[i]);
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){

  double Ra,Wa,C,R;
  while(cin >> Ra >> Wa >> C >> R,Ra+Wa+C+R){
    int n = 1;
    if(Ra / Wa >= C)
      cout << "0" << endl;
    else{
      while(((Ra + R * n) / Wa) < C){
	n++;
      }
      cout << n << endl;
    }
  }

}

Measured memory_bytes: 3060
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>

#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

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

int main(void) {

  string t, s[10] = {"SUN", "MON","TUE", "WED", "THU", "FRI", "SAT", "SUN"};
  cin >> t;

  int i = 0;
  while (s[i] != t) i++;

  int j = 1;
  while (s[i + j] != "SUN") j++;

  cout << j << endl;

  return 0;

}


Measured memory_bytes: 256
S = input()

y = int(S[:4])
m = int(S[5:7])
d = int(S[8:10])

if y > 2019:
    print('TBD')
elif y < 2019:
    print('Heisei')
else:
    if m >= 5:
        print('TBD')
    else:
        print('Heisei')


Measured memory_bytes: 2940
//
//AtCoder Beginner Contest 076
//C
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>
#include <numeric>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    int slen = s.size();
    int tlen = t.size();

    vector<int> contIdx;
    REP(i, slen-tlen+1){
        bool contains = true;
        REP(j, tlen){
            if (s[i+j] == t[j] || s[i+j]=='?') continue;
            contains = false;
            break;
        }
        if (contains) contIdx.push_back(i);
    }
    sort(RALL(contIdx));

    if (contIdx.size()>0) {
        REP(i,tlen) s[contIdx[0]+i] = t[i];
        REP(i,slen){
            if (s[i]=='?') s[i]='a';
        }
        cout << s << endl;
    }else{
        cout << "UNRESTORABLE" << endl;
    }
    return 0;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, a, b;
    cin >> n >> a >> b;

    if((b-a+1) % 2 == 1){
        ppp("Alice");
    }
    else{
        ppp("Borys");
    }



    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector <int> a(n);
	for (int i = 0;i < n;i++)cin>>a[i];
	sort(a.begin(), a.end());
	cout << a[n - 1] - a[0] << endl;

	return 0;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
const ll MAX = 802;
ll h,w,k,ans=1e13;
ll vx[]={1,0,-1,0};
ll vy[]={0,1,0,-1};
vector<vector<bool>> check(MAX,vector<bool>(MAX,false));
vector<string> a(MAX);
void dfs(ll x,ll y){
  check[x][y] = true;
  for(ll i=0;i<4;i++){
    ll nx,ny;
    nx = x+vx[i],ny = y+vy[i];
    if(nx<0||ny<0||nx>=h||ny>=w||a[nx][ny]=='#'||check[nx][ny]) continue;
    dfs(nx,ny);
  }
}
signed main(){
  init_io();
  ll sx=0,sy=0;
  ll mv = 1e9;
  cin >> h >> w >> k;
  for(int i=0;i<h;i++){
    cin >> a[i];
    for(int j=0;j<w;j++){
      if(a[i][j]=='S'){
        sx = i;
        sy = j;
        a[i][j] = '.';
      }
    }
  }
  dfs(sx,sy);
  for(ll i=0;i<h;i++){
    for(ll j=0;j<w;j++){
      if(abs(i-sx)+abs(j-sy)>k) continue;
      if(!check[i][j]){
        continue;
      }
      mv = min(mv,min(i,h-1-i));
      mv = min(mv,min(j,w-1-j));
    }
  }
  ans =1+(mv+k-1)/k;
  cout << ans << endl;
}


Measured memory_bytes: 41756
#include<stdio.h>

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


Measured memory_bytes: 2000
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    c = Counter(A)
    uniq = list(k for k in c.keys())
    uniq.sort()
    ans = 0
    for u in uniq:
        ans = max([ans, c[u - 1] + c[u] + c[u + 1]])
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 14564
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int x = 0, i = 0;
        while(true){
            x = scan.nextInt();
            if(x == 0) break;
            i++;
            System.out.println("Case " + i + ": " + x);
        }
    }
}


Measured memory_bytes: 42536
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scin = new Scanner(System.in);
		
		int numOfTests = Integer.parseInt(scin.nextLine());
		
		while (numOfTests > 0) {
			String str1 = scin.nextLine();
			String str2 = scin.nextLine();
			
			System.out.println("" + getCommonCharLength(str1, str2));
			numOfTests -= 1;
		}
	}
	
	
	public static int getCommonCharLength(String s1, String s2) {
		int[][] table = new int[s1.length()][s2.length()];
		for (int i = 0; i < s1.length(); i++) {
			for (int ii = 0; ii < s2.length(); ii++) {
				if (s1.charAt(i) == s2.charAt(ii)) {
					if (i > 0 && ii > 0) {
						table[i][ii] = table[Integer.max(0, i-1)][Integer.max(0, ii-1)] + 1;
					}else {
						table[i][ii] = 1;
					}
					
				}else {
					if(i > 0 && ii> 0) {
						table[i][ii] = Integer.max(table[i][Integer.max(0, ii - 1)], table[Integer.max(0, i - 1)][ii]);
					}else if (ii > 0){
						table[i][ii] = table[i][ii-1];
					}else if (i > 0){
						table[i][ii] = table[i-1][ii];
					}
				}
			}
		}
		
		
		return table[s1.length() - 1][s2.length() - 1];
	}
	
}



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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/24  Problem: code-festival-2016-final_c / Link: https://cf16-final.contest.atcoder.jp/tasks/codefestival_2016_final_c?lang=en  ----- */
/* ------問題------

ある星には M 種類の言語があり、1-M の番号が付けられています。

この星のある年のCODE FESTIVALには星中から N 人の参加者が集まりました。

i(1≦i≦N) 人目の参加者は Ki 種類の言語 Li,1,Li,2,…,Li,Ki を話すことが出来ます。

ある 2 人は以下のいずれかの条件を満たすときに限り、コミュニケーションを取ることが出来ます。

2 人ともが話すことの出来る言語が存在する。
ある人 X が存在して、 2 人ともが X とコミュニケーションを取ることが出来る。
このとき、N 人すべての参加者が他のすべての参加者とコミュニケーションを取ることが出来るかどうかを判定してください。

-----問題ここまで----- */
/* -----解説等-----

何でもかんでも繋がっていれば良い
言語と人をつなぐとこのグラフについて人が連結になっていればコミュニケーションできるという意味になる

----解説ここまで---- */

LL N,M;

LL ans = 0LL;

void dfs(int v, int p, VVI &G, VI& visit) {
	visit[v] = 1;
	FOR(i, 0, SZ(G[v])) {
		int nx = G[v][i];
		if (nx != p && !visit[nx])dfs(nx, v, G, visit);
	}
}

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

	cin >> N>>M;
	VVI G(N + M);
	FOR(i, 0, N) {
		int k;
		cin >> k;
		FOR(j, 0, k) {
			int lg;
			cin >> lg;
			lg--;
			lg += N;
			G[i].push_back(lg);
			G[lg].push_back(i);
		}
	}

	VI visit(N+M);
	dfs(0,-1,G,visit);
	ans = 1;
	FOR(i, 0, N) {
		if (!visit[i])ans = 0;
	}
	cout << (ans?"YES":"NO") << "\n";

	return 0;
}


Measured memory_bytes: 9208
#include <iostream>
#include <string>
#include <iterator>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <sstream> 
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <functional>
#pragma GCC optimize("O3")
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sp system("pause");
#define MOD 998244353 
#define mxN 2005
#define MXINT 1e9+5


bool divide_three(ll n)
{
	ll res = 0;
	while (n)
	{
		res += (n % 10);
		n /= 10;
	}
	if (res % 3 == 0)
		return true;
	return false;
}

void solve()
{
	ll n;
	cin >> n;
	ll ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (!divide_three(i) && i % 5 != 0)
			ans += i;
	}
	cout << ans;
}

int main()
{
	fast;
	solve();
	
	return 0;
}



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

int main(){
  string S;
  cin >> S;

  int b1,b2;
  string judge = "NA";

  b1=stoi(S.substr(0,2));
  b2=stoi(S.substr(2,2));
  
  if(b1==0 && b2==0) judge="NA";
  if(b1==0 && 0<b2 && b2<13) judge="YYMM";
  if(b1==0 && 12<b2) judge="NA";
  if(0<b1 && b1<13 && b2==0) judge="MMYY";
  if(0<b1 && b1<13 && 0<b2 && b2<13) judge="AMBIGUOUS";
  if(0<b1 && b1<13 && 12<b2) judge="MMYY";
  if(12<b1 && b2==0) judge="NA";
  if(12<b1 && 0<b2 && b2<13) judge="YYMM";
  if(12<b1 && 12<b2) judge="NA";

  cout << judge << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, l, r) for(ll i = (l); i < (r); i++)
#define rep(i, N) FOR(i, 0, N)
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll MOD = round(1e9+7);

int main() {
    queue<ll> que;
    while(1){
        int n,x; cin >> n >> x;
        ll ans = 0;
        if(n == 0 && x == 0) break;
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                int tmp = x-i-j;
                if(tmp >= j+1 && tmp <= n) {
                    ans++;
                }
            }
        }
        que.push(ans);
    }

    while(!que.empty()){
        cout << que.front() << "\n";
        que.pop();
    }
    return 0;
}



Measured memory_bytes: 3088
#include <iostream>

using namespace std;

int main()
{
    int N,K;
    cin >> N >> K;

    char tep,last='P'; int count=0;
    while(cin >> tep)
    {
        if(tep!=last) count++;
        last = tep;
    }

    int i;
    for(i=0;i<K;i++)
    {
        if(count == 1) break;  
        if(count > 2) count = count -2;
        else count--;  
    }

    cout << N-count;
}

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


int main(){
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for(int i=0 ; i< n-2 ; i++){
    if(s.substr(i,3) == "ABC")  ans++;
 }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*
 ________  ___   ___  ________
|\   __  \|\  \ |\  \|\   __  \
\ \  \_\ /\ \  \\_\  \ \  \|\  \
 \ \   __\_\ \______  \ \  \\\  \
  \ \  \_\  \|_____|\  \ \  \\\  \
   \ \______/|     \ \__\ \_______\
    \|______|/      \|__|\|_______|

*/
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define fe(i,a,b) for(int i=a;i<=b;i++)
#define fne(i,a,b) for(int i=a;i<b;i++)

#define all(x) x.begin(),x.end()
#define pb push_back
#define lowbit(x) x&-x
#define lc rt<<1
#define rc rt<<1|1
#define ls lc,l,m
#define rs rc,m+1,r

#define dbg(x) cout<<' '<<#x<<" = "<<x<<endl;
#define dbg2(x,y) {cout<<' '<<#x<<" = "<<x<<',';dbg(y)}
#define dbg3(x,y,z) {cout<<' '<<#x<<" = "<<x<<',';dbg2(y,z)}

int read(int &x){return scanf("%d",&x);}
int read(ll &x){return scanf("%lld",&x);}
int read(double &x){return scanf("%lf",&x);}

int read(int &x,int &y){return scanf("%d%d",&x,&y);}
int read(ll &x,ll &y){return scanf("%lld%lld",&x,&y);}
int read(double &x,double &y){return scanf("%lf%lf",&x,&y);}

int read(int &x,int &y,int &z){return scanf("%d%d%d",&x,&y,&z);}
int read(ll &x,ll &y,ll &z){return scanf("%lld%lld%lld",&x,&y,&z);}
int read(double &x,double &y,double &z){return scanf("%lf%lf%lf",&x,&y,&z);}

ll qpow(ll a,ll b,ll mod){if(a==0)return 0;ll ans=1;a%=mod;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod;b>>=1;}return ans%mod;}
ll inv(ll x,ll mod){return qpow(x,mod-2,mod);}


int dir[4][2]={0,1,0,-1,1,0,-1,0};
int mon[13]={ 0,31,28,31,30,31,30,31,31,30,31,30,31};

const int INF =0x3f3f3f3f;
const int mod = 1e9+7;
const int N = 5e5+5;

struct DSU{
	int f[N];
	void init(int n){fe(i,0,n)f[i] = i;}//remember initial
	int fa(int x){return f[x]==x?x:f[x]=fa(f[x]);}
	void join(int x,int y){x=fa(x);y=fa(y);if(x!=y)f[x]=y;}
};
struct CombMath{
	int C[2005][2005];
    void init(int n){
		fe(i,1,n)
			fe(j,1,n)
                C[i][j] = (C[i-1][j] + C[i-1][j-1])%mod;
    }
};

char s[N];
ll a[N];

signed main(){
//	freopen("in1.txt","r",stdin);
//	freopen("in2.txt","r",stdin);
//	freopen("in3.txt","r",stdin);
//	freopen("in4.txt","r",stdin);
//	freopen("in5.txt","r",stdin);
//	freopen("BZW.txt","r",stdin);


	int n;
	read(n);
	scanf("%s",s+1);
	char pre = '?';
	int cnt=0;
    fe(i,1,n){
        if(s[i] == pre)continue;
        else {
			pre = s[i];
			cnt++;
        }

    }
    printf("%d\n",cnt);



    return 0;
}


Measured memory_bytes: 2304
import itertools
import math

antena = []
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
k = int(input())
for v in itertools.combinations(antena, 2):
    if v[1] - v[0] > k:
        print(":(")
        quit()
print('Yay!')

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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using namespace std;

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

    double a, b; cin >> a >> b;

    if(a > b) cout << "GREATER";
    else if(a == b) cout << "EQUAL";
    else if(a < b) cout << "LESS";
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

ll mod(ll a) {
	if (a > 0) return a % MOD;
	if (a % MOD == 0) return 0;
	ll x = -a / MOD + 1;
	a += x * MOD;
	return a % MOD;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
template <typename T> void dump(T x) { cout << x << endl; }
void dumpf(double x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
// ll dx[4] = {1, 0, -1, 0};
// ll dy[4] = {0, 1, 0, -1};
// ll pas[5001][5002];
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll use[10] = {INF, 2, 5, 5, 4, 5, 6, 3, 7, 6};
string dp[10002];

int main() {
	IOS();
	ll a, b;
	cin >> a >> b;
	dump(b % a == 0 ? a + b : b - a);
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  int r, g, b;
  cin >> r >> g >> b;
  int c = 100*r + 10*g + b;
  if(c%4 == 0){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 384
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
S=sum(A)
DivS=set()
index=1
while(index*index<=S):
    if S%index==0:
        DivS.add(index)
        DivS.add(S//index)
    index+=1
#print(DivS)
ans=1
for d in DivS:
    B=[A[i] for i in range(N)]
    for i in range(N):
        if A[i]%d==0:
            continue
        #kd<A[i]<(k+1)d
        #k=A[i]//d
        tmp1=(A[i]//d)*d
        tmp2=tmp1+d
        if abs(tmp1-A[i])<=abs(tmp2-A[i]):
            B[i]=tmp1
        else:
            B[i]=tmp2
    nowsum=sum(B)
    #print(d,B)
    if nowsum!=S:
        C=sorted(range(N),key=lambda i:abs(A[i]-B[i]),reverse=True)
        if nowsum>S:
            k=0
            need=(nowsum-S)//d
            for i in C:
                if B[i]>A[i]:
                    B[i]-=d
                    k+=1
                if k>=need:
                    break
        if nowsum<S:
            k=0
            need=(S-nowsum)//d
            for i in C:
                if B[i]<A[i]:
                    B[i]+=d
                    k+=1
                if k>=need:
                    break
    #print(d,A,B)
    cost=sum([abs(A[i]-B[i]) for i in range(N)])
    if cost<=2*K:
        ans=max(ans,d)
print(ans)
    


Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; cin >> n; int cnt = 0;
	rep(i, n) {
		int a; cin >> a; if (a % 2)cnt++;
	}
	if (cnt % 2)cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int i, j, t;
        int cnt = 0;
        int n = sc.nextInt();
        int[] num;
        num = new int[n];
        for(i=0; i<n; i++){
            num[i] = sc.nextInt();
        }

        for(i=0; i<n; i++){
            for(j=n-1; j>i; j--){
                if(num[j-1] > num[j]){
                    t = num[j]; num[j] = num[j-1]; num[j-1] = t;
                    cnt++;
                }
            }
        }

        for(i=0; i<n-1; i++){
            System.out.print(num[i]+" ");
        }
        System.out.println(num[n-1]);
        System.out.println(cnt);
        sc.close();
    }
}


Measured memory_bytes: 26320
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n;
	cin >> n;
	co((n+1)/2);

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <random>
#include <map>
#include <set>
#include <boost/lexical_cast.hpp>

using namespace std;


using ULL = decltype(0ull);
constexpr auto DIV = 1000000007ull;
constexpr auto MAX = numeric_limits<ULL>::max();

int main() {
  ULL a, b, x;
  cin >> a >> b >> x;
  cout << (b / x - a / x) + (a%x == 0 ? 1 : 0) << endl;
  return 0;
}


Measured memory_bytes: 256
from math import ceil

l = list(map(int,input().split()))
l.sort()
a = l[0]
b = l[1]
c = l[2]

res = 0
res += c-b
a += res
b = c

res += ceil((c-a)/2)
a += 2*ceil((c-a)/2)

if a == b:
    print(res)
else:
    print(res + 1)



Measured memory_bytes: 3060
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#define REP(i,n)for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ll long long
using namespace std;

int main(){
	string s[3];
	REP(i,3)cin>>s[i];
	cout<<"A"<<s[1][0]<<"C"<<endl;
}



Measured memory_bytes: 256
//In the name of Allah
#include <bits/stdc++.h>
using namespace std;
#define MAX 200011
#define mod 1000000007
#define inf 1000000000000000
#define ll long long
#define endl '\n'
ll dp[4*MAX];
int h[MAX],w[MAX];

void update(int node,int l,int r,int i,ll v){
	if(l == r){
		dp[node] = v;
	}else{
		int mid = (l + r)>>1;
		if(i <= mid)update(2*node + 1,l,mid,i,v);
		else update(2*node + 2,mid + 1,r,i,v);
		dp[node] = max(dp[2*node + 1],dp[2*node + 2]);
	}
}
ll get(int node,int l,int r,int x,int y){
	if(x <= l && r <= y){
		return dp[node];
	}
	int mid = (l+r)>>1;
	ll ans = 0;
	if(x <= mid)ans = max(ans,get(2*node + 1,l,mid,x,y));
	if(y >= mid + 1)ans = max(ans,get(2*node + 2,mid + 1,r,x,y));
	return ans;
}

int main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i = 0; i < n; i++)cin>>h[i];
	for(int i = 0; i < n; i++)cin>>w[i];
	update(0,1,n,h[0],w[0]);	
	for(int i = 1; i < n; i++)
		update(0,1,n,h[i],get(0,1,n,1,h[i]) + w[i]);
	cout<<dp[0];
	return 0; 
} 

Measured memory_bytes: 6400
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n,x;
  cin >> n >> x;
  int total = 0, ans = 0;
  rep(i, n){
    int l;
    cin >> l;
    total += l;
    if(total > x) break;
    ans++;
  }
  cout << ans + 1 << endl;
}

Measured memory_bytes: 256
//

fun main() {
    abc179c()
}

fun abc179c() {
    val n = readLine()!!.toInt()
    val table = IntArray(n) { 1 }
    table[0] = 0
    for (a in 2 until n) {
        var b = 1
        while (a * b <= n - 1) {
            table[a * b] += 1
            b++
        }
    }
    println(table.sum())
}


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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        int a = in.ni();
        int b = in.ni();
        out.println(a*b);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

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

using namespace std;

int main(){
	int n;
	cin>>n;
	
	int x = n;
	int ans = 0;
	
	while(x){
		ans += x%10;
		x /= 10;	
	}
	
	if(n % ans == 0)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<time.h>
#include<stack>

using namespace std;
#define INF 1000000007

#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


int n;

int main(){
	cin >> n;
	for(int i = n; ; i++){
		bool b = 0;
		for(int j = 2; j*j <= i; j++){
			if(i % j == 0){
				b = 1;
				break;
			}
		}
		if(!b){
			cout << i << endl;
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int C[30];
string xyz="abcdefghijklmnopqrstuvwxyz";

int main(){
  string S;
  cin>>S;

  for(int i=0;i<(int)S.size();i++){
    C[S[i]-'a']++;
  }

  for(int i=0;i<26;i++){
    if(C[i]==0){
      cout<<xyz[i]<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int d,n,k=1,i,ans=0;
  cin >> d >> n;
  if (d==2) k=10000;
  else if (d==1) k=100;
  if (n==100) cout << 101*k << endl;
  else cout << n*k << endl;
  return 0;
}

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

#define ms(a,b) memset(a, b, sizeof(a))
#define rep(a,b,c) for(int a = (int)(b); a < (int)(c); a++)
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define m_p(a,b) make_pair(a, b)
#define lson l,mid,o << 1
#define rson mid + 1,r,o << 1 | 1
#define ls o << 1
#define rs o << 1 | 1
#define inf 0x3f3f3f3f

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;

inline bool isdigit(char& ch) {
	return ch >= '0' && ch <= '9';
}
template<class T>
void read(T &x) {
	x = 0;
	ll f = 1;char ch = getchar();
	for (;!isdigit(ch);ch = getchar()) 
		if (ch == '-') f = -1;
	for (; isdigit(ch);ch = getchar())
		x = (x << 1) + (x << 3) + ch - '0';
	x *= f;
}
template<class T>
inline void write(T x) {
	if (x == 0) {putchar('0');return ;}
	if (x < 0) {putchar('-');x = -x;}
	int _stk[65],_top = 0;
	for (;x;x /= 10) _stk[++_top] = x % 10 + 48;
	for (;_top;_top--)putchar(_stk[_top]);
}

const int MAXN = 1e6 + 10;

int arr[70], cnt;
ll a;
bool vis[MAXN];
int pr[MAXN];
int calc(int x) {
	int t = 1;
	int ss = 0;
	while(x >= t) {
		ss++;
		x -= t;
		t++;
	} 
	return ss;
}
int main () {
	read(a);
	ll sum = 0;
	for (int i = 2; i <= MAXN; ++i) {
		if (!vis[i]) {
			pr[++pr[0]] = i;
			for (int j = i + i; j <= MAXN; j += i)
				vis[j] = 1;
		}
	}
	for (int i = 1; i <= pr[0]; ++i) {
		if (a % pr[i] == 0) {
			cnt++;
			while(a % pr[i] == 0) {
				a /= pr[i];
				arr[cnt]++;
			}
		}
	}
	if (a > 1) {
		cnt++;
		arr[cnt]++;
	}
	rep(i, 1, cnt + 1) {
	//	cout << arr[i] << " "<<calc(arr[i]) << endl;
		sum += calc(arr[i]);
	} 
	cout << sum;
	return 0;
}

Measured memory_bytes: 4920
// Etavioxy
#include<cstdio>
#include<cctype>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
#define il inline
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch; int f=1;
	while(!isdigit(ch=getchar())) f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar())) x=(x*10)+(ch^'0');
	return f*x;
}

//

char s[10];

int main(){
	scanf("%s",s+1);
	if( s[1]==s[2] && s[2]==s[3] ) puts("No");
	else puts("Yes");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define LL long long 
const int mod=1000000007;
const int N=500;
using namespace std;
char a[N],b[N];
int n;
LL ans;
int main()
{
	scanf("%d",&n);
	scanf("%s",&a);
	scanf("%s",&b);
	for(int i=n;i>=1;--i) a[i]=a[i-1],b[i]=b[i-1];
	a[0]='&';
	b[0]='*';
    
//for(int i=1;i<=n;++i)
// printf("%c",b[i]);
// cout<<endl;    
    
    for(int i=1;i<=n;)
    {
      if(i==1)
      {
      	if(a[i]==b[i]) ans=3,i=i+1;
      	else ans=6,i=i+2;
	    continue;
	  }
	  else 
	  {
	    if(a[i]!=a[i+1]) 
	     {
	     	if(a[i-1]!=a[i-2]) ans=(LL)ans*2*1LL%mod,i=i+1;
	     	else  i=i+1;
            continue;
		 }
		else
		{
		  if(a[i-1]==a[i-2]) ans=(LL)ans*3%mod,i=i+2;
		  else ans=(LL)ans*2%mod,i=i+2;
		  continue;
		}
	  }
	}
	cout<<ans%mod<<endl;
}
/*
5
abbWW
acctt

52
RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn
RLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn
*/

Measured memory_bytes: 256