akhauriyash/Code-Regression huggingface dataset:
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 1000000000
#define ldb long double
#define pb push_back
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE ll i=p;i<=n;++i)
#define go(x) for(ll i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE ll i=n;i>=p;--i)
#define pii pair<ll,ll> 
#define mk make_pair
#define RE register
#define P 1000000007
#define S second
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define ull unsigned long long
#define mod 998244353
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline ll read()
{
    register ll x=0,f=1;register char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
const ll MAXN=200010;
ll n,ans,top;
ll f[MAXN],g[MAXN],s[MAXN];
struct wy
{
	ll x,y;
	inline ll friend operator <(wy a,wy b){return a.x<b.x;}
}t[MAXN];
int main()
{
	//freopen("1.in","r",stdin);
	get(n);
	while(n)
	{
		if(n%10==7){puts("Yes");return 0;}
		n=n/10;
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 3588
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

const ll mod=1e9+7;

int main(){
    set<ll> s;
    ll n;
    cin >> n;
    rep(i,n){
        ll d;
        cin >> d;
        s.insert(d);
    }
    cout << s.size() << endl;
} 

Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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; }

#define MAX_N 400000
int par[MAX_N+1]; //親
int ran[MAX_N+1]; //木の深さ

//n要素で初期化
void init(int n) {
    rep(i,n) {
		par[i] = i; ran[i] = 0;
	}
}

//木の根を求める
int root(int x){ return par[x]==x ? x : par[x]=root(par[x]); }

//x,yの属する集合の併合
void unite(int x, int y) {
	x = root(x); y = root(y);
	if(x == y) return ;

	if(ran[x] < ran[y]) par[x] = y;
	else {
		par[y] = x;
		if(ran[x] == ran[y]) ran[x]++;
	}
}

//x,yが同じ集合に属するか
bool same(int x, int y) { return root(x) == root(y); }

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

    int N, K, L; cin >> N >> K >> L;
    init(2*N);
    rep(i,K) {
        int p,q; cin >> p >> q;
        p--; q--;
        unite(p, q);
    }
    rep(i,L) {
        int r, l; cin >> r >> l;
        r--; l--;
        unite(r+N, l+N);
    }
    map<i_i, int> cnt;
    rep(i,N) cnt[make_pair(root(i), root(i+N))]++;
    rep(i,N) cout << cnt[make_pair(root(i), root(i+N))] << endl;
    return 0;
}



Measured memory_bytes: 15104
k,n = map(int, input().split())
a = list(map(int, input().split()))

max_dis = 0
for i in range(n):
    if i == n-1:
        max_dis = max(max_dis,a[0]+k-a[i])
    else:
        max_dis = max(max_dis,a[i+1]-a[i])

print(k-max_dis)

Measured memory_bytes: 25840
n = gets.to_i
d, x = gets.split.map(&:to_i)
a = []
n.times do
  a << gets.to_i
end

ans = 0
n.times do |i|
  s = 1
  while s <= d do
    ans += 1
    s += a[i]
  end
end
puts ans + x


Measured memory_bytes: 1788
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
// 公約数
long int gcd(long int a, long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long int lcm(long int a, long int b){
  return a * b / gcd(a, b);
}



// min
int main(void){
  long long int n, m;
  long long int num;
  long long int ans = 1;

  scanf("%lld%lld", &n, &m);

  if(n - m > 1 || m - n > 1){
    printf("0\n");
    return 0;
  }else if(n == m){
    for(long int i = n; i > 0; i--){
      ans *= i;
      while(ans > 1000000007){
	ans -= 1000000007;
      }
    }
    for(long int i = m; i > 0; i--){
      ans *= i;
      while(ans > 1000000007){
	ans -= 1000000007;
      }
    }
    ans = ans * 2;
      while(ans > 1000000007){
	ans -= 1000000007;
      }
  }else{
    for(long int i = n; i > 0; i--){
      ans *= i;
      while(ans > 1000000007){
	ans -= 1000000007;
      }
    }
    for(long int i = m; i > 0; i--){
      ans *= i;
      while(ans > 1000000007){
	ans -= 1000000007;
      }
    }    
  }
  
  
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n, q; string s;
    cin >> n >> s >> q;
    while (q--) {
        int k;
        cin >> k;
        ll d = 0, m = 0, dm = 0, ans = 0;
        int r = 0;
        rep(l, n) {
            while (r - l < k && r < n) {
                if (s[r] == 'D') d++;
                else if (s[r] == 'M') m++, dm += d;
                else if (s[r] == 'C') ans += dm;
                r++;
            }
            if (s[l] == 'D') dm -= m, d--;
            else if (s[l] == 'M') m--;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 4252
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	string s; cin >> s;

	string ans = "No";

	if (s[0] == s[3] && s[1] == s[2]) {
		if (s[0] != s[1]) {
			ans = "Yes";
		}
		
	}

	if (s[0] == s[1] && s[2] == s[3]) {
		if (s[0] != s[2]) {
			ans = "Yes";
		}
	}

	if (s[0] == s[2] && s[1] == s[3]) {
		if (s[0] != s[1]) {
			ans = "Yes";
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    int S,W;
    cin >> S >> W;
    if(S<=W) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3652
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <set>
#include <sstream>
#include <string>
#include <queue>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define foreach(it, v) for(typeof(v.begin()) it=v.begin(); it!=v.end(); ++it)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;

//MOD//
const ll MOD = 1000000007;
struct big;
big ex(big a, ll tms);
typedef struct big{
  ll val;
  big():val(0){}
  big(ll val):val((val%MOD+MOD)%MOD){}
  big& operator += (const big& obj){ (val+=obj.val)%=MOD; return *this;}
  big& operator -= (const big& obj){ (val+=MOD-obj.val)%=MOD; return *this;}
  big& operator *= (const big& obj){ (val*=obj.val)%=MOD; return *this;}
  big& operator /= (const big& obj){ (val*=ex(obj,MOD-2).val)%=MOD; return *this;}
  big operator + (const big& obj)const{ return big(*this) += obj;}
  big operator - (const big& obj)const{ return big(*this) -= obj;}
  big operator * (const big& obj)const{ return big(*this) *= obj;}
  big operator / (const big& obj)const{ return big(*this) /= obj;}
  bool operator < (const big& obj)const{ return val < obj.val;}
  bool operator == (const big& obj)const{ return val == obj.val;}
} big;
istream& operator >> (istream& i, big& obj){ i>>obj.val; return i;}
ostream& operator << (ostream& o, const big& obj){ o<<obj.val; return o;}
big ex(big obj, ll tms){
  if(!tms) return 1;
  big ret = ex(obj, tms/2);
  ret *= ret;
  return (tms&1) ? ret*obj : ret;
}
//MOD//

ll pow(ll n, int m){
  if(!m) return 1;
  ll ret = pow(n, m/2);
  ret *= ret;
  return (m&1) ? ret*n : ret;
}

template <class F, class T>
void convert(const F &f, T &t){
  stringstream ss;
  ss << f;
  ss >> t;
}

int main(){
  int N;
  scanf("%d",&N);
  int T[N];
  int A[N];
  rep(i,N) scanf("%d",&T[i]);
  rep(i,N) scanf("%d",&A[i]);
  int ma = A[0];
  if(T[N-1] != ma){
    cout << "0" << endl;
    return 0;
  }
  big ans = big(1);
  int p = 0;
  for(p=0;p<N;++p){
    if(A[p] != ma){
      cout << "0" << endl;
      return 0;
    }
    if(p!=0 && T[p] == T[p-1]){
      ans *= T[p];
    }
    if(T[p] == ma){
      break;
    }
  }
  for(int r=N-1; r>p; --r){
    if(T[r] != ma){
      cout << "0" << endl;
      return 0;
    }
    if(r!=N-1 && A[r] == A[r+1]){
      ans *= A[r];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

int main() {
    int x, n;
    cin >> x >> n;
    vector<int> p(n);
    int mini = 101;
    int maxi = 0;
    rep(i, n) {
        cin >> p[i];
        mini = min(mini, p[i]);
        maxi = max(maxi, p[i]);
    }

    // 長さ0ならxが答え
    if(n == 0) {
        cout << x << endl;
        return 0;
    }

    // 範囲集合を作る
    set<int> st;
    for(int i = mini - 1; i <= maxi + 1; ++i) {
        st.insert(i);
    }
    rep(i, n) { st.erase(p[i]); }

    /*
        for(auto i = st.begin(); i != st.end(); ++i) {
            cout << *i << ",";
        }
        cout << endl;
    */
    int diff = 999;
    int ans;
    for(auto i = st.begin(); i != st.end(); ++i) {
        if(diff > abs(x - *i)) {
            diff = abs(x - *i);
            ans = *i;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3620
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Abhas Jain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BReversi solver = new BReversi();
        solver.solve(1, in, out);
        out.close();
    }

    static class BReversi {
        int n;
        int[] c;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.ni();
            c = new int[n];
            for (int i = 0; i < n; ++i) {
                c[i] = in.ni();
            }
            int cnt = unique();
            long[] dp = new long[cnt];
            int[] prev = new int[cnt];
            for (int i = 0; i < cnt; ++i) prev[i] = -1;
            HashMap<Integer, Integer> hmp = new HashMap<>();
            for (int i = 0; i < cnt; ++i) {
                if (hmp.containsKey(c[i])) {
                    prev[i] = hmp.get(c[i]);
                }
                hmp.put(c[i], i);
            }
            long[] psum = new long[cnt];
            long mod = (long) 1e9 + 7L;
            for (int i = 0; i < cnt; ++i) {
                if (prev[i] == -1) {
                    if (i != 0)
                        psum[i] = psum[i - 1];
                } else {
                    dp[i] = (psum[prev[i]] % mod + 1L) % mod;
                    psum[i] = (psum[i - 1] % mod + dp[i] % mod) % mod;
                }
            }
            out.print((psum[cnt - 1] + 1L) % mod);
        }

        int unique() {
            int cnt = 0;
            for (int i = 0; i < n; ++i) {
                if (i == 0 || c[i] != c[i - 1]) {
                    c[cnt++] = c[i];
                }
            }
            return cnt;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 53204
# coding: utf-8
# 2^N-1が部分列の全通り
# その中で１つpこ同じ文字があれば、
# いいのは(p + 1)通り
# それに対して、全部空文字の１を引けばよい

MOD = 1000000007

N = int(input().rstrip())
S = input().rstrip()

l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
     "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
     "u", "v", "w", "x", "y", "z"]
cnt = [0 for _ in range(26)]

for ch in S:
    for i in range(26):
        if ch == l[i]:
            cnt[i] += 1

ans = 1
for i in range(26):
    ans *= (cnt[i] + 1)
    ans = ans % MOD
    
print(ans - 1)

Measured memory_bytes: 3188
#!/usr/bin/env ruby
# require 'pry'

s = gets.chomp.split("")
ACGT=['A', 'C', 'G', 'T']
count=0
ary=[]
s.map.with_index do |ele,i|
  if ACGT.include?(ele)
    count += 1
    if i == s.length - 1
      ary << count
    end
  else
    ary << count
    count = 0
  end
end
puts ary.max


Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int;
            var a = consoleReader.Split.Int;
            Array.Sort(a);
            return a.Last() - a[0];
        }

        #region いつもの
#pragma warning disable
        private ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
    }
    static class Ext
    {
        public static Dictionary<TKey, int> GroupCount<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) => source.GroupBy(keySelector).ToDictionary(g => g.Key, g => g.Count());
        public static Dictionary<TKey, int> GroupCount<TKey>(this IEnumerable<TKey> source) => source.GroupCount(i => i);
    }
    public class ConsoleReader { private string[] ReadLineSplit() => textReader.ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries); private string[] line = Array.Empty<string>(); private int linePosition; private TextReader textReader; public ConsoleReader(TextReader tr) { textReader = tr; } public int Int => int.Parse(String); public long Long => long.Parse(String); public double Double => double.Parse(String); public string String { get { if (linePosition >= line.Length) { linePosition = 0; line = ReadLineSplit(); } return line[linePosition++]; } } public class SplitLine { private string[] splited; public SplitLine(ConsoleReader cr) { splited = cr.ReadLineSplit(); cr.line = Array.Empty<string>(); } public int[] Int => String.Select(x => int.Parse(x)).ToArray(); public int[] Int0 => String.Select(x => int.Parse(x) - 1).ToArray(); public long[] Long => String.Select(x => long.Parse(x)).ToArray(); public double[] Double => String.Select(x => double.Parse(x)).ToArray(); public string[] String => splited; } public SplitLine Split => new SplitLine(this); public class RepeatReader : IEnumerable<ConsoleReader> { ConsoleReader cr; int count; public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; } public IEnumerator<ConsoleReader> GetEnumerator() => Enumerable.Repeat(cr, count).GetEnumerator(); System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public IEnumerable<string> String => this.Select(cr => cr.String); public IEnumerable<int> Int => this.Select(cr => cr.Int); public IEnumerable<int> Int0 => this.Select(cr => cr.Int - 1); public IEnumerable<long> Long => this.Select(cr => cr.Long); public IEnumerable<double> Double => this.Select(cr => cr.Double); } public RepeatReader Repeat(int count) => new RepeatReader(this, count); }
    #endregion
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 22;

int h,w;
string f[N];

int dp[N][N][N][N];
int Grundy(int ly, int lx, int ry, int rx){
    if(ry<ly || rx<lx) return 0;
    if(dp[ly][lx][ry][rx]>=0) return dp[ly][lx][ry][rx];

    set<int> s;
    for(int i=ly; i<=ry; ++i)for(int j=lx; j<=rx; ++j){
        if(f[i][j]=='.'){
            int g = Grundy(ly,lx,i-1,j-1)^Grundy(ly,j+1,i-1,rx)^Grundy(i+1,lx,ry,j-1)^Grundy(i+1,j+1,ry,rx);
            s.insert(g);
        }
    }

    int ret = 0;
    while(s.count(ret)) ++ret;

    return dp[ly][lx][ry][rx] = ret;
}

int main(){
    cin >>h >>w;
    rep(i,h) cin >>f[i];

    memset(dp,-1,sizeof(dp));
    int g = Grundy(0,0,h-1,w-1);
    cout << (g==0?"Second":"First") << endl;
    return 0;
}



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


const int N = 1e5 + 123;
int n, d[N], a[N], k;
int main() {
	//freopen("input.txt", "r", stdin);
    cin >> n >> k;
    for(int i = 1; i <= n; ++i) d[i] = 1e9;
    d[1] = 0;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
        for(int j = i - 1; j >= i - k; --j) {
        	if(j == 0) break;
        	d[i] = min(abs(a[i] - a[j]) + d[j], d[i]);
        }
    }
    cout << d[n];
}

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

int main(){
  int X,A,B;
  cin >>X>>A>>B;
  
  int sum = B-A;
  string ans;
  if(sum<=0) ans = "delicious";
  else if(sum>X) ans = "dangerous";
  else ans = "safe";
  
  cout <<ans<< endl;
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int A[3][3];
    rep(i, 3) rep(j, 3) { cin >> A[i][j]; }
    int ok[3][3];
    rep(i, 3) rep(j, 3) { ok[i][j] = 0; }
    int n;
    cin >> n;
    vector<int> B(n, 0);
    rep(k, n) {
        cin >> B[k];
        // d(B[k]);
        rep(i, 3) rep(j, 3) {
            if (A[i][j] == B[k] and ok[i][j] == 0) { ok[i][j] = 1; }
        }
    }

    // rep(i, 3) {
    //     rep(j, 3) { cout << ok[i][j] << " "; }
    //     cout << endl;
    // }
    rep(i, 3) {
        if (ok[i][0] + ok[i][1] + ok[i][2] == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    rep(j, 3) {
        if (ok[0][j] + ok[1][j] + ok[2][j] == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if (ok[0][0] + ok[1][1] + ok[2][2] == 3) {
        cout << "Yes" << endl;
        return 0;
    }
    if (ok[0][2] + ok[1][1] + ok[2][0] == 3) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a,b,c,i;
    int k = 0;
    scanf("%d %d %d",&a,&b,&c);
    for(i = a ;i <= b;i++){
        if(c%i == 0){ 
            k++;
        }   
    }   
    printf("%d\n",k);
}

Measured memory_bytes: 2724
#include <iostream>
using namespace std;
int main()
{
  int a, b;
  cin >> a >> b;
  int n = b - a;
  int ans = 0;
  for (int i = 1; i < n; i++)
    ans += i;
  ans -= a;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [[] for i in range(n)]
#print(s)
for i in range(n):
  s[i] = list(input().split())
kyokumei = input()
ans = 0
for i in range(n):
  if s[i][0] == kyokumei:
    for j in range(i+1,n):
      ans += int(s[j][1])
    break
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
char ss[210];
int check(int s,int e){
	if((e-s+1)&1)return 0;
	int sta1=s;
	int sta2=(e-s+1)/2+s;
	for(int i=0;i<(e-s+1)/2;i++)
		if(ss[sta1+i]!=ss[sta2+i])
			return 0;
	return 1;
}
int main(){
	scanf("%s",ss);
	int ans=0,len=strlen(ss);
	for(int i=0;i<len-1;i++)
		for(int j=i+1;j<len-1;j++)
			if(check(i,j))
				ans=max(ans,j-i+1);
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int a[N], p[N];
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int ans = 0;
    for (int i = 1; i <= n; i++){
        scanf("%d",&a[i]);
        p[i] = p[i-1]+a[i]+1;
        if (i >= k) ans = max(ans,p[i]-p[i-k]);
    }
    printf("%.6f",(double)ans/2);

}


Measured memory_bytes: 1792
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M = IL()

if N == M:
  ans = 2
elif abs(N-M) == 1:
  ans = 1
else:
  print(0)
  exit()

for i in range(1,N+1):
  ans *= i
  ans %= mod
for i in range(1,M+1):
  ans *= i
  ans %= mod

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main(void){
    int d;
    cin >> d;
    cout << "Christmas ";
    for (int i = 0; i < 25 - d; i++) {
        cout << "Eve ";
    }
}


Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
B = get_ints

sum = B[0] + B.last
1.step(N-2) do |i|
  sum += [B[i], B[i-1]].min
end

puts sum


Measured memory_bytes: 14356
#include<stdio.h>
int main(){
 int i,j,k,n,x,cnt;
 while(1){
  cnt=0;
  scanf("%d %d", &n, &x);
  if(n==0 && x==0)break;
  for(i=1; i<n;i++){
   for(j=i+1; j<n;j++){
    for(k=j+1; k<n+1;k++){
     if(i+j+k == x){cnt++;}
    }
   }
  }
  printf("%d\n", cnt);
 }
 return 0;
}

Measured memory_bytes: 600
n = $stdin.gets.chomp.to_i
kei = 1
arr = Array.new(10000+1){0}
1.step(100) do |x|
  1.step(100) do |y|
    1.step(100) do |z|
  	  kei = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if kei <= 10000
      arr[kei] += 1
      end
    end
  end
end

n.times do |k|
 p arr[k+1]
end

Measured memory_bytes: 14384
import java.util.*;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[]$) {
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        long[] a=new long[n];
        long ans1=0,ans2=0;
        for (int i = 0; i < n; i++) {
            a[i]=sc.nextLong();
        }
        long temp1=0,temp2=0;
        for (int i = 0; i <n; i++) {
            //ans1:a[0]を負とする場合
            temp1+=a[i];
            temp2+=a[i];
            if(i%2==0){
                //負にする
                if(temp1>=0) {
                    ans1 += temp1 + 1;
                    temp1 = -1;
                }
                //正にする
                if(temp2<=0) {
                    ans2 +=1-temp2;
                    temp2 = 1;
                }
            }else{
                //正にする
                if(temp1<=0){
                    ans1+=1-temp1;
                    temp1=1;
                }
                //負にする
                if(temp2>=0){
                    ans2+=1+temp2;
                    temp2=-1;
                }
            }
        }
        out.println(min(ans1,ans2));
    }
}

Measured memory_bytes: 63044
def a():
    N,M = map(int,input().split())

    d = dict()
    for _ in range(M):
        S,C = map(int,input().split())
        S -= 1
        if (S in d)and(d[S] != C):
            return -1
        else:
            d[S] = C

    def b(i):
        i = str(i)
        if len(i) != N:
            return 0
        for k,v in d.items():
            if int(i[k]) != v:
                return 0
        return 1

    for i in filter(b,range(0,1000)):
        return i

    return -1

print(a())




Measured memory_bytes: 38356
from itertools import product


def main():
    H, W, K = map(int, input().split())
    c = [input() for _ in range(H)]

    ans = 0
    zo = (0, 1)

    select_H = list(product(zo, repeat=H))
    select_W = list(product(zo, repeat=W))

    for sh in select_H:
        for sw in select_W:
            tmp = 0
            for i, cc in enumerate(c):
                for j, ccc in enumerate(cc):
                    if sh[i] == 1 or sw[j] == 1:
                        continue
                    elif ccc == '#':
                        tmp += 1
            if tmp == K:
                ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9208
#include<bits/stdc++.h>
#define boost ios::sync_with_stdio(false); cin.tie(0)
#define ll              long long int
#define ld              long double
#define mk              make_pair
#define pb              push_back
#define f               first
#define s               second
#define fo(i,a,b)       for(i=a;i<b;i++)
#define foe(i,a,b)      for(i=a;i<=b;i++)
#define all(x)          x.begin(),x.end()
// #define vi               vector<int>
#define vl              vector <long long int>
// #define pii          pair <int,int>
#define pll             pair <long long int, long long int>
// #define vpii         vector< pair<int,int> >
#define vpll            vector < pair <long long int,long long int> >
#define MOD             1000000007
using namespace std;
const int inf = INT_MAX;
const ll inf64 = LLONG_MAX;

ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll lcm(ll x, ll y) {ll res = (x * y) / __gcd(x, y); return res;}
ll power(ll x, ll y) {ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, MOD - 2);}


int main()
{
    boost;
    ll n;
    cin >> n;
    if (n < 2) {
        cout << 0 << '\n';
        return 0;
    }
    ll c1, c2;
    c1 = sub(power(10, n), power(9, n));
    c2 = sub(power(10, n), power(9, n));
    ll tot = add(c1, c2);
    ll ans = sub(tot, sub(power(10, n) , power(8, n)));
    cout << ans;

    return 0;
}

Measured memory_bytes: 3668
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define answer(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int a, b;
    cin >> a >> b;
    set<int> q;
    q.insert(1);
    q.insert(2);
    q.insert(3);
    auto it = q.find(a);
    q.erase(it);
    it = q.find(b);
    q.erase(it);
    it = q.begin();

    cout << *it << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

long long gcd(int a, int b){
  if (a%b == 0){
    return(b);
  }
  else{
    return(gcd(b, a%b));
  }
}

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

  if(S<=W){
    cout << "unsafe" << endl;
    return 0;
  }
  
  cout << "safe"  << endl;

}
 


Measured memory_bytes: 3628
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int []v = new int[N];
		
		for(int i=0; i<N; i++) {
			v[i] = sc.nextInt();
		}
      	//vを昇順に並び替える
		Arrays.sort(v);
        //answerにvの最小値を入れる
		double answer = v[0];
      
   		//小さい順から計算すれば最大値が得られる
		//最小値＋次の値/2をanswerに代入していく
		for(int j=1; j<N; j++) {
			answer = (answer+v[j])/2;
		}
		System.out.println(answer);
	}		
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
 
int main() {
 int n;
  cin>>n;
  float sum=0.0;
  int a[n];
	for(int i=0;i<n;i++) {
     cin>>a[i]; 
  	sum+=1/(float)a[i];
    }
  cout<<1/(float)sum<<endl;
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
   string N;
   cin>>N;
   bool r=false;
   for(int i=0; i<N.size();i++){
    if(N[i]=='7'){

        r=true;
        break;
    }
   }
   if(r)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

return 0;
}

Measured memory_bytes: 3572
X,N=map(int,input().split())
if N==0:
    print(X)
    exit()
p=set([int(i) for i in input().split()])
for a in range(110):
    if not((X-a) in p):
        print(X-a)
        exit()
    if not((X+a) in p):
        print(X+a)
        exit()


Measured memory_bytes: 9180
#include<stdio.h>

int main(){
  int D,N;
  scanf("%d %d", &D, &N);

  if(N==100) N++;
  
  if(D==0){
    printf("%d\n", N);
  }else if(D==1){
    printf("%d\n", N*100);
  }else{
    printf("%d\n", N*10000);
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define isz(x) (int)(x).size()
#define watch(x) std::cerr << #x << " = " << x
#define watchsp(x) watch(x) << ' '
#define watchln(x) watch(x) << std::endl
#define cerr cerr && false && std::cerr
using vi = std::vector<int>;
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
    os << "{";
    for (int i = 0; i < isz(vec); i++) {
        if (i > 0) os << ", ";
        os << vec[i];
    } 
    return os << "}";
}
const int mod = (int)1e9+7, NMAX = 10012;
int dp[NMAX][10][100];
std::string s;
int solve(int i, int want, const int d) {
    if (i < 0) return dp[0][0][want];
    int res = 0;
    for (char c = '0'; c < s[i]; c++) {
        res += dp[i+1][c-'0'][want];
        if (res >= mod) res -= mod;
    }
    watchln(i);
    watchln(want);
    watchln(res);
    // d - (curr + s[i]) == want
    want = (want - (s[i] - '0') + d * d * d) % d;
    res += solve(i-1, want, d);
    if (res >= mod) res -= mod;
    return res;
}
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    std::cin >> s;
    std::reverse(all(s));
    int d; std::cin >> d;
    dp[0][0][0] = 1;
    for (int len = 1; len <= isz(s); len++) {
        for (int curr = 0; curr < 10; curr++) {
            for (int prev = 0; prev < 10; prev++) {
                for (int m = 0; m < d; m++) {
                    int nm = (m + curr) % d;
                    dp[len][curr][nm] += dp[len-1][prev][m];
                    if (dp[len][curr][nm] >= mod) {
                        dp[len][curr][nm] -= mod;
                    }
                }
            }
            watchsp(len); watchsp(curr);
            vi row(&dp[len][curr][0],&dp[len][curr][0]+d);
            watchln(row);
        }
    }
    int res = (solve(isz(s)-1,0,d)-1+mod) % mod;
    std::cout << res << std::endl;
    return 0;
}

Measured memory_bytes: 40064
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
s=0
b=True
for i in a:
  s+=i

  
for i in range(0,m):
  if a[i]>=s/4/m:
    b=True
  else:
    b=False
    
if b:
  print('Yes')
else:
  print('No')

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

const int64_t mod = 998244353;

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

	int N, K;
	cin >> N >> K;
	vector<pair<int, int>> ranges(K);
	for (auto& r : ranges) {
		cin >> r.first >> r.second;
	}

	vector<int64_t> csum(N+5, 0);
	csum[N] = 1;

	int64_t ans = 0;

	for (int i = N-1; i >= 1; --i) {
		int64_t cnt = 0;
		for (int k = 0; k < K; ++k) {
			int r = min(N, i+ranges[k].second);
			int l = i+ranges[k].first;
			if (l > N) continue;
			// cout << i << " " << k << " " << l << " " << r << endl;
			cnt += (((csum[l]-csum[r+1])%mod)+mod)%mod;
			cnt %= mod;
		}
		ans = cnt;
		csum[i] = csum[i+1]+cnt;
		csum[i] %= mod;
	}

	cout << ans << endl;

	
}

Measured memory_bytes: 4780
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        String Sprime = sc.next();
        String T = sc.next();
        check:
        for (int i = Sprime.length() - T.length(); i >= 0; i--) {
            for (int j = 0; j < T.length(); j++) {
                if (T.charAt(j) == Sprime.charAt(i + j) || Sprime.charAt(i + j) == '?') {
                } else {
                    continue check;
                }
            }
            for (int j = 0; j < Sprime.length(); j++) {
                if (j >= i && j < i + T.length()) {
                    System.out.print(T.charAt(j - i));
                } else if (Sprime.charAt(j) == '?') {
                    System.out.print('a');
                } else {
                    System.out.print(Sprime.charAt(j));
                }
            }
            System.out.println();
            return;
        }
        System.out.println("UNRESTORABLE");
    }
}


Measured memory_bytes: 24916
#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;

int main(){
    int n;

    long long power = 1;
    

    scanf("%d", &n);

    for(int i = 1; i <= n; i++){
        power = (power * i)%(1000000000 + 7);
    }

    printf("%lld\n", power);

    return 0;
}

Measured memory_bytes: 256
In = sorted([int(i) for i in input().split(" ")])
Max = max(In)
# print(Max)
count = Max - In[1]
In[0] += count
In[1] += count

if (In[1] - In[0])%2==0:
    count+=(In[1] - In[0])//2
else:
    count+=(In[1]+1 - In[0])//2 + 1
print(count)

Measured memory_bytes: 3064
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define wzh(x) cerr<<#x<<'='<<x<<endl;
int n,a[N];
const int mod=1e9+7;
int add(int x,int y){
  x+=y;
  if(x>=mod)x-=mod;
  return x;
}
int di(int x,int y){
  x-=y;
  if(x<0)x+=mod;
  return x;
}
int mul(int x,int y){
  return 1ll*x*y%mod;
}
int main() {
  ios::sync_with_stdio(false);
  int sum=0;
  cin>>n;
  for(int i=1;i<=n;i++)cin>>a[i],sum=add(sum,a[i]);
  int ans=0;
  for(int i=1;i<=n;i++){
    sum=di(sum,a[i]);
    ans=add(ans,mul(a[i],sum));
  }
  cout<<ans<<'\n';
  return 0;
}

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

int main()
{
    int i;
    int questions, answer, answer_times;
    int count_wa = 0, count_ac = 0;
    char result[2];

    scanf("%d %d", &questions, &answer_times);

    int cleared_q[questions+1];
    int wrongs[questions+1];
    for (i = 1; i <= questions; i++)
    {
        cleared_q[i] = 0;
        wrongs[i] = 0;
    }
    for (i = 0; i < answer_times; i++)
    {
        scanf("%d %s", &answer, result);
        if (cleared_q[answer] == 0)
        {
            // printf("%d\n", i);
            /* まだ正解していない場合、正誤を確認する */
            if (strcmp(result, "AC") == 0)
            {
                /* 正解だった場合、正解数を1増やし、誤答回数にその問題の誤答回数を追加する */
                cleared_q[answer] = 1;
                count_ac++;
                count_wa += wrongs[answer];
            }
            else
            {
                /* 不正解だった場合、その問題の誤答回数を追加 */
                wrongs[answer] += 1;
            }
        }
    }
    printf("%d %d\n", count_ac, count_wa);
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

LL big_mod(LL val,LL pow,LL mod);
LL mod_inverse(LL val,LL mod);
string sum_of_two_strings(string a,string b);
string division_of_string(string a,LL divisor);






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int r;
    cin >> r;
    cout << 3*r*r;
    return 0;
}








LL big_mod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    if(mod == 1)
    {
        return 0;
    }
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)
    {
        x += mod1;
    }
    return x;
}

string sum_of_two_strings(string a,string b)
{
    reverse(a.B,a.E);
    reverse(b.B,b.E);
    char c;
    string ans="";
    int length_of_a=a.SZ,length_of_b=b.SZ;
    int i,carry=0,sum,length=max(length_of_a,length_of_b);
    for(i=0; i<length; i++)
    {
        if(i >= length_of_a)
        {
            sum=(b[i]-48)+carry;
        }
        else if(i >= length_of_b)
        {
            sum=(a[i]-48)+carry;
        }
        else
        {
            sum=(a[i]-48)+(b[i]-48)+carry;
        }
        carry=sum/10;
        sum%=10;
        c=sum+48;
        ans+=c;
    }
    if(carry > 0)
    {
        ans+=(carry+48);
    }
    reverse(ans.B,ans.E);
    return ans;
}

string division_of_string(string a,LL divisor)
{
    string ans="";
    int i=0,l=a.SZ;
    LL temp=a[0]-'0';
    while(temp < divisor)
    {
        temp=temp*10+(a[++i]-'0');
    }
    while(i < l)
    {
        ans+=((temp/divisor)+'0');
        temp=(temp%divisor)*10+(a[++i]-'0');
    }
    if(ans.SZ == 0)
    {
        return "0";
    }
    return ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {
	
	void Solve() {
		UL N; cin >> N;
		UL K; cin >> K;
		UL A[1000]; rep(i, N) cin >> A[i];
		vector<ULL> AA;
		for (UL i = 0; i < N; i++) {
			ULL S = 0;
			for (UL j = i; j < N; j++) {
				S += A[j];
				AA.push_back(S);
			}
		}
		ULL ans = 0;
		for (ULL M = 1ull << 40; M != 0; M >>= 1) {
			UL n = 0;
			rep(i, AA.size()) if (AA[i] & M) n++;
			if (n >= K) {
				UL p = 0;
				while (p < AA.size()) {
					if ((AA[p] & M) == 0) {
						swap(AA[p], AA.back());
						AA.pop_back();
					}
					else p++;
				}
				ans |= M;
			}
		}
		cout << ans << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 6128
# Tを1、Sを-1としてcumsum()をとる　最大値の分だけTが左に残る
import numpy as np

X = input()

Y = np.zeros(len(X), dtype=int)
for i in range(len(X)):
    if X[i] == 'S':
        Y[i] = -1
    else:
        Y[i] = 1

answer = 2 * Y.cumsum().max()
print(answer)

Measured memory_bytes: 16328