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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int n = read();
  vi a, b, c;
  int sum = 0;
  REP(i, n) a.PB(read());
  REP(i, n) { b.PB(read()); }
  REP(i, n - 1) { c.PB(read()); }
  int prev = -1;
  REP(i, n) {
    sum += b[a[i] - 1];
    if (a[i] != n && i != n - 1)
      if (a[i + 1] == a[i] + 1)
        sum += c[a[i] - 1];
  }
  print(sum);
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	
	for (int i  = 0; i < n; i++){
		double x[3], y[3], s[3];
		double l, m, n;
		
		for (int j = 0; j < 3; j++){
			scanf("%lf %lf", &x[j], &y[j]);
			s[j] = x[j] * x[j] + y[j] * y[j];
		}
		
		double x2[2], y2[2], s2[2];
		x2[0] = x[0] - x[1];
		y2[0] = y[0] - y[1];
		s2[0] = s[0] - s[1];
		x2[1] = x[0] - x[2];
		y2[1] = y[0] - y[2];
		s2[1] = s[0] - s[2];
		
		m = - (s2[0] * x2[1] - s2[1] * x2[0]) / (y2[0] * x2[1] - y2[1] * x2[0]);
		l = - (s2[0] * y2[1] - s2[1] * y2[0]) / (x2[0] * y2[1] - x2[1] * y2[0]);
		n = - s[0] - x[0] * l - y[0] * m;
		
		double a,b,r;
		
		a = l / -2;
		b = m / -2;
		r = sqrt(- n - a * a - b * b - l * a - m * b);
		
		printf("%.3lf %.3lf %.3lf\n", a, b, r);
		
		}
	return(0);
}

Measured memory_bytes: 1092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X;
    cin >> X;
    cout << (X>=30? "Yes\n":"No\n");
}

Measured memory_bytes: 3632
lines = input().split()
w = int(lines[0])
h = int(lines[1])
c = lines[2]

for i in range(h):
    for j in range(w):
        if i == 0 or i == (h - 1):
            if j == 0 or j == (w - 1):
                print("+", end="")
            else:
                print("-", end="")
        else:
            if i == (h // 2) and j == (w // 2):
                print(c, end="")
            elif j == 0 or j == (w - 1):
                print("|", end="")
            else:
                print(".", end="")
    print("")


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

using namespace std;

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

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

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

int main(int argc, char **argv) {
	ll a, b, k;
	cin >> a >> b >> k;
	FORR(i, 1, max(a, b)+1) if (a % i == 0 && b % i == 0) {
		if (--k == 0) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>

using namespace std;

int N, A[200001];
int Max=0, max_index;
int sec=0, sec_index;

int main(){
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> A[i];
    if (A[i] >= Max) {
      sec = Max;
      sec_index = max_index;
      Max = A[i];
      max_index = i;
    } else if (A[i] >= sec) {
      sec = A[i];
      sec_index = i;
    }
  }
  for (int i=0; i<N; i++) {
    cout << ((i!=max_index)?Max:sec) << endl;
  }
  return 0;
}

Measured memory_bytes: 2432
import sys


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    N, T = map(int, input().split())

    dp = [0] * (T + 1)

    AB = []

    for k in range(N):
        a, b = map(int, input().split())
        AB.append((a, b))

    AB.sort()
    maxdp = 0

    for i in range(N):
        a, b = AB[i]  # a:time  b:value

        dp[T] =max( maxdp + b,dp[T])
        for j in range(T - 1, a - 1, -1):
            dp[j] = max(dp[j], dp[j - a] + b)
            maxdp= max(dp[j],maxdp)
    print(dp[T])

if __name__ == "__main__":
    main()


Measured memory_bytes: 74236
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int n,a[510],b[510],c[510];

int main(){
	cin >> n;
	REP(i,0,n-1) cin >> c[i] >> a[i] >> b[i];
	REP(i,0,n){
		int s=a[i]+c[i];
		REP(j,i+1,n-1){
			if(s<=a[j]) s=a[j]+c[j];
			else s+=(b[j]-(s-a[j])%b[j])%b[j]+c[j];
		}
		cout << s << endl;
	}
	return 0;
}


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

using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
#define rep(pos, len) for(int pos=0;pos<len;pos++)
#define repp(pos, len) for(int pos=1;pos<=len;pos++)
 
#define INF 1987654321
#define IINF 87654321987654321
#define MOD 1000000007

int main() {
	int n;
	string s;
	cin >> n >> s;
	for(auto &c : s)
		c = ((c - 'A' + n) % 26) + 'A';
	cout << s;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#define REP(i, start, n) for(int i = start; i < n; ++i)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
#define debug2d(var)  do{std::cout << #var << " : \n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    vector<P> wv(N+1);
    vector<vector<ll> > dp(N+1, vector<ll>(W+1));

    REP(i, 1, N+1) cin >> wv[i].first >> wv[i].second;

    REP(j, 0, W+1) {
        dp[0][j] = 0;
    }

    REP(i, 1, N+1) REP(j, 1, W+1) {
        if (wv[i].first <= j) {
            dp[i][j] = max(dp[i-1][j-wv[i].first] + wv[i].second, dp[i-1][j]);
        } else {
            dp[i][j] = dp[i-1][j];
        }
    }
    
    cout << dp[N][W] << endl;

    return 0;
}

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

#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
const int mod = 1e9 + 7, size = 1e6 + 1;

int main()
{
    fast

    int n;
    cin >> n;

    vector <ll> v(n);
    for (int i = 0; i < n; ++i) cin >> v[i];

    ll ans = 0;
    for (int i = 0; i < n-1; ++i) {
        if (v[i] > v[i+1]) {
            ans += (v[i] - v[i+1]);
            v[i+1] += (v[i] - v[i+1]);
        }
    }

    cout << ans << endl;
}
// () ! # &


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

string mat[110];
bool erase_i[110], erase_j[110];

int main()
{
    int n, m;

    cin >> n >> m;
    
    for(int i = 0; i < n; i ++) cin >> mat[i];
    
    for(int i = 0; i < n; i ++)
    {
        erase_i[i] = true;
        for(int j = 0; j < m; j ++)
            if(mat[i][j] == '#')
            {
                erase_i[i] = false;
                break;
            }
    }
    for(int j = 0; j < m; j ++)
    {
        erase_j[j] = true;
        for(int i = 0; i < n; i ++)
            if(mat[i][j] == '#')
            {
                erase_j[j] = false;
                break;
            }
    }
    //cout << "aaa" << endl;

    for(int i = 0; i < n; i ++)
    {
        if(erase_i[i]) continue;
        
        for(int j = 0; j < m; j ++)
            if(!erase_j[j])
                cout << mat[i][j];
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
cs = [0] * (N + 1)
for i in range(N): cs[i + 1] = cs[i] + a[i]
res = float("inf")
for i in range(1, N):
  res = min(res, abs(cs[i] - (cs[-1] - cs[i])))
print(res)

Measured memory_bytes: 71632
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
int main(){
    int64_t x;
    cin>>x;
    int A,B;
    for(int64_t a=-300;a<=300;a++){
        for(int64_t b=-300;b<=300;b++){
            if(a*a*a*a*a - b*b*b*b*b==x){
                A=a,B=b;
            }
        }
    }
    cout<<A<<" "<<B<<endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

#define MAX 2000000
ll fac[MAX];
ll finv[MAX];
ll inv[MAX];

void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    repr(i,2,MAX){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll COM(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


int main(){
    COMinit();
    int X,Y; cin >> X >> Y;
    ll ans = 1;
    bool ok = false;
    rep(i,1000010){
        if(Y-2*i >= 0){
            int d = Y-2*i;
            if(i+2*d == X){
                ok = true;
                ans *= COM(i+d,i);
                ans %= MOD;
            }
        }
    }
    if(!ok){
        cout << 0 << endl;
        return 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 47104
#include<stdio.h>
#include<string.h>

int main(void){
  char s1[10], s2[10];
  int t=0,h=0,n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
	  scanf("%s %s", s1, s2);
	  if ( strcmp(s1, s2) == 0 ){
	    t+=1;
	    h+=1;
	  }
	  else if ( strcmp(s1, s2) > 0 ) t+=3;
	  else if ( strcmp(s1, s2) < 0 ) h+=3;
  }
  printf("%d %d\n",t,h);
  return 0;
}


Measured memory_bytes: 2036
N = int(input())

ans = [0]

def calc(s):
    if int(s) <= N:
        if "3" in s and "5" in s and "7" in s:
            ans[0] += 1
        for e in ["3", "5", "7"]:
            calc(s + e)

for e in ["3", "5", "7"]:
    calc(e)

print(ans[0])


Measured memory_bytes: 53468
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

int main() {
	int n; cin >> n;
	int c[503], s[503], f[503];
	for (int i = 0; i < n; ++i) cin >> c[i] >> s[i] >> f[i];
	for (int i = 0; i < n; ++i) {
		int t = 0;
		for (int j = i; j < n - 1; ++j) {
			while (t < s[j]) ++t;
			while (t % f[j] != 0) ++t;
			t += c[j];
		}
		cout << t << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
class Hello
{

    static void Main(string[] args)
    {
        var AB = Console.ReadLine().Split(' ');
        int a = int.Parse(AB[0]);
        int b = int.Parse(AB[1]);
        int ab1 = a + b;
        int ab2 = a - b;
        int ab3 = a * b;
        int max = 0;

        max = ab1;
        if (ab1 < ab2)
        {
            max = ab2;
            if (ab1 < ab3)
            {
                max = ab3;
            }

        }
        else
        {

            if (ab1 < ab3)
            {
                max = ab3;
            }
        }

        Console.WriteLine(max);
    }

}

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

int main()
{
ll n , a , b ;
cin >> n >> a >> b ;
ll c=a^b;
if(__builtin_popcountll(c)%2==0){
  cout << "NO" << endl;
  return 0;
}
cout << "YES" << endl;
vector<ll> on,off;
rep(i,n){
  if((c>>i)&1LL)on.push_back(i);
  else off.push_back(i);
}
vector<ll> r;
deque<ll> l;
r.push_back(0);
r.push_back(1);
l.push_back(0);
l.push_back(1);
rep(i,off.size()-1){
  ll siz=r.size();
  rep(j,siz){
    r.push_back(r[siz-1-j]+(1LL<<(i+1)));
  }
}
ll sizz=r.size();
rep(i,sizz)r.push_back(r[sizz-1-i]);

rep(i,(on.size()-1)/2){
  ll siz=l.size();
  rep(j,siz){
    if(j==siz-1){
      l.push_back((l[j]<<2)+2);
      l.push_back((l[j]<<2)+0);
      l.push_back((l[j]<<2)+1);
      l.push_back((l[j]<<2)+3);
    }
    else if(j%2==0){
      l.push_back((l[j]<<2)+0);
      l.push_back((l[j]<<2)+1);
      l.push_back((l[j]<<2)+3);
      l.push_back((l[j]<<2)+2);
    }
    else{
      l.push_back((l[j]<<2)+2);
      l.push_back((l[j]<<2)+3);
      l.push_back((l[j]<<2)+1);
      l.push_back((l[j]<<2)+0);
    }
  }
  rep(j,siz)l.pop_front();
}
vector<ll> ans;
set<ll> s;
rep(i,(1LL<<n)){
  ll anss=0;
  rep(j,on.size()){
    anss+=((l[i/(1LL<<off.size())]>>j&1LL)<<on[j]);
  }
  rep(j,off.size()){
    anss+=((r[i%r.size()]>>j&1LL)<<off[j]);
  }
  ans.push_back(anss^a);
  s.insert(anss^a);
}
for(auto an:ans)cout << (an) << " ";
cout << endl;
//cout << s.size() << endl;

return 0;
}

Measured memory_bytes: 8308
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

string s;
void input(){
    fast_io();
    cin >> s;
}

int solve(){
    ll ans = 0;
    // for (int i = 0; i < s.length(); i++)
    // {
    //     if(s[i]=='A'){
    //         i++;
    //         while(i+1<s.length() && s[i]=='B' && s[i+1]=='C'){
    //             ans++;
    //             i+=2;
    //         }
    //     }
    // }
    int i=0;
    int anum=0;
    while(i<(int)s.length()){
        if(s[i]=='A' || (s[i]=='B'&&s[i+1]=='C')){
            if(s[i]=='A') {anum++;i++;}
            else {ans += anum;i+=2;}
        }
        else
        {
            anum=0;
            i++;
        }
        
    }
    cout << ans << endl;
    return 0;
}   

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

Measured memory_bytes: 720
//run: g++ -std=c++14 -o run_sol.exe solution.cpp -DLOCAL_JUDGE
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define INFLL 1e17
#define PI 2*acos(0.0)
#define show(x) cout<< #x <<" is "<< x <<"\n"
using namespace std;

#define FS first
#define SC second
#define PB(t) push_back(t)
#define LEN(t) ((int)t.size())
#define ALL(t) t.begin(),t.end()
#define MP(x, y) make_pair((x), (y))
#define Fill(a,c) memset(&a, c, sizeof(a))
#define POPCOUNT __builtin_popcount

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<PII> VPII;

int main() {
    #ifdef LOCAL_JUDGE
        freopen("../input.txt", "rt", stdin);
        freopen("../output.txt", "wt", stdout);
    #endif

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

    int mxV = 100002;
    for (int n, w, wi, vi; cin >> n >> w ; ) {
        VLL dp(mxV, INFLL);
        dp[0] = 0;
        LL mx = 0;

        for (int i = 0; i < n; i++) {
            cin >> wi >> vi;

            for (int j = mxV - 1; j >=0; j--) {
                if (j + vi < mxV) {
                    dp[j + vi] = min(dp[j + vi], dp[j] + wi);
                    if (dp[j + vi] <= w and j + vi > mx){
                        mx = j + vi;
                    }
                }
            }
        }
        
        cout << mx << "\n";
    }
    
return 0;
} 

Measured memory_bytes: 1024
n, l = (int(s) for s in input().strip().split(' '))
an = []
for a in range(0,l):
    an.append(input().strip().split())
box=[[1,0] for i in range(n)]
box[0][1] = 1
for move in an:
    box[int(move[0])-1][0] -= 1
    box[int(move[1])-1][0]+=1
    if box[int(move[0])-1][1] == 1:
        box[int(move[1])-1][1]= 1
    if box[int(move[0])-1][0]==0:
        box[int(move[0])-1][1]=0
print(str(sum([s[1] for s in box])))

Measured memory_bytes: 43316
from itertools import accumulate

n = int(input())
aaa = list(map(int, input().split()))
acc = [0] + list(accumulate(aaa))
dp = [[0] * (n + 1) for _ in range(n)]
for l, aa in enumerate(zip(aaa, aaa[1:])):
    dp[l][l + 2] = sum(aa)
for w in range(3, n + 1):
    for l in range(n - w + 1):
        r = l + w
        c = acc[r] - acc[l]
        dp[l][r] = min(dp[l][m] + dp[m][r] + c for m in range(l + 1, r))
print(dp[0][n])


Measured memory_bytes: 43740
//
//  main.cpp
//  A
//
//  Created by Hashizo on 2019/07/20.
//  Copyright © 2019 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>

using namespace std;

#undef INT_MAX
#undef INT_MIN

#define INT_MAX	2147483647
#define INT_MIN	(-INT_MAX  -1)

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define REPLACE(s, f, t) regex_replace(s, regex(f), t)

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

	
	
	
	cout << 3*r*r << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

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

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

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

u64 sum, m;

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

    sum = 0;
    m = 0;
    u64 time;
    rep (i, 3)
    {
        cin >> time;
        sum += time;
        m = MAX(m, time);
    }

    cout << sum - m << "\n";

    return 0;
}



Measured memory_bytes: 256
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */
 
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>
 
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n"
#define MOD 1000000007
 
const long double PI = 3.141592653589793236L;
 
typedef long long int ll;
typedef long double ld;

using namespace std;

void solve()
{
    ll D, T, S;
    cin >> D >> T >> S;

    if(S * T >= D) cout << "Yes\n";
    else cout << "No\n";

}

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

    int T = 1;
    //cin >> T;

    while (T--)
    {
        solve();
    }
    
    return 0;
}



Measured memory_bytes: 3644
use proconio::*;
use proconio::marker::*;
use std::cmp::*;

pub trait MoOperator {
    type Value;
    type Query;
    type Answer;
    fn init(&mut self);
    fn insert(&mut self, v: &Self::Value);
    fn delete(&mut self, v: &Self::Value);
    fn answer(&mut self, q: Self::Query) -> Self::Answer;
    fn solve(
        &mut self,
        array: &[Self::Value],
        mut query: Vec<(usize, usize, Self::Query)>,
        answer: &mut [Self::Answer],
    ) {
        let state = self;
        let size = array.len();
        assert!(query.len() <= answer.len());
        assert!(query.iter().all(|p| p.0 < p.1 && p.1 <= size));
        if query.is_empty() {
            return;
        }
        let batch = (size as f64 / (query.len() as f64).sqrt()).ceil() as usize;
        let mut q = vec![];
        std::mem::swap(&mut q, &mut query);
        let mut query = (0..(size / batch + 1)).map(|_| vec![]).collect::<Vec<_>>();
        for (i, (l, r, op)) in q.into_iter().enumerate() {
            query[l / batch].push((r, l, i, op));
        }
        state.init();
        let mut x = 0;
        let mut y = 0;
        for (i, mut query) in query.into_iter().enumerate() {
            query.sort_unstable_by_key(|p| p.0);
            if i & 1 == 1 {
                query.reverse();
            }
            for (r, l, k, op) in query.into_iter() {
                // 変更始まり
                while l < x {
                    x -= 1;
                    state.insert(&array[x]);
                }
                while y < r {
                    state.insert(&array[y]);
                    y += 1;
                }
                while x < l {
                    state.delete(&array[x]);
                    x += 1;
                }
                while r < y {
                    y -= 1;
                    state.delete(&array[y]);
                }
                // 変更終わり
                answer[k] = state.answer(op);
            }
        }
    }
}

struct State {
    cnt: Vec<u32>,
    ans: usize,
}

impl MoOperator for State {
    type Value = usize;
    type Query = ();
    type Answer = usize;
    fn init(&mut self) {
        for c in self.cnt.iter_mut() {
            *c = 0;
        }
        self.ans = 0;
    }
    fn insert(&mut self, x: &Self::Value) {
        let c = &mut self.cnt[*x];
        if *c == 0 {
            self.ans += 1;
        }
        *c += 1;
    }
    fn delete(&mut self, x: &Self::Value) {
        let c = &mut self.cnt[*x];
        if *c == 1 {
            self.ans -= 1;
        }
        *c -= 1;
    }
    fn answer(&mut self, _q: Self::Query) -> usize {
        self.ans
    }
}

#[fastout]
fn run() {
    input! {
        n: usize,
        q: usize,
        c: [Usize1; n],
        ask: [(Usize1, usize); q],
    }
    let ask: Vec<_> = ask.into_iter().map(|(l, r)| (l, r, ())).collect();
    let mut ans = vec![0; q];
    State {
        cnt: vec![0; n],
        ans: 0,
    }.solve(&c, ask, &mut ans);
    for a in ans {
        println!("{}", a);
    }
}


fn main() {
    run();
}


Measured memory_bytes: 41656
def chmin(a,b):
	return a if a<b else b

def chmax(a,b):
	return a if a>b else b

INF=1<<60

N=int(input())
h=list(map(int, input().split()))

dp=[INF for _ in range(N)]

dp[0]=0
dp[1]=dp[0]+abs(h[1]-h[0])

for i in range(1,N):
	dp[i]=chmin(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[N-1])

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

const int maxn=1e6+5;
int flag[maxn];

signed main()
{
    ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      
    int num;
    cin>>num;
    int index=(7%num);
    int count=1;


    if(!(num%2))
    {
      cout<<"-1"<<endl;
    }
    else
    {

      //77%13
     
    while(index!=0 && flag[index]==0)
    {

      flag[index]=1;
      int temp=index;
      index=((temp*10)%num+7%num)%num;
      //cout<<index<<endl;
      count++;

    }

    if(index!=0 && flag[index]==1)cout<<"-1"<<endl;
    else
      cout<<count<<endl;
    }
   return 0;

   
}

Measured memory_bytes: 11392
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<cmath>
#include<sstream>
#include<iomanip>
#include <map>
#include <stack>
 
const int64_t cc = pow( 10, 9 );
//std::cout<< std::fixed << std::setprecision(10) << ( double )( max ) / 2;
bool sort_pair( std::pair< std::string, int64_t > origin, std::pair< std::string, int64_t > another )
{
    return origin.second  > another.second;
}
 
int main()
{
    std::string word = "aa";
    int a,b,c,d,e;
    std::cin>> a;
    std::cin>> b;

    c = b + ( 10 - std::min( a , 10 ) ) * 100;

    std::cout<< c;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>

using namespace std;
#define li long long int
#define FOR(i, a, b) for (int i = a ; i < b ; ++i)
#define REP(i, n) for (int i = 0 ; i < n ; ++i)

li gcd(li a,li b) {
    return a % b == 0 ? b : gcd(b, a % b);
}

int main(void) {
    li X;
    cin >> X;

    if (X == 7 || X == 5 || X == 3) {
        cout << "YES";
    } else {
        cout << "NO";
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  string s;
  cin >> s;
  ll n=s.size();
  mat dp(n+1,vec(13));
  dp[0][0]=1;
  for(ll i=0;i<n;i++) {
    for(ll j=0;j<13;j++) {
      if(s[i]=='?') {
        for(ll k=0;k<10;k++) {
          (dp[i+1][(j*10+k)%13]+=dp[i][j])%=mod;
        }
      }
      else {
        ll id=s[i]-'0';
        (dp[i+1][(j*10+id)%13]+=dp[i][j])%=mod;
      }
    }
  }
  cout << dp[n][5] << endl;
}

Measured memory_bytes: 13696
#include<iostream>
using namespace std;
int main()
{
	int n;
  	cin>>n;
	double nOdd;
  	if(n%2 == 0)
      	nOdd = (double)n/2;
 	else
      	nOdd = (double)(n/2)+1;
  	double res = nOdd/n;
  	cout<<res;
  	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_map>
#define rep(i,n) for(ll i=0;i<n;i++)
#define chmax(a,b) a=max(a,b);
using namespace std;
typedef long long ll;

using namespace std;
#define N 110
ll h,w,x,y;
char m[N][N];
class CS{
  public:
  ll cs[N][N];
  void init(){
    for(int i=0;i<N;i++)cs[i][0]=cs[0][i]=0;
    for(int i=0;i<w;i++)for(int j=0;j<h;j++){
      cs[i+1][j+1]=cs[i][j+1]+cs[i+1][j]-cs[i][j]+(m[j][i]=='o');
    }
  }
  ll qry(ll x1,ll x2,ll y1,ll y2){
    return cs[x2+1][y2+1]-cs[x1][y2+1]-cs[x2+1][y1]+cs[x1][y1];
  }
};CS cs;

class Memo{
  public:
  ll k,ans;
  ll f[N][N][N],g[N][N][N];
  void push(ll a,ll b,ll c,ll val){
    chmax(g[a][b][c],val);
  }
  void sub(){
    rep(i,N)rep(j,N)rep(r,N)g[i][j][r]=-1e17;
    rep(a,w)for(ll b=a;b<w;b++)rep(c,h){
      ll d=k+a+c-b;if(not(c<=d&&d<h))continue;
      if(f[a][b][c]<0)continue;
      //cout<<"#"<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<f[a][b][c]<<endl;
      chmax(ans,f[a][b][c]);
      ll xl=b-x,xr=a+w-x-1;
      ll yl=d-y,yr=c+h-y-1;
      if(a>0){
	ll val=f[a][b][c];
	if(a>xl)val+=cs.qry(a-1,a-1,max(c,yl),min(d,yr));
	else val=-1e17;
	push(a-1,b,c,val);
      }
      
      if(c>0){
	ll val=f[a][b][c];
	if(c>yl)val+=cs.qry(max(a,xl),min(b,xr),c-1,c-1);
	else val=-1e17;
	push(a,b,c-1,val);
      }
      
      if(b+1<w){
	ll val=f[a][b][c];
	if(b<xr)val+=cs.qry(b+1,b+1,max(c,yl),min(d,yr));
	else val=-1e17;
	push(a,b+1,c,val);
      }
      
      if(d+1<h){
	ll val=f[a][b][c];
	if(d<yr)val+=cs.qry(max(a,xl),min(b,xr),d+1,d+1);
	else val=-1e17;
	push(a,b,c,val);
      }
    }
    rep(i,N)rep(j,N)rep(r,N)f[i][j][r]=g[i][j][r];
  }
  ll main(){
    rep(i,N)rep(j,N)rep(r,N)f[i][j][r]=-1e17;
    f[x][x][y]=0; ans=0;
    for(k=0;k<h+w-1;k++){sub();/*cout<<"-----"<<endl;*/}
    return ans;
  }
};Memo mem;

int main(){
    cin>>h>>w;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin>>m[i][j];
	if(m[i][j]=='E')x=j,y=i;
      }
    }
    cs.init();
    cout<<mem.main()<<endl;
    return 0;
}


Measured memory_bytes: 21120
// E - 1 or 2
#include <bits/stdc++.h>

using namespace std;

bool dfs(const vector<vector<pair<int, int> > > &g, int u, int c, vector<int> &vi)
{
	if (vi[u]) return vi[u] == c;
	vi[u] = c;
	for (int i = 0; i < g[u].size(); i++) {
		int v = g[u][i].first, t = g[u][i].second;
		if (!vi[v]) {
			if (c == 1 && !dfs(g, v, t == 0 ? 1 : 2, vi)) return false;
			if (c == 2 && !dfs(g, v, t == 0 ? 2 : 1, vi)) return false;
		} else {
			if (t == 0 && (c + vi[v]) % 2 == 1) return false;
			if (t == 1 && (c + vi[v]) % 2 == 0) return false;
		}
	}
	return true;
}

int main(int argc, char *argv[])
{
	int n, m;
	cin >> n >> m;
	vector<vector<pair<int, int> > > g(n);
	for (int i = 0; i < m; i++) {
		int x, y, z;
		cin >> x >> y >> z;
		x--; y--;
		g[x].push_back(make_pair(y, z % 2));
		g[y].push_back(make_pair(x, z % 2));
	}

	int ans = 0;

	vector<int> vi(n), vi2(n);
	for (int i = 0; i < n; i++) {
		if (vi[i]) continue;
		bool b1 = dfs(g, i, 1, vi);
		bool b2 = dfs(g, i, 2, vi2);
		if (b1 && b2) ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 11136
N, P = map(int, input().split())
if N == 1:
  print(P)
  exit()
ans = 1
for n in range(2, 10 ** 6 + 1):
  a = 0
  while P % n == 0:
    P //= n
    a += 1
  ans *= n ** (a // N)
print(ans)

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

const int N=310,mod=1000000007;
int f[N][N][N],n,m,ans;
vector<pair<int,int> >g[N];
inline void reduce(int&x){x+=x>>31&mod;}
int chk(int i,int j,int k){
	int L=max(max(i,j),k);
	for(auto x:g[L])
		if((i>=x.first)+(j>=x.first)+(k>=x.first)!=x.second)return 0;
	return 1;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(;m --> 0;){
		int x,y,z;cin>>x>>y>>z;
		g[y].emplace_back(x,z);
	}
	f[0][0][0]=1;
	for(int i=0;i<=n;++i)
		for(int j=0;j<=n;++j)
			for(int k=0;k<=n;++k)if(f[i][j][k]&&chk(i,j,k)){
				int L=max(max(i,j),k);
				if(L==n)reduce(ans+=f[i][j][k]-mod);
				else{
					reduce(f[L+1][j][k]+=f[i][j][k]-mod);
					reduce(f[i][L+1][k]+=f[i][j][k]-mod);
					reduce(f[i][j][L+1]+=f[i][j][k]-mod);
				}
			}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 114944
#include<stdio.h>
#include<stdlib.h>
int N,T,D[100000],i,j,t;
long long R=1;
int M=1000000007;
int cmp(const void*a,const void*b){return *(int*)a-*(int*)b;}

int main()
{
	scanf("%d%d",&N,&T);
	for(i=0;i<N;i++)
	{
		scanf("%d",&D[i]);
	}
	qsort(D,N,4,cmp);
	for(i=t=0;i<N;i++)
	{
		for(;t<N&&D[i]+T>=D[t];t++);
		R=R*(t-i)%M;
	}
	printf("%lld\n",R);
	return 0;
}

Measured memory_bytes: 1256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

ll d[100100];
ll dd[100100];

int main(){
  clr(d,0);
  clr(dd,0);
  ll n,m,vv,p;
  cin>>n>>m>>vv>>p;
  vector<ll> v;
  map<ll,ll> ma;
  map<ll,ll> ma_index;
  rep(i,0,n){
    ll a;
    cin>>a;
    v.pb(a);
    ma[a]++;
  }
  ll index = 1;
  map<ll,ll>::iterator itr = ma.begin();
  while(itr!=ma.end()){
    ll a = (*itr).fi;
    ll b = (*itr).se;
    ma_index[a] = index;
    d[index] = b;
    index++;
    itr++;
  }
  rep(i,1,100100){
    d[i]+=d[i-1];
  }
  sort(all(v));
  reverse(all(v));
  rep(i,0,v.sz){
    dd[i+1] = v[i];
  }
  rep(i,1,100100){
    dd[i]+=dd[i-1];
  }  
  ll mn = v[p-1];
  ll ans = 0;
  rep(i,0,v.sz){
    //cout << i << endl;
    //if(v[i]>=mn){
    //  ans++;
    //}
    //else{
      ll a = v[i];
      ll index1 = ma_index[a];
      ll v1 = d[index1];
      ll v2;
      ll index2 = ma_index[v[p-1]];
      v2 = d[index2];
      v2 = n-v2;
      ll v3 = vv-(v1+v2);
      ll l = v2;
      ll r = n-v1-1;
      //cout << l << " " << r << endl;
      if(r<l){
        ans++;
      }
      else{
        ll m1 = max(0LL,m*v3);
        ll m2 = (a+m)*(r-l+1);
        if(v[l]>a+m){
          continue;
        }
        else{
          l++;r++;
          ll m3 = dd[r]-dd[l-1];
          if(m3+m1<=m2){
            ans++;
          }
        }
      }
    //}
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 17140
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#define For(i,j,k)  for(int i=j;i<=k;++i)
#define Dow(i,j,k)  for(int i=k;i>=j;--i)
#define mem0(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,0x3f,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef double db;
const int INF = 0x7fffffff;
const int maxn = 5e4 + 10;
int a,b,c,d;
int main()
{
    cin>>a>>b>>c>>d;
    if(abs(a-c)<=d)printf("Yes");
    else if (abs(a-b)<=d&&abs(b-c)<=d)
    {
        printf("Yes");
    }
    else printf("No");
    return 0;
}

Measured memory_bytes: 256
from math import sqrt, floor

N = int(input())
d = [0] * (N+1)

k = floor(sqrt(N))
for x in range(1, k):
    for y in range(1, k):
        for z in range(1, k):
            c = x*x + y*y + z*z + x*y + y*z + z*x
            if 1 <= c <= N:
                d[c] += 1


for i in range(1, N+1):
    print(d[i])

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

#define ll long long
#define ld long double
#define ii pair<int ,int >
#define S second
#define F first
#define PI 3.1415926535897932384626
#define SPEED std::ios_base::sync_with_stdio(false);
const int N = 1e5+7;
const int inf = 1e9;
int dp[3007][3007];
string s,t;

int main(){
    SPEED
    cin>>s>>t;
    int n = s.size();
    int m = t.size();
    s=' '+s;
    t=' '+t;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
            if(s[i]==t[j]){
                dp[i][j]=max(dp[i-1][j-1]+1 ,dp[i][j]);
            }
        }
    }
    string ans="";
    int i=n,j=m;
    while(i>0 && j>0){
        if(s[i]==t[j]){
            ans+=s[i];
            i--,j--;
        }
        else{
            if(dp[i][j-1]==dp[i][j])j--;
            else i--;
        }
    }
    reverse(ans.begin(),ans.end());
    cout<<ans;
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
//#define int long long
using namespace std;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int start = max(a, c);
  int stop = min(b, d);
  int time = stop - start;
  if (time < 0) time = 0;
  cout << time << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#define INF 1000000009
#define LINF 1000000000000000009
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmax(T &a, const T&b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T&b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

int main() {
	ll n, m;
	cin >> n >> m;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	ll base = 1;
	for (int i = 0; i < n; i++) {
		base = lcm(base, a[i] / 2);
		if (base > INF) {
			cout << 0 << endl;
			return 0;
		}
	}
	//cout << base << endl;
	for (int i = 0; i < n; i++) {
		if (base%a[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	cout << (m / base + 1) / 2 << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;

int main() {
    int n;
    cin >> n;
    vector<LL> h(n);
    rep(i, n) {
        cin >> h[i];
    }
    int cnt = 0;
    int pre_max = 0;
    for (int height : h) {
        if (height >= pre_max) cnt++;
        pre_max = max(height, pre_max);
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
n, m, l = map(int, input().split(" "))
A = []
B = []
for i in range(n):
    a = list(map(int, input().split(" ")))
    A.append(a)
for i in range(m):
    b = list(map(int, input().split(" ")))
    B.append(b)
C = []
for i in range(n):  
    cij = []
    for j in range(l):
        ci = 0
        for k in range(m):
            ci += A[i][k]*B[k][j]        
        cij.append(ci)
    C.append(cij)
for i in range(n):
    print(*C[i])


Measured memory_bytes: 7060
N = int(input())
H = list(map(int, input().split()))
flag = 0
count = 1
for i in range(N):
    for j in range(0, i):
        if H[i] >= H[j]:
            flag = 1
        else:
            flag = 0
            break
    if flag == 1:
        count += 1
print(count)

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

//for loop関係
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//略記
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

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

//定数
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***スニペット***
ifelse, isprime, torad, todeg, lcm, bfs
****************/

//隣接リスト
vector<int> to[100005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b;
    cin >> a >> b;
    int ans=0;
    rep(i,0,b){
        if(a==1){
            ans=1;
            break;
        }
        if((a-1)*i+1>=b){
            ans=i;
            break;
        }
    }
    cout << ans ENDL;
    return 0;
}

Measured memory_bytes: 5836
import sys
input = sys.stdin.readline
N,M = map(int,input().split())
lr =[[int(i)for i in input().split()]for _ in range(M)]
ans =[0,N+1]
for LR in lr:
    if ans[0] < LR[0]:
        ans[0]=LR[0]
    if LR[1] < ans[1]:
        ans[1] =LR[1]
print(max(0,ans[1]-ans[0]+1))


Measured memory_bytes: 21148
import sys
sys.setrecursionlimit(10**7)

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3064
#include <stdio.h>

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	if(a<=8)
	{
		if(b<=8)
		{
			printf("Yay!");
		}
		else
		{
			printf(":(");
		}
	}
	else
	{
		printf(":(");
	}
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int x; cin >> x;
    
    if(x==3 || x==5 || x==7) cout << "YES" << ln;
    else cout << "NO" << ln;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ProgramingStydying
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var ta = Console.ReadLine().Split();
            var t = int.Parse(ta[0]);
            var a = int.Parse(ta[1]);

            var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var ans = 0;
            double dMin = 1000;

            for(int i = 0; i < n; i++)
            {
                var temp = (double)(t - h[i] * 0.006);
                if(Math.Abs(temp - a) < dMin)
                {
                    ans = i + 1;
                    dMin = Math.Abs(temp - a);
                }
            }
            Console.WriteLine(ans);
        }
    }
}

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

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

const int Maxn = 200005;

int n, d, a;
ii xh[Maxn];
vector <int> un;
ll BIT[Maxn];
ll res;

void Hit(int x, ll tims)
{
    x++;
    for (int i = x; i > 0; i -= i & -i)
        BIT[i] += tims;
}

ll Get(int x)
{
    ll res = 0;
    x++;
    for (int i = x; i < Maxn; i += i & -i)
        res += BIT[i];
    return res;
}

int main()
{
    scanf("%d %d %d", &n, &d, &a);
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &xh[i].first, &xh[i].second);
        un.push_back(xh[i].first);
    }
    sort(un.begin(), un.end()); un.erase(unique(un.begin(), un.end()), un.end());
    sort(xh, xh + n);
    for (int i = 0; i < n; i++) {
        int x = xh[i].first;
        ll got = Get(lower_bound(un.begin(), un.end(), x) - un.begin());
        ll nd = (xh[i].second - 1) / a + 1;
        if (got < nd) {
            ll add = nd - got; res += add;
            ll my = ll(x) + 2ll * ll(d);
            if (my > un.back()) my = un.back();
            int to = upper_bound(un.begin(), un.end(), int(my)) - un.begin() - 1;
            Hit(to, add);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4340
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;
const int N = 1e4;
const double eps = 1e-8;
const double inf = 1e20;
inline double sqr (double k) {return k * k;}
inline int sgn (double p) {
    if (fabs (p) < eps) return 0;
    if (p < 0) return -1;
    return 1;
}
struct point {
    double x, y;
    point () {}
    point (double _x, double _y) {
        x = _x, y = _y;
    }
    void input () {
        scanf ("%lf %lf", &x, &y);
    }
    bool operator == (point b) const {
        return sgn (x - b.x) == 0 && sgn (y - b.y) == 0;
    }
    point operator - (const point &b) const {
        return point (x - b.x, y - b.y);
    }
    double operator * (const point &b) const {
        return x * b.x + y * b.y;
    }
    double operator ^ (const point &b) const {
        return x * b.y - y * b.x;
    }
    double len () {
        return hypot (x, y);
    }
    double len2 () {
        return x * x + y * y;
    }
    double distance (point p) {
        return hypot (x - p.x, y - p.y);
    }
    point operator + (const point &b) const {
        return point (x + b.x, y + b.y);
    }
    point operator * (const double &b) const {
        return point (x * b, y * b);
    }
    point operator / (const double &b) const {
        return point (x / b, y / b);
    }
    double cross (point a, point b) {///叉积
        return (a - *this) ^ (b - *this);
    }
    double dot (point a, point b) {///点积
        return (a - *this) * (b - *this);
    }
    bool on_seg (point a, point b) {///点是否在线段ab上
        return sgn (cross (a, b)) == 0 && dot (a, b) <= 0;
    }
} ps[N];
///两线段是否相交
bool seg (point a, point b, point c, point d) {
    if (a.on_seg (c, d) || b.on_seg (c, d) || c.on_seg (a, b) || d.on_seg (a, b)) return true;
    if (a.cross (b, d) * a.cross (b, c) < 0 && c.cross (d, b) * c.cross (d, a) < 0) return true;
    return false;
}
/// 点的投影是否在线段ab上
bool check (point p, point a, point b) {
    point x = b - a;
    double k = x.len ();
    double u = a.dot (p, b) / k;
    x = (x / k) * u;
    x = x + a;
    if (x.on_seg (a, b)) return true;
    return false;
}
int cmp (point a, point b) {
    if ((a ^ b) > 0) return true;
    return false;
}
int main () {
    int n, ans = 1;
    cin >> n;
    for (int i = 1; i <= n; i++) ps[i].input ();
//    for (int i = 1; i <= n; i++) cout << ps[i].x << ' ' << ps[i].y << endl;
    ps[0] = ps[n];
    ps[n + 1] = ps[1];
    for (int i = 1; i <= n; i++) {
        if (ps[i].cross (ps[i - 1], ps[i + 1]) > 0) ans = 0;
//        cout << i << ' ' << ps[i].cross (ps[i - 1], ps[i + 1]) << ' ' << ps[i].x << ' ' << ps[i].y << endl;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3316
package main

import (
	"fmt"
	"sort"
)

func main() {
	bell := make([]int, 3)
	for i := 0; i < 3; i++ {
		fmt.Scan(&bell[i])
	}	
	
	sort.Sort(sort.IntSlice(bell))

	fmt.Println(bell[0]+bell[1])
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
char a[100000],b[100000];
int main()
{
	int n,m,s=0;
	cin>>a;
	n=strlen(a);
	m=n;
	for(int i=0;i<n;i++)
	{
		b[i]=a[m-1];
		m--;
	}
	for(int i=0;i<n;i++)
	{
		if(b[i]=='b')
		{
			b[i]='d';
		}
		else if(b[i]=='d')
		{
			b[i]='b';
		}
		else if(b[i]=='p')
		{
			b[i]='q';
		}
		else if(b[i]=='q')
		{
			b[i]='p';
		}
	}
	for(int i=0;i<n;i++)
	{
		if(a[i]==b[i])
		{
			s++;
		}
	}
	if(s==n)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 512