akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n , k , a[105];
int dp[100005];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> k;
    for (int i=0;i<n;i++)cin >> a[i];
    for (int i=1;i<=k;i++)
    {
        for (int j=0;j<n;j++)
        {
            if (i - a[j] >= 0)
            {
                if (!dp[i - a[j]])
                {
                    dp[i] = 1;
                    break;
                }
            }
        }
    }
    if (dp[k])cout << "First" << endl;
    else cout << "Second" << endl;
    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;

int main(){
    int n; cin >> n;
    vector<vector<int>> as(n, vector<int>(n-1));
    unordered_map<int, int> mp;
    for(int i=0; i<n; ++i){
        for(int j=0; j<n-1; ++j){
            cin >> as[i][j];
            --as[i][j];
        }
        ++mp[as[i][0]];
    }
    vector<int> is(n);
    int ans=0;
    while(!mp.empty()){
        vector<int> xs;
        for(auto&& p : mp){
            xs.push_back(p.first);
        }
        unordered_set<int> found;
        for(auto x : xs){
            if(found.find(x)!=found.end()) continue;
            int y=as[x][is[x]];
            if(found.find(y)!=found.end()) continue;
            if(as[y][is[y]]!=x) continue;
            found.insert(x);
            found.insert(y);
            if(mp[x]==1) mp.erase(x);
            else --mp[x];
            if(mp[y]==1) mp.erase(y);
            else --mp[y];
            ++is[x];
            ++is[y];
            if(is[x]<n-1)
                ++mp[as[x][is[x]]];
            if(is[y]<n-1)
                ++mp[as[y][is[y]]];
        }
        if(xs.size() && found.empty()){
            ans=-1;
            break;
        }
        ++ans;
    }

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


Measured memory_bytes: 4352
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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(b<a){a=b;return 1;}return 0;}

void solve();

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

void solve(){
    ll n;cin>>n;
    vl a(n);rep(i,n)cin>>a[i];

    ll MX=1e6;
    vl b(MX+5);
    rep(i,n)b[a[i]]++;

    ll ans=0;
    repe(i,MX){
        if(!b[i])continue;
        if(b[i]==1)ans++;
        for(ll j=i+i;j<=MX;j+=i)b[j]=0;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 12704
#include <bits/stdc++.h>
#define fi first
#define se second
#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 srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  vp a(5);
  rep(i,5){
    int b;
    cin>>b;
    int c = b%10;
    if(c==0)c=10;
    a[i].fi = c;
    a[i].se = b;
  }
  sort(rng(a),greater<pair<int,int>>());
  int ans= 0;
  rep(i,5){
  if(a[i].fi == 0 || i==4){
    ans+=a[i].se;
  }else{
    ans+=a[i].se+10-a[i].fi;
  }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		String[] s = new String[H+2];
		char[][] c = new char[H+2][W+2];
		int[][] ans = new int[H+2][W+2];
 		for(int i = 1; i <= H; i++) {
			s[i] = sc.next();
			for(int j = 1; j <= W; j++) {
				c[i][j] = s[i].charAt(j-1);
			}
		}
// 		
// 		for(int i = 0; i < H; i++) {
// 			c[i][W] = 'a';
// 		}
// 		
// 		for(int i = 0; i < W; i++) {
// 			c[H][i] = 'b';
// 		}
//		
		for(int h = 1; h <= H; h++) {
			for(int w = 1; w <= W; w++) {
				if(c[h][w] == '.') {
					for(int i = h - 1; i <= h + 1; i++ ) {
						for(int j = w - 1; j <= w + 1; j++) {
							if(c[i][j] == '#') ans[h][w]++;
						}
					}
				}else if(c[h][w] == '#') {
					ans[h][w] = -1;
				}
			}
		}
		
		for(int i = 1; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				if(ans[i][j] != -1) {
					System.out.print(ans[i][j]);
				}else {
					System.out.print("#");
				}
			}
			System.out.println();
		}
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

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

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int n;
long long a[200005];
long long s[200005];
long long ans=1e18;
int main(){
	cin>>n;
//	cout<<n<<endl;
	for (int i=1;i<=n;i++){
		cin>>a[i];
//		cout<<i<<endl;
		//s[i]=s[i-1]+a[i];
	}
//	return 0;
	for (int i=1;i<=n;i++){
		s[i]=s[i-1]+a[i];
		//cout<<s[i]<<" ";
	}
	
	for (int i=1;i<=n-1;i++){
		ans=min(ans,abs(s[i]-s[n]+s[i]));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3328
while True:
  h,w = map(int, input().split())
  if h == 0 & w == 0:
    break

  for i in range(h):
    for j in range(w):
      if i == 0 or j == 0 or i == h-1 or j == w-1:
        print('#', end = '')
      else:
        print('.', end = '')
    print()
  print()


Measured memory_bytes: 7000
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
maru = []
for i in range(N):
  tmp = int(input())
  
  for y, row in enumerate(A):
    try:
      A[y][row.index(tmp)] = 0
      print([y, row.index(tmp)], "a")
      maru.append([y, row.index(tmp)])
      break
    except ValueError:
      pass

f = False
for i in range(3):
  if A[i][0] == 0 and A[i][0] == A[i][1] and A[i][1] == A[i][2]:
    f = True
for i in range(3):
  if A[0][i] == 0 and A[0][i] == A[1][i] and A[1][i] == A[2][i]:
    f = True
if A[0][0] == 0 and A[0][0] == A[1][1] and A[1][1] == A[2][2]:
  f = True
if A[0][2] == 0 and A[0][2] == A[1][1] and A[1][1] == A[2][0]:
  f = True
if f:
  print("Yes")
else:
  print("No")

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

using namespace std;

int main(){
  int k;
  cin >> k;
  string s;
  cin >> s;
  
  if(k>=s.length()){
    cout << s << endl;
  }else{
    for(int i=0;i<k;i++)
      cout << s.at(i);
    cout << "..." << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3628
main = do
    line <- getLine
    line <- getLine
    let p = [read x::Int | x<-words line]
    putStrLn $ if ( and $ map judge p) then "APPROVED" else "DENIED"

judge :: Int -> Bool
judge x
    | mod x 2 == 1 = True
    | otherwise = if (mod x 3 ==0 || mod x 5 ==0) then True else False  

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int n,k;cin >> n >> k;
	vector<int> a(n+1,0);
	rep(i,n)cin >> a[i];
	vector<int> b(n);
	while(k--){
		b = vector<int> (n+1,0);
		bool update = false;
		rep(i,n){
			//i-a[i],i+a[i]+1
			b[max(0ll,i-a[i])]++;
			b[min(n,i+a[i]+1)]--;
		}
		rep(i,n-1)b[i+1] += b[i];
		swap(a,b);
		rep(i,n){
			if(a[i] != b[i]){
				update = true;
			}
		}
		if(!update)break;
	}
	rep(i,n)cout << a[i] << " ";
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int a = 0, z = 0;
    for(int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') {
            a = i;
            break;
        }
    }
    for(int i = 0; i < s.size(); i++) {
        if (s[i] == 'Z') {
            z = i;
        }
    }
    string res = "";
    for(int i = a; i <= z; i++) {
        res += s[i];
    }
    cout << res.size() << endl;
    return 0;
}

Measured memory_bytes: 776
from itertools import product
N = int(input())
MOD = 10 ** 9 + 7


dp = [{''.join(last_3): 0 for last_3 in product('AGCT', repeat=3)} for i in range(N + 1)]
dp[0]['TTT'] = 1
NG = {'AGC', 'ACG', 'GAC', 'AGGC', 'ACGC', 'ATGC', 'AGAC', 'AGTC'}

for i in range(N):
    for last_3 in product('AGCT', repeat=3):
        # 3文字out
        if ''.join(last_3) in NG:
            continue

        for next_s in 'AGCT':
            X = ''.join(last_3) + next_s
            # 4文字目out
            if X in NG:
                continue
            else:
                dp[i + 1][X[1:]] += dp[i][X[:-1]]
                dp[i + 1][X[1:]] %= MOD

ans = 0
for key, value in dp[-1].items():
    if key not in NG:
        ans += value
        ans %= MOD
print(ans)


Measured memory_bytes: 3828
K=int(input())
cnt=0
dp=[0]*(10**6)
piv=0
dig=[0]*10000
d=0
cnt=float("inf")
zure=0
befnum=0
i=0
buf=""
cntall=0
while i<2*(10**5):
    if i+1<10:
        dp[i]=i+1
        dig[d]=dig[d]+1
    else:
        if cnt>=dig[d-1]:
            i=i+zure
            zure=0
            cnt=0
            befnum=dig[d]
            d=d+1
        #print(i,befnum)
        buf=str(dp[i-befnum])
        piv=buf[len(buf)-1]
        #print(buf, piv,i-befnum)
        #print(dp,dig,zure,i,dig[i],dp[i-befnum],befnum)
        if int(piv)==0:
            dp[i+zure]=dp[i-befnum]*10
            dp[i+1+zure]=dp[i - befnum] * 10+1
            dig[d]=dig[d]+2
            zure=zure+1
        elif int(piv)==9:
            dp[i + zure] = dp[i - befnum] * 10+8
            dp[i + 1 + zure] = dp[i - befnum] * 10+9
            dig[d] = dig[d] + 2
            zure = zure + 1
        else:
            dp[i+zure]=dp[i-befnum]*10+int(piv)-1
            dp[i+1+zure]=dp[i - befnum] * 10+int(piv)
            dp[i+2+zure] = dp[i - befnum] * 10 + int(piv)+1
            dig[d] = dig[d] + 3
            zure=zure+2
        cnt=cnt+1
    i=i+1
    #if i%20000==0:
        #print(i)
    #print(dp)
    #input()
print(dp[K-1])





Measured memory_bytes: 49896
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

void solve(){
}

int main(){
  int n,m;
  while(cin>>n>>m,n||m){
    vector<int> v(n+m);
    rep(i,n+m){
      cin>>v[i];
    }
    v.push_back(0);
    sort(v.begin(),v.end());

    int ans = 0;
    REP(i,1,n+m+1){
      ans = max(ans,v[i] - v[i-1]);
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1084
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN=1e6+69;
const int INF = 1e10;
const int mod = 1e9+7;
int m,n,k,q;
string s;
int hsh[MAXN];
int Pow[MAXN];
int fact[MAXN];
struct vl{
    int x,y;
    bool operator<(vl t)const{
        if(x==t.x)return y<t.y;
        return x<t.x;
    }
};
int luythua(int x, int y){
    if(y==0)return 1;
    if(y==1)return x%mod;
    int k = luythua(x,y/2);
    if(y%2==0)return k*k%mod;
    return k*k%mod*x%mod;
}
void build(int i){
    hsh[i] = (((s[i-1]-'0'))%mod+hsh[i-1]*10%mod)%mod;
}
int tinh(int l, int r){
    return (hsh[r]-hsh[l-1]*Pow[r-l+1]+mod)%mod;
}
int comb(int k, int n){
    return fact[n]*luythua(fact[k],mod-2)%mod*luythua(fact[n-k],mod-2)%mod;
}
int a[MAXN];
signed main(){                                                                                                                                                                                                                                                                                                  ios_base::sync_with_stdio(false);    cin.tie(0);    cout.tie(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++)cin>>a[i];
    int cnt = 0;
    for(int i=1;i<=n;i++)if(a[i]>=m)cnt++;
    cout<<cnt;
}


Measured memory_bytes: 4440
def max(a,b); a > b ? a : b; end
def min(a,b); a < b ? a : b; end

def extract_cycle(s, used)
  cycle = []
  u = s
  until used[u]
    used[u] = true
    cycle << u  
    u = P[u]
  end
  return cycle
end

N, K = gets.split.map(&:to_i)
P = gets.split.map(&:to_i).tap{|array| array.unshift(0) }
C = gets.split.map(&:to_i).tap{|array| array.unshift(0) }

used = Array.new(N + 1)

ans = (1 .. N).inject(-1e20) do |max_score, s|
  next max_score if used[s]
  # sを始点とする閉路を抽出
  cycle = extract_cycle(s, used)
  z = cycle.size
  
  # 閉路の各頂点から最大1周分のスコアを計算できるように事前準備
  dp = Array.new(3 * z + 1, 0)
  (1 .. z * 3).each do |i|
    v = cycle[i % z]
    dp[i] = dp[i - 1] + C[v]
  end

  # 閉路上の任意の点 s を始点としたときの最大スコアを計算
  # 1周 + 余りの最大スコアを計算する
  # 余りのみ計算すると1周が負(sz < 0)かつ, K >= zのときに
  # 上手く計算できないので、z + K % zになってる。
  
  sz = max(0, dp[z])
  k = min(K, z + K % z)
  r = (K - k) / z

  cycle_score = (0 ... z).map{|s| r * sz + dp[s + 1, k].max - dp[s]}.max

  max(max_score, cycle_score)
end
puts ans


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

int main() {
  int A , B , C , D ;
  cin >> A >> B >> C >> D ;
  
  int E = A * B ;
  int F = C * D ;
  
  if(E > F){
    cout << E << endl;
  }
  else if (E == F){
    cout << E << endl;
  }
  else if (E < F){
    cout << F << endl;
  }  
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <array>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

#define MODULE 1000000007
#define MP make_pair

template<class T, class U>
inline void chmin(T &t, U f) { if (t > f)t = f; }

template<class T, class U>
inline void chmax(T &t, U f) { if (t < f)t = f; }

typedef pair<int, int> P;
typedef long long LL;
const int INF = INT_MAX / 2;    //int_max->2*e+9
const int MAXN = 1001;

/*struct edge {   //structとclassの違いは，メンバが初期状態でpublicとなっているかprivateとなっているか
    edge(int to, int cost) : to(to), cost(cost) {}
    int to, cost;
};
vector<edge> graph[MAXN];*/
vector<int> graph[MAXN+1];
int color[MAXN+1];

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

//-----Template---------
LL a,b,c,myCount=0;
priority_queue<int> qu;     //これで最大値を取り出せる　最小値なら <int ,std::vector<int>, std::greater<int>>
int main() {
    ios::sync_with_stdio(false);
    cin >> a>>b>>c;
    if(a%2==0)
        myCount++;
    if(b%2==0)
        myCount++;
    if(c%2==0)
        myCount++;
    qu.push(a);
    qu.push(b);
    qu.push(c);
    if(myCount>=1){
        cout<<0<<endl;
    }else{
        LL Max=qu.top()/2;qu.pop();
        LL a=qu.top();qu.pop();
        LL b=qu.top();qu.pop();
        cout<<a*b<<endl;
    }


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,m,p,a,b,x,y;
double d[31][31],t,uma[31],dp[1<<8][31];
main(){
  while(cin>>n>>m>>p>>a>>b,a){
    r(i,31)r(j,31)d[i][j]=1e9;
    a--;b--;
    r(i,n)cin>>uma[i];
    r(i,p){
      cin>>x>>y>>t;x--;y--;
      d[x][y]=t;
      d[y][x]=t;
    }
    r(i,1<<8)r(j,31)dp[i][j]=1e8;
    dp[(1<<n)-1][a]=0;
    for(int S=(1<<n)-1;S>=0;S--)r(v,m)r(i,n)
      if((S>>i)&1)r(j,m)
        dp[S-(1<<i)][j]=min(dp[S-(1<<i)][j],dp[S][v]+d[v][j]/uma[i]);
    double ans=1e9;
    r(i,1<<n)ans=min(ans,dp[i][b]);
    if(ans==1e8)cout<<"Impossible"<<endl;
    else printf("%.10f\n",ans);
  }
}

Measured memory_bytes: 3260
#include <iostream>
#include <vector>
#include <utility>

bool canmake(int mid,int m,int n,std::vector<std::vector<int>> &a){
    std::vector<int> usecnt(n,0);
    std::vector<bool> canuse(m, true);
    for (int i = 0; i < m; ++i) {
        std::vector<int> pcnt(m,0);
        std::pair<int,int> maxk=std::make_pair(0,-1);
        for (int j = 0; j < n; ++j) {
            if(canuse[a[j][usecnt[j]]])++pcnt[a[j][usecnt[j]]];
            if(pcnt[a[j][usecnt[j]]]>maxk.first){
                maxk=std::make_pair(pcnt[a[j][usecnt[j]]],a[j][usecnt[j]]);
            }
        }
        if(maxk.first<=mid)return true;
        else{
            canuse[maxk.second]=false;
            for (int j = 0; j < n; ++j) {
                for (int l = usecnt[j]; l < m; ++l) {
                    if(!canuse[a[j][usecnt[j]]])++usecnt[j];
                    else break;
                }
            }
        }
    }
    return false;
}

int main(){
    int n,m;
    std::cin>>n>>m;
    std::vector<std::vector<int>> a(n,std::vector<int>(m));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            std::cin>>a[i][j];
            --a[i][j];
        }
    }
    int pok=n,png=0;
    int pmid=(pok+png)/2;
    while(pok-png!=1){
        pmid=(pok+png)/2;
        if(canmake(pmid,m,n,a))pok=pmid;
        else png=pmid;
    }
    std::cout<<pok<<std::endl;
    return 0;
}

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

int main(){
	string str, tmp;
	int n,h;
	while(cin>>str){
		if(str=="-")break;
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>h;
			tmp=str.substr(0,h);
			str.erase(0,h);
			str+=tmp;	
		}
		cout<<str<<endl;
	}
}


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

long long i,j,n,arr[200000],arr2[200000];

int main()
{
   cin>>n;
   
   for(i=0;i<n;i++)
   {
        cin>>arr[i]; 
        arr2[arr[i]-1]=i+1;      
   }
   
   for(i=0;i<n;i++)
   {
        cout<<arr2[i]<<" ";
   }
}

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

typedef long long LL;

const int OO = 1e9;
const int MOD = 1e9 + 7;

const int MAXN = 123456;

int f[26];
int nxt[MAXN][26];

void solve() {
	string s, t;
	cin >> s >> t;

	int n = s.length();
	int m = t.length();

	for (int i = 0; i < 26; ++i) {
		nxt[n - 1][i] = n;
		f[i] = n;
	}
	f[s[n - 1] - 'a'] = n - 1;
	for (int i = n - 2; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) {
			nxt[i][j] = nxt[i + 1][j];
			nxt[i][s[i + 1] - 'a'] = i + 1;
			f[s[i] - 'a'] = i;
		}
	}

	int p = f[t[0] - 'a'];
	if (p == n) {
		cout << "-1\n";
		return;
	}
	LL ans = 0;
	for (int i = 1; i < m; ++i) {
		p = nxt[p][t[i] - 'a'];
		if (p == n) {
			p = f[t[i] - 'a'];
			if (p == n) {
				cout << "-1\n";
				return;
			}
			ans += n;
		}
	}
	ans += p + 1;

	cout << ans << '\n';
}

int32_t main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// #endif

	// clock_t begin = clock();

	solve();

	// clock_t end = clock();
	// cerr << "\nELAPSED TIME: " << (double) (end - begin) / CLOCKS_PER_SEC;

	return 0;
}


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

const int maxn = 501;
std::map<int, int> m;

int main() {
	for(int i = 0; i < 10 && (1 << i) < maxn; ++i)
		m[1 << i] = i;
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	for(int j = i + 1; j < n; ++j)
		printf("%d%c", m[(i ^ j) & -(i ^ j)] + 1, " \n"[j == n - 1]);
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }

void solve(void)
{
  int N; cin >> N;
  using Pair = pair<int, int>;
  map<Pair, int> memo{};
  for (int i = 1; i <= N; ++i) {
    string s = std::to_string(i);
    Pair p{s[0] - '0', s[s.size() - 1] - '0'};
    ++memo[p];
  }

  int res{};
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      res += memo[Pair{i, j}] * memo[Pair{j, i}];
    }
  }

  cout << res << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    int cnt[2] = {0};

    if(a == 5) ++cnt[0];
    else if(a == 7) ++cnt[1];
    
    if(b == 5) ++cnt[0];
    else if(b == 7) ++cnt[1];
    
    if(c == 5) ++cnt[0];
    else if(c == 7) ++cnt[1];

    if(cnt[0] == 2 && cnt[1] == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
#define inf 2147483647
#define eps 1e-9
using namespace std;
typedef long long ll;
ll n,m,L,R,st[5010],num[5010],b[210][5010],l[210][5010],r[210][5010];
ll ans=0,a[5010],pre[5010],sq[5010][5010];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<n;i++){
        scanf("%lld",&a[i]);
        pre[i+1]=pre[i]+a[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            scanf("%d",&b[j][i]);
        }
    }
    for(int i=1;i<=m;i++){
        L=R=0;
        for(int j=1;j<=n;j++){
            while(L&&b[i][j]>st[L])L--;
            l[i][j]=L?num[L]+1:1;
            st[++L]=b[i][j];
            num[L]=j;
        }
        for(int j=n;j;j--){
            while(R&&b[i][j]>st[R])R--;
            r[i][j]=R?num[R]-1:n;
            st[++R]=b[i][j];
            num[R]=j;
        }
        for(int j=1;j<=n;j++){
            sq[l[i][j]][j]+=b[i][j];
            sq[l[i][j]][r[i][j]+1]-=b[i][j];
            sq[j+1][j]-=b[i][j];
            sq[j+1][r[i][j]+1]+=b[i][j];
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            sq[i][j]+=sq[i][j-1];
        }
        for(int j=1;j<=n;j++){
            sq[i][j]+=sq[i-1][j];
        }
        for(int j=i;j<=n;j++){
            ans=max(ans,sq[i][j]-pre[j]+pre[i]);
        }
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 220672
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>

#include <queue>
#include <cstdio>

#include <list>
#include <set>
#include <map>


#define PI (3.14159265358979323846)
#define INF (1e+9)
#define DIV_NUM (1000000007)

using namespace std;


bool seen[501][501];

int N, M;
int X, Y, Z;

int con;
//    string S;


char field[501][501];
int  dist[501][501];

typedef pair<int, int> P;
queue<P> que;


//typedef vector<vector<int>> v;
vector<double> ai;
vector<double> wi;


set<int> s1;
map<string, int> m1;
map<string, int> m2;

int weight[110], value[110];
int dp[110][10010];


int main(){
  
  
    //string ss ;


    cin >> N >> M ;
    int way = 0;

    way = N * (N - 1) / 2 + M * (M - 1) / 2;


    std::cout << way << "\n";

        return 0;

}


Measured memory_bytes: 256
import sys

x = int(input())
for i in range(x,10**10+1):
  if i == 2 or i == 3:
    print(i)
    sys.exit()
  else:
    a = int(i**(1/2))
    is_prime = True
    for j in range(2,a+1):
      if i%j == 0:
        is_prime = False
        break
    if is_prime:
      print(i)
      sys.exit()

Measured memory_bytes: 9448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    int a,b,c,d,e,f,cap;cin>>a>>b>>c>>d>>e>>f;
    double water,sugar,am=1,as=-1;
    double ans=0;

    cap=0;water=0;sugar=0;

    for(int i=0;cap+i*a*100<f+1;i++)
    {
        cap+=i*a*100;
        water+=100*a*i;

        for(int j=0;cap+j*b*100<f+1;j++)
        {
            cap+=j*b*100;
            water+=100*b*j;

            double capp=cap,suga=sugar;

            for(int k=0;cap+c*k<f+1;k++)
            {
                
                cap+=c*k;
                sugar+=c*k;
                
                while(cap+d<f+1 && e*water>=100*(sugar+d))
                {
                    cap+=d;
                    sugar+=d;
                    
                }

                //if(i==0 && j==2)cout<<(sugar)/(sugar+water)<<" "<<i<<" "<<j<<" "<<k<<" "<<water<<":"<<sugar<<endl;

                if(as*(sugar+water)<sugar*am && e*water>=100*(sugar)){
                    am=water+sugar;
                    as=sugar;
                    //cout<<"DEBUG"<<cap<<" "<<i<<" "<<j<<" "<<k<<endl;
                }
                
                cap=capp;
                sugar=suga;
            }
            cap-=j*b*100;
            water-=100*b*j;
        }
        cap-=i*a*100;
        water-=100*a*i;
    }

    cout<<(int)am<<" "<<(int)as<<endl;
}

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

const int inf = 1e9;
const ll linf = 1e18;

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

    string s; cin >> s;
    for (int i = 0; i < s.length(); i++) {
        s[i] = 'x';
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N, Q = map(int,input().split())
S = input()
S_array = [0] * N
for i in range(N):
    S_array[i] = S_array[i-1]
    if S[i-1] == 'A' and S[i] == 'C':
        S_array[i] += 1
for _ in range(Q):
    l, r = map(int,input().split())
    print(S_array[r-1]-S_array[l-1])

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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  int minimum = LLONG_MAX;
  REP(i,5) {
    int tmp;
    cin >> tmp;
    minimum = min(minimum, tmp);
  }
  if(n <= minimum) {
    cout << 5 << endl;
    return 0;
  }
  int extra = n / minimum;
  if(n%minimum == 0) --extra;
  cout << 5+extra;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,x,y,t,s;
	scanf("%d %d %d",&n,&x,&t);
	y=n/x;
	s=n%x;
	if(s!=0){
		y++;
	}
	printf("%d\n",y*t);
	return 0;
}

Measured memory_bytes: 1732
from collections import deque
n = int(input())
g = [[] for _ in range(n)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append([v, w])
    g[v].append([u, w])
used = [0]*n
used[0] = 1
parity = [-1]*n
parity[0] = 0
que = deque()
que.append(0)
while que:
    # print(que)
    v = que.popleft()
    for nv, w in g[v]:
        if used[nv]:
            continue
        parity[nv] = (parity[v] + w)%2
        used[nv] = 1
        que.append(nv)

# print(used)
for i in range(n):
    print(parity[i])

Measured memory_bytes: 46736
# 横の回数をx, 縦の回数をyとすると k=x*(M-2)+y*(N-2)になればいい
# あとは例外 N or M==1のときはK<=N*Mからすべての値が可能
# N or M==2のときはすべての偶数が可能
# KがNorMで割り切れれば可能
# しょうがくせいのさんすうなのにあたまがわるすぎてくそどはまりしたよ せかいいちきょうぷろむいてないね いんたいしたほうがいいよ

n, m, k = map(int, input().split())
if n == 1 or m == 1:
    print("Yes")
    exit()
if (n == 2 or m == 2) and k % 2 == 0:
    print("Yes")
    exit()
if k % n == 0 or k % m == 0:
    print("Yes")
    exit()
for y in range(1, n):
    for x in range(1, m):
        # print("y, x = {}, {}".format(y, x))
        # print("面積 {}".format((y * m - x * y) + x * (n - y)))
        if k == (y * m - x * y) + x * (n - y):
            # print(y, x)
            # print("y*x={}".format(y * x))
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 3064
var output;
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//1:数値へ変換 2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字に分割 7:1文字に分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main() {
  var one = myconv(next(),4);
  var N = one[0];
  var M = one[1];
  var nlist = new Array(N);
  for(var i = 0; i < N; i++){
    nlist[i] = next();
  }
  var mlist = new Array(M);
  for(var i = 0; i < M; i++){
    mlist[i] = next();
  }
  var count = 0;
  for(var i = 0; i < N-M+1; i++){
    for(var j = 0; j < N-M+1; j++){
      var first = nlist[i].slice(j,j+M);
      if(first == mlist[0]){ 
        var isNG = false;
      	var check = "";
        check = "i : " + i + ",j : " + j;
        for(var k = 1; k < M; k++){
          var nextStr = nlist[i + k].slice(j,j + M);
          if(nextStr != mlist[k]){
            isNG = true;
             break;
          }
        }
        if(!isNG){
          myout("Yes");
          myerr(check);
          return;
        }
      }
    }
  }
  myout("No");
}

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define mod 1000000007
#define MAX_V 100000
#define N MAX_V
using namespace std;
typedef long long ll;
int V;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> vs;
bool used[MAX_V];
int cmp[MAX_V];
int n,m;

void add_edge(int from,int to){
  G[from].push_back(to);
  rG[to].push_back(from);
}

void dfs(int v){
  used[v]=true;
  for(int i=0;i<G[v].size();i++)if(!used[G[v][i]])dfs(G[v][i]);
  vs.push_back(v);
}

void rdfs(int v,int k){
  used[v]=true;
  cmp[v]=k;
  for(int i=0;i<rG[v].size();i++) if(!used[rG[v][i]])rdfs(rG[v][i],k);
}

int scc(){
  memset(used,0,sizeof(used));
  vs.clear();
  for(int v=0;v<V;v++) if(!used[v]) dfs(v);
  
  memset(used,0,sizeof(used));
  int k=0;
  for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]]) rdfs(vs[i],k++);
  return k;
}


void mk_G(){
  int k=scc();
  vector <int> tmp[N],rtmp[N];
  for(int i=0;i<n;i++){
    for(int j=0;j<G[i].size();j++)
      if(cmp[i]!=cmp[G[i][j]]) tmp[cmp[i]].push_back(cmp[G[i][j]]);
    for(int j=0;j<rG[i].size();j++)
      if(cmp[i]!=cmp[rG[i][j]]) rtmp[cmp[i]].push_back(cmp[rG[i][j]]);
    G[i].clear();
    rG[i].clear();
  }
  n=k;
  for(int i=0;i<k;i++) G[i]=tmp[i],rG[i]=rtmp[i];
}
 
ll calc(int pos){
  if(used[pos]) return 1;
  used[pos]=1;
  ll res=1;
  for(int i=0;i<rG[pos].size();i++)res=res*calc(rG[pos][i])%mod;
  return (res+1)%mod;
}
 

int main(){
  cin>>n>>m;
  V=n;
  for(int i=0,a,b;i<m;i++)cin>>a>>b,add_edge(a-1,b-1);
  mk_G();
  ll ans=1;
  memset(used,0,sizeof(used));
  for(int i=0;i<n;i++) if(!G[i].size())ans=ans*calc(i)%mod;
  cout <<ans<<endl;
  return 0;
}

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

int main(void){
  long int N,M,C;
  cin>>N;
  cin>>M;
  vector< vector<long int> > A;
  long int ans = 0;
  long int buy = 0;
  A.resize(N);		// ()内の数字が要素数になる
  for( long int i=0; i<N; i++ ){
    A[i].resize(2);
  }
  for(long int i = 0; i<N; i++){
    for(long int j = 0; j<2; j++){
      cin>>A[i][j];
    }
  }
  
  //shori
  sort(A.begin(),A.end());
  
  for(long int i = 0; i<N; i++){
    for(; A[i][1]>0 && buy < M;){
      ans += A[i][0];
      A[i][1]--;
      buy++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  int a, b;
  cin >> a >> b;
  cout << a * a - b;
    return 0;
}

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


int main()
{
    int i,j,a,b,c=0,n,t=0;
    char ch[10];
    scanf("%d%d",&a,&b);
    scanf("%s",ch);
    n = strlen(ch);
    //printf("%d\n",n);
    for(i=0; i<n; i++)
    {
        if(ch[i]>='0' && ch[i]<='9' && i<a)
        {
            ++t;
            if(t==a)
            {
                ++c;
                //printf("c1 = %d\n",c);
                t=0;
            }
        }
        else if(ch[i]=='-' && i==a)
        {
            ++t;
            if(t==1)
            {
                ++c;
                //printf("c2 = %d\n",c);
                t = 0;
            }
        }
        else if( ch[i]>='0' && ch[i]<='9'  )
        {
            ++t;
            if(t==b)
            {

                ++c;
                //printf("c3 = %d\n",c);
                t=0;
            }
        }

    }
    if(c==3)
        printf("Yes\n");
    else
        printf("No\n");
}


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

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


   int n;
   cin>>n;

   int a[n][2];

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

   int j=0;
   for(int i=0;i<n;i++){
     if(a[i][0]==a[i][1]){
          j++;
          if(j==3){
               cout<<"Yes";
               break;
          }
     }
     else{
          j=0;
     }
   }

   if(j<3){
     cout<<"No";
   }

return 0;
}


Measured memory_bytes: 3652
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int r;
	
	cin >>  r;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,cnt=0;
  cin>>a>>b>>c;
  if(a>b) swap(a,b);
  for(int i=a;i<=b;++i){
    if(c%i==0) ++cnt;
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 3096
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
    A--; B--; C--; D--;
    string S; cin >> S;

    string ans = "Yes";
    regex re1("##");

    if (regex_search(S.substr(A,C-A+1), re1) || 
        regex_search(S.substr(B,D-B+1), re1)) ans = "No";

    if (D < C) {
        ans = "No";
        int i = B;
        while(i<=D) {
            if (0<=i-1 && i+1<N && S[i-1]=='.' && S[i+1]=='.') {
                ans = "Yes";
            }

            if (S[i + 1] == '.') i++;
            else i += 2;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <string>
#include <sstream>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<ll> VL;

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

    string s;
    cin >> s;

    ll tmp1 = 0;
    for (ll i = 0; i < s.length(); ++i) {
        char c = s[i];
        if (i % 2 == 0) {
            if (c == '1') {
                tmp1++;
            }
        } else {
            if (c == '0') {
                tmp1++;
            }
        }
    }

    ll tmp2 = 0;
    for (ll i = 0; i < s.length(); ++i) {
        char c = s[i];
        if (i % 2 == 0) {
            if (c == '0') {
                tmp2++;
            }
        } else {
            if (c == '1') {
                tmp2++;
            }
        }
    }

    cout << min(tmp1, tmp2) << endl;

}

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

sys.setrecursionlimit(10000000)

N,M,P=map(int,input().split())
INF = 1000000000
edge = []
to = [[] for _ in range(N)]
rto = [[] for _ in range(N)]
reachable_from1 = [False]*N
reachable_fromN = [False]*N
for i in range(M):
    a,b,c = map(int,input().split())
    a-=1
    b-=1
    c=-c
    to[a].append(b)
    rto[b].append(a)
    edge.append([a,b,c])

def dfs(v):
    if reachable_from1[v] == True:
        return
    reachable_from1[v] = True
    for u in to[v]:
        dfs(u)

def rdfs(v):
    if reachable_fromN[v] == True:
        return
    reachable_fromN[v] = True
    for u in rto[v]:
        rdfs(u)

dfs(0)
rdfs(N-1)
ok = [False]*N
for i in range(N):
    ok[i] = reachable_from1[i]&reachable_fromN[i]

d = [INF]*N
d[0] = 0
update = True
step=0
while update:
    update = False
    for i in range(M):
        a,b,c=edge[i]
        if not(ok[a]): continue
        newD = d[a]+c+P
        if newD < d[b]:
            d[b] = newD
            update = True
    step+=1
    if step > N:
        print(-1)
        sys.exit()
print(max(0,-d[N-1]))
    




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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  string S;
  cin >> S;

  bool ok1 = S[0]=='A';
  int ok2 = 0;
  for(int i=2;i<=SZ(S)-2;++i)
	ok2 += S[i]=='C';

  int c = 0;
  REP(i,SZ(S)) if('A' <= S[i] && S[i] <= 'Z') ++c;

  cout << (ok1 && ok2==1 && c==2 ? "AC":"WA") << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
ans = ''
m = ord('a') - 1
x = 0
while n != 0:
    rem = (n % (26 ** (x + 1))) // (26 ** x)
    if rem == 0:
        ans = 'z' + ans
        n -= 26 ** (x + 1)
    else:
        ans = chr(m + rem) + ans
        n -= rem * 26 ** x
    x += 1
print(ans)

Measured memory_bytes: 9068
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,n[110],i,j,x,y,p,q;
    cin>>a>>b;
    if(b==0) cout<<a<<endl;
    else
    {
        for(i=0;i<b;i++) cin>>n[i];
        y=a-1;
        for(i=0;;i++)
        {
            p=0;q=0;
           x=a-i;
           y=y+1;
           for(j=0;j<b;j++)
           {
              if(n[j]==x)
              {
                  p=1;
              }
              if(n[j]==y)
              {
                  q=1;
              }
           }
           if(p==0 && q==0)
           {
               cout<<x<<endl;
               break;
           }
           else if(p==1 && q==0)
           {
               cout<<y<<endl;
               break;
           }
           if(p==0 && q==1)
           {
               cout<<x<<endl;
               break;
           }
        }
    }
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main () {
 
  int R, G, B ,N;
  cin >> R >> G >> B >> N;
  int res = 0;
  int rn = N/R;
  int nrest = N;
  for (int r = 0; r < rn+1; r++) {
    nrest = N - r*R;
    if (nrest==0) { 
      res++;
      continue;
    }
    int gn = nrest/G;
    for (int g = 0; g < gn+1; g++) {
      nrest = N - r*R - g*G;
      if (nrest==0) { 
	res++;
	break;
      }
      if (nrest%B == 0) {
	res++;
      }
      //int bn = nrest/B;
      // for (int b = 0; b < bn+1; b++) {
      // 	nrest = N - r*R - g*G - b*B;
      // 	if (nrest==0) { 
      // 	  res++;
      // 	  //continue;
      // 	  break;
      // 	}
      // }
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a,b,N,m=0;
	cin>>a>>b>>N;
	int data[1001]={0};
	for (int A=a;A<b;A++) data[A]=1;
	for (int A=0;A<N;A++){
		cin>>a>>b;
		for (int B=a;B<b;B++){
			if (data[B]==1) m=1;
			else data[B]=1;
		}
	}
	cout<<m<<endl;
	return 0;
}



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

#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<30)
#define INFLL (1LL<<62LL)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, -1, 1};

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

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int N, K;
  cin >> N >> K;
  vector<int> A(N);

  rep(i, N) {
    cin >> A[i];
  }

  if (N == 1) {
    if (A[0] == K) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
  }

  sort(A.begin(), A.end());

  int g = gcd(A[0], A[1]);
  REP(i, 2, N) {
    g = gcd(A[i], g);
  }

  if (K % g == 0 && K <= A.back()) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;

  return 0;
}


Measured memory_bytes: 640